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" |
15 #include "chrome/browser/profiles/profile_info_cache_observer.h" | 16 #include "chrome/browser/profiles/profile_info_cache_observer.h" |
16 #include "chrome/browser/search/hotword_client.h" | 17 #include "chrome/browser/search/hotword_client.h" |
| 18 #include "chrome/browser/signin/signin_manager_factory.h" |
17 #include "chrome/browser/ui/app_list/start_page_observer.h" | 19 #include "chrome/browser/ui/app_list/start_page_observer.h" |
| 20 #include "components/signin/core/browser/signin_manager_base.h" |
18 #include "ui/app_list/app_list_view_delegate.h" | 21 #include "ui/app_list/app_list_view_delegate.h" |
19 | 22 |
20 class AppListControllerDelegate; | 23 class AppListControllerDelegate; |
21 class Profile; | 24 class Profile; |
22 | 25 |
23 namespace app_list { | 26 namespace app_list { |
24 class SearchController; | 27 class SearchController; |
25 class SpeechUIModel; | 28 class SpeechUIModel; |
26 } | 29 } |
27 | 30 |
28 namespace base { | 31 namespace base { |
29 class FilePath; | 32 class FilePath; |
30 } | 33 } |
31 | 34 |
32 namespace gfx { | 35 namespace gfx { |
33 class ImageSkia; | 36 class ImageSkia; |
34 } | 37 } |
35 | 38 |
36 #if defined(USE_ASH) | 39 #if defined(USE_ASH) |
37 class AppSyncUIStateWatcher; | 40 class AppSyncUIStateWatcher; |
38 #endif | 41 #endif |
39 | 42 |
40 class AppListViewDelegate : public app_list::AppListViewDelegate, | 43 class AppListViewDelegate : public app_list::AppListViewDelegate, |
41 public app_list::StartPageObserver, | 44 public app_list::StartPageObserver, |
42 public HotwordClient, | 45 public HotwordClient, |
43 public ProfileInfoCacheObserver { | 46 public ProfileInfoCacheObserver, |
| 47 public SigninManagerBase::Observer, |
| 48 public SigninManagerFactory::Observer { |
44 public: | 49 public: |
45 AppListViewDelegate(Profile* profile, | 50 AppListViewDelegate(Profile* profile, |
46 AppListControllerDelegate* controller); | 51 AppListControllerDelegate* controller); |
47 virtual ~AppListViewDelegate(); | 52 virtual ~AppListViewDelegate(); |
48 | 53 |
49 private: | 54 private: |
50 // Updates the app list's current profile and ProfileMenuItems. | 55 // Updates the app list's current profile and ProfileMenuItems. |
51 void OnProfileChanged(); | 56 void OnProfileChanged(); |
52 | 57 |
53 // Overridden from app_list::AppListViewDelegate: | 58 // Overridden from app_list::AppListViewDelegate: |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 virtual void OnSpeechResult(const base::string16& result, | 98 virtual void OnSpeechResult(const base::string16& result, |
94 bool is_final) OVERRIDE; | 99 bool is_final) OVERRIDE; |
95 virtual void OnSpeechSoundLevelChanged(int16 level) OVERRIDE; | 100 virtual void OnSpeechSoundLevelChanged(int16 level) OVERRIDE; |
96 virtual void OnSpeechRecognitionStateChanged( | 101 virtual void OnSpeechRecognitionStateChanged( |
97 app_list::SpeechRecognitionState new_state) OVERRIDE; | 102 app_list::SpeechRecognitionState new_state) OVERRIDE; |
98 | 103 |
99 // Overridden from HotwordClient: | 104 // Overridden from HotwordClient: |
100 virtual void OnHotwordStateChanged(bool started) OVERRIDE; | 105 virtual void OnHotwordStateChanged(bool started) OVERRIDE; |
101 virtual void OnHotwordRecognized() OVERRIDE; | 106 virtual void OnHotwordRecognized() OVERRIDE; |
102 | 107 |
| 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 |
103 // Overridden from ProfileInfoCacheObserver: | 118 // Overridden from ProfileInfoCacheObserver: |
104 virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE; | 119 virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE; |
105 virtual void OnProfileWasRemoved(const base::FilePath& profile_path, | 120 virtual void OnProfileWasRemoved(const base::FilePath& profile_path, |
106 const base::string16& profile_name) OVERRIDE; | 121 const base::string16& profile_name) OVERRIDE; |
107 virtual void OnProfileNameChanged( | 122 virtual void OnProfileNameChanged( |
108 const base::FilePath& profile_path, | 123 const base::FilePath& profile_path, |
109 const base::string16& old_profile_name) OVERRIDE; | 124 const base::string16& old_profile_name) OVERRIDE; |
110 | 125 |
111 scoped_ptr<app_list::SearchController> search_controller_; | 126 scoped_ptr<app_list::SearchController> search_controller_; |
112 // Unowned pointer to the controller. | 127 // Unowned pointer to the controller. |
(...skipping 10 matching lines...) Expand all Loading... |
123 base::TimeDelta auto_launch_timeout_; | 138 base::TimeDelta auto_launch_timeout_; |
124 | 139 |
125 Users users_; | 140 Users users_; |
126 | 141 |
127 #if defined(USE_ASH) | 142 #if defined(USE_ASH) |
128 scoped_ptr<AppSyncUIStateWatcher> app_sync_ui_state_watcher_; | 143 scoped_ptr<AppSyncUIStateWatcher> app_sync_ui_state_watcher_; |
129 #endif | 144 #endif |
130 | 145 |
131 ObserverList<app_list::AppListViewDelegateObserver> observers_; | 146 ObserverList<app_list::AppListViewDelegateObserver> observers_; |
132 | 147 |
| 148 // Used to track the SigninManagers that this instance is observing so that |
| 149 // this instance can be removed as an observer on its destruction. |
| 150 ScopedObserver<SigninManagerBase, AppListViewDelegate> scoped_observer_; |
| 151 |
133 DISALLOW_COPY_AND_ASSIGN(AppListViewDelegate); | 152 DISALLOW_COPY_AND_ASSIGN(AppListViewDelegate); |
134 }; | 153 }; |
135 | 154 |
136 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ | 155 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ |
OLD | NEW |