| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 15 #include "base/scoped_observer.h" | |
| 16 #include "chrome/browser/profiles/profile_info_cache_observer.h" | 15 #include "chrome/browser/profiles/profile_info_cache_observer.h" |
| 17 #include "chrome/browser/search/hotword_client.h" | 16 #include "chrome/browser/search/hotword_client.h" |
| 18 #include "chrome/browser/signin/signin_manager_factory.h" | |
| 19 #include "chrome/browser/ui/app_list/chrome_signin_delegate.h" | |
| 20 #include "chrome/browser/ui/app_list/start_page_observer.h" | 17 #include "chrome/browser/ui/app_list/start_page_observer.h" |
| 21 #include "components/signin/core/browser/signin_manager_base.h" | |
| 22 #include "ui/app_list/app_list_view_delegate.h" | 18 #include "ui/app_list/app_list_view_delegate.h" |
| 23 | 19 |
| 24 class AppListControllerDelegate; | 20 class AppListControllerDelegate; |
| 25 class Profile; | 21 class Profile; |
| 26 | 22 |
| 27 namespace app_list { | 23 namespace app_list { |
| 28 class SearchController; | 24 class SearchController; |
| 29 class SpeechUIModel; | 25 class SpeechUIModel; |
| 30 } | 26 } |
| 31 | 27 |
| 32 namespace base { | 28 namespace base { |
| 33 class FilePath; | 29 class FilePath; |
| 34 } | 30 } |
| 35 | 31 |
| 36 namespace gfx { | 32 namespace gfx { |
| 37 class ImageSkia; | 33 class ImageSkia; |
| 38 } | 34 } |
| 39 | 35 |
| 40 #if defined(USE_ASH) | 36 #if defined(USE_ASH) |
| 41 class AppSyncUIStateWatcher; | 37 class AppSyncUIStateWatcher; |
| 42 #endif | 38 #endif |
| 43 | 39 |
| 44 class AppListViewDelegate : public app_list::AppListViewDelegate, | 40 class AppListViewDelegate : public app_list::AppListViewDelegate, |
| 45 public app_list::StartPageObserver, | 41 public app_list::StartPageObserver, |
| 46 public HotwordClient, | 42 public HotwordClient, |
| 47 public ProfileInfoCacheObserver, | 43 public ProfileInfoCacheObserver { |
| 48 public SigninManagerBase::Observer, | |
| 49 public SigninManagerFactory::Observer { | |
| 50 public: | 44 public: |
| 51 AppListViewDelegate(Profile* profile, | 45 AppListViewDelegate(Profile* profile, |
| 52 AppListControllerDelegate* controller); | 46 AppListControllerDelegate* controller); |
| 53 virtual ~AppListViewDelegate(); | 47 virtual ~AppListViewDelegate(); |
| 54 | 48 |
| 55 private: | 49 private: |
| 56 // Updates the app list's current profile and ProfileMenuItems. | 50 // Updates the app list's current profile and ProfileMenuItems. |
| 57 void OnProfileChanged(); | 51 void OnProfileChanged(); |
| 58 | 52 |
| 59 // Overridden from app_list::AppListViewDelegate: | 53 // Overridden from app_list::AppListViewDelegate: |
| 60 virtual bool ForceNativeDesktop() const OVERRIDE; | 54 virtual bool ForceNativeDesktop() const OVERRIDE; |
| 61 virtual void SetProfileByPath(const base::FilePath& profile_path) OVERRIDE; | 55 virtual void SetProfileByPath(const base::FilePath& profile_path) OVERRIDE; |
| 62 virtual app_list::AppListModel* GetModel() OVERRIDE; | 56 virtual app_list::AppListModel* GetModel() OVERRIDE; |
| 63 virtual app_list::SigninDelegate* GetSigninDelegate() OVERRIDE; | |
| 64 virtual app_list::SpeechUIModel* GetSpeechUI() OVERRIDE; | 57 virtual app_list::SpeechUIModel* GetSpeechUI() OVERRIDE; |
| 65 virtual void GetShortcutPathForApp( | 58 virtual void GetShortcutPathForApp( |
| 66 const std::string& app_id, | 59 const std::string& app_id, |
| 67 const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE; | 60 const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE; |
| 68 virtual void StartSearch() OVERRIDE; | 61 virtual void StartSearch() OVERRIDE; |
| 69 virtual void StopSearch() OVERRIDE; | 62 virtual void StopSearch() OVERRIDE; |
| 70 virtual void OpenSearchResult(app_list::SearchResult* result, | 63 virtual void OpenSearchResult(app_list::SearchResult* result, |
| 71 bool auto_launch, | 64 bool auto_launch, |
| 72 int event_flags) OVERRIDE; | 65 int event_flags) OVERRIDE; |
| 73 virtual void InvokeSearchResultAction(app_list::SearchResult* result, | 66 virtual void InvokeSearchResultAction(app_list::SearchResult* result, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 98 virtual void OnSpeechResult(const base::string16& result, | 91 virtual void OnSpeechResult(const base::string16& result, |
| 99 bool is_final) OVERRIDE; | 92 bool is_final) OVERRIDE; |
| 100 virtual void OnSpeechSoundLevelChanged(int16 level) OVERRIDE; | 93 virtual void OnSpeechSoundLevelChanged(int16 level) OVERRIDE; |
| 101 virtual void OnSpeechRecognitionStateChanged( | 94 virtual void OnSpeechRecognitionStateChanged( |
| 102 app_list::SpeechRecognitionState new_state) OVERRIDE; | 95 app_list::SpeechRecognitionState new_state) OVERRIDE; |
| 103 | 96 |
| 104 // Overridden from HotwordClient: | 97 // Overridden from HotwordClient: |
| 105 virtual void OnHotwordStateChanged(bool started) OVERRIDE; | 98 virtual void OnHotwordStateChanged(bool started) OVERRIDE; |
| 106 virtual void OnHotwordRecognized() OVERRIDE; | 99 virtual void OnHotwordRecognized() OVERRIDE; |
| 107 | 100 |
| 108 // Overridden from SigninManagerFactory::Observer: | |
| 109 virtual void SigninManagerCreated(SigninManagerBase* manager) OVERRIDE; | |
| 110 virtual void SigninManagerShutdown(SigninManagerBase* manager) OVERRIDE; | |
| 111 | |
| 112 // Overridden from SigninManagerBase::Observer: | |
| 113 virtual void GoogleSigninFailed(const GoogleServiceAuthError& error) OVERRIDE; | |
| 114 virtual void GoogleSigninSucceeded(const std::string& username, | |
| 115 const std::string& password) OVERRIDE; | |
| 116 virtual void GoogleSignedOut(const std::string& username) OVERRIDE; | |
| 117 | |
| 118 // Overridden from ProfileInfoCacheObserver: | 101 // Overridden from ProfileInfoCacheObserver: |
| 119 virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE; | 102 virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE; |
| 120 virtual void OnProfileWasRemoved(const base::FilePath& profile_path, | 103 virtual void OnProfileWasRemoved(const base::FilePath& profile_path, |
| 121 const base::string16& profile_name) OVERRIDE; | 104 const base::string16& profile_name) OVERRIDE; |
| 122 virtual void OnProfileNameChanged( | 105 virtual void OnProfileNameChanged( |
| 123 const base::FilePath& profile_path, | 106 const base::FilePath& profile_path, |
| 124 const base::string16& old_profile_name) OVERRIDE; | 107 const base::string16& old_profile_name) OVERRIDE; |
| 125 | 108 |
| 126 scoped_ptr<app_list::SearchController> search_controller_; | 109 scoped_ptr<app_list::SearchController> search_controller_; |
| 127 // Unowned pointer to the controller. | 110 // Unowned pointer to the controller. |
| 128 AppListControllerDelegate* controller_; | 111 AppListControllerDelegate* controller_; |
| 129 // Unowned pointer to the associated profile. May change if SetProfileByPath | 112 // Unowned pointer to the associated profile. May change if SetProfileByPath |
| 130 // is called. | 113 // is called. |
| 131 Profile* profile_; | 114 Profile* profile_; |
| 132 // Unowned pointer to the model owned by AppListSyncableService. Will change | 115 // Unowned pointer to the model owned by AppListSyncableService. Will change |
| 133 // if |profile_| changes. | 116 // if |profile_| changes. |
| 134 app_list::AppListModel* model_; | 117 app_list::AppListModel* model_; |
| 135 | 118 |
| 136 scoped_ptr<app_list::SpeechUIModel> speech_ui_; | 119 scoped_ptr<app_list::SpeechUIModel> speech_ui_; |
| 137 | 120 |
| 138 base::TimeDelta auto_launch_timeout_; | 121 base::TimeDelta auto_launch_timeout_; |
| 139 | 122 |
| 140 Users users_; | 123 Users users_; |
| 141 | 124 |
| 142 ChromeSigninDelegate signin_delegate_; | |
| 143 #if defined(USE_ASH) | 125 #if defined(USE_ASH) |
| 144 scoped_ptr<AppSyncUIStateWatcher> app_sync_ui_state_watcher_; | 126 scoped_ptr<AppSyncUIStateWatcher> app_sync_ui_state_watcher_; |
| 145 #endif | 127 #endif |
| 146 | 128 |
| 147 ObserverList<app_list::AppListViewDelegateObserver> observers_; | 129 ObserverList<app_list::AppListViewDelegateObserver> observers_; |
| 148 | 130 |
| 149 // Used to track the SigninManagers that this instance is observing so that | |
| 150 // this instance can be removed as an observer on its destruction. | |
| 151 ScopedObserver<SigninManagerBase, AppListViewDelegate> scoped_observer_; | |
| 152 | |
| 153 DISALLOW_COPY_AND_ASSIGN(AppListViewDelegate); | 131 DISALLOW_COPY_AND_ASSIGN(AppListViewDelegate); |
| 154 }; | 132 }; |
| 155 | 133 |
| 156 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ | 134 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ |
| OLD | NEW |