#ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_
#define CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_
#include <string>
#include "base/basictypes.h"
#include "base/callback_forward.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "base/scoped_observer.h"
#include "chrome/browser/profiles/profile_info_cache_observer.h"
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/ui/app_list/chrome_signin_delegate.h"
#include "chrome/browser/ui/app_list/start_page_observer.h"
#include "components/signin/core/browser/signin_manager_base.h"
#include "ui/app_list/app_list_view_delegate.h"
class AppListControllerDelegate;
class Profile;
namespace app_list {
class SearchController;
class SpeechUIModel;
}
namespace base {
class FilePath;
}
namespace gfx {
class ImageSkia;
}
#if defined(USE_ASH)
class AppSyncUIStateWatcher;
#endif
class AppListViewDelegate : public app_list::AppListViewDelegate,
                            public app_list::StartPageObserver,
                            public ProfileInfoCacheObserver,
                            public SigninManagerBase::Observer,
                            public SigninManagerFactory::Observer {
 public:
  AppListViewDelegate(Profile* profile,
                      AppListControllerDelegate* controller);
  virtual ~AppListViewDelegate();
 private:
  
  void OnProfileChanged();
  
  virtual bool ForceNativeDesktop() const OVERRIDE;
  virtual void SetProfileByPath(const base::FilePath& profile_path) OVERRIDE;
  virtual app_list::AppListModel* GetModel() OVERRIDE;
  virtual app_list::SigninDelegate* GetSigninDelegate() OVERRIDE;
  virtual app_list::SpeechUIModel* GetSpeechUI() OVERRIDE;
  virtual void GetShortcutPathForApp(
      const std::string& app_id,
      const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE;
  virtual void StartSearch() OVERRIDE;
  virtual void StopSearch() OVERRIDE;
  virtual void OpenSearchResult(app_list::SearchResult* result,
                                bool auto_launch,
                                int event_flags) OVERRIDE;
  virtual void InvokeSearchResultAction(app_list::SearchResult* result,
                                        int action_index,
                                        int event_flags) OVERRIDE;
  virtual base::TimeDelta GetAutoLaunchTimeout() OVERRIDE;
  virtual void AutoLaunchCanceled() OVERRIDE;
  virtual void ViewInitialized() OVERRIDE;
  virtual void Dismiss() OVERRIDE;
  virtual void ViewClosing() OVERRIDE;
  virtual gfx::ImageSkia GetWindowIcon() OVERRIDE;
  virtual void OpenSettings() OVERRIDE;
  virtual void OpenHelp() OVERRIDE;
  virtual void OpenFeedback() OVERRIDE;
  virtual void ToggleSpeechRecognition() OVERRIDE;
  virtual void ShowForProfileByPath(
      const base::FilePath& profile_path) OVERRIDE;
  virtual content::WebContents* GetStartPageContents() OVERRIDE;
  virtual content::WebContents* GetSpeechRecognitionContents() OVERRIDE;
  virtual const Users& GetUsers() const OVERRIDE;
  virtual void AddObserver(
      app_list::AppListViewDelegateObserver* observer) OVERRIDE;
  virtual void RemoveObserver(
      app_list::AppListViewDelegateObserver* observer) OVERRIDE;
  
  virtual void OnSpeechResult(const base::string16& result,
                              bool is_final) OVERRIDE;
  virtual void OnSpeechSoundLevelChanged(int16 level) OVERRIDE;
  virtual void OnSpeechRecognitionStateChanged(
      app_list::SpeechRecognitionState new_state) OVERRIDE;
  
  virtual void SigninManagerCreated(SigninManagerBase* manager) OVERRIDE;
  virtual void SigninManagerShutdown(SigninManagerBase* manager) OVERRIDE;
  
  virtual void GoogleSigninFailed(const GoogleServiceAuthError& error) OVERRIDE;
  virtual void GoogleSigninSucceeded(const std::string& username,
                                     const std::string& password) OVERRIDE;
  virtual void GoogleSignedOut(const std::string& username) OVERRIDE;
  
  virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE;
  virtual void OnProfileWasRemoved(const base::FilePath& profile_path,
                                   const base::string16& profile_name) OVERRIDE;
  virtual void OnProfileNameChanged(
      const base::FilePath& profile_path,
      const base::string16& old_profile_name) OVERRIDE;
  scoped_ptr<app_list::SearchController> search_controller_;
  
  AppListControllerDelegate* controller_;
  
  
  Profile* profile_;
  
  
  app_list::AppListModel* model_;
  scoped_ptr<app_list::SpeechUIModel> speech_ui_;
  base::TimeDelta auto_launch_timeout_;
  Users users_;
  ChromeSigninDelegate signin_delegate_;
#if defined(USE_ASH)
  scoped_ptr<AppSyncUIStateWatcher> app_sync_ui_state_watcher_;
#endif
  ObserverList<app_list::AppListViewDelegateObserver> observers_;
  
  
  ScopedObserver<SigninManagerBase, AppListViewDelegate> scoped_observer_;
  DISALLOW_COPY_AND_ASSIGN(AppListViewDelegate);
};
#endif