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/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
17 #include "base/scoped_observer.h" | 17 #include "base/scoped_observer.h" |
18 #include "chrome/browser/profiles/profile_info_cache_observer.h" | 18 #include "chrome/browser/profiles/profile_info_cache_observer.h" |
19 #include "chrome/browser/search/hotword_client.h" | 19 #include "chrome/browser/search/hotword_client.h" |
20 #include "chrome/browser/signin/signin_manager_factory.h" | 20 #include "chrome/browser/signin/signin_manager_factory.h" |
21 #include "chrome/browser/ui/app_list/start_page_observer.h" | 21 #include "chrome/browser/ui/app_list/start_page_observer.h" |
| 22 #include "components/search_engines/template_url_service.h" |
| 23 #include "components/search_engines/template_url_service_observer.h" |
22 #include "components/signin/core/browser/signin_manager_base.h" | 24 #include "components/signin/core/browser/signin_manager_base.h" |
23 #include "content/public/browser/notification_observer.h" | 25 #include "content/public/browser/notification_observer.h" |
24 #include "content/public/browser/notification_registrar.h" | 26 #include "content/public/browser/notification_registrar.h" |
25 #include "ui/app_list/app_list_view_delegate.h" | 27 #include "ui/app_list/app_list_view_delegate.h" |
26 | 28 |
27 class AppListControllerDelegate; | 29 class AppListControllerDelegate; |
28 class Profile; | 30 class Profile; |
29 | 31 |
30 namespace apps { | 32 namespace apps { |
31 class CustomLauncherPageContents; | 33 class CustomLauncherPageContents; |
(...skipping 21 matching lines...) Expand all Loading... |
53 #if defined(USE_ASH) | 55 #if defined(USE_ASH) |
54 class AppSyncUIStateWatcher; | 56 class AppSyncUIStateWatcher; |
55 #endif | 57 #endif |
56 | 58 |
57 class AppListViewDelegate : public app_list::AppListViewDelegate, | 59 class AppListViewDelegate : public app_list::AppListViewDelegate, |
58 public app_list::StartPageObserver, | 60 public app_list::StartPageObserver, |
59 public HotwordClient, | 61 public HotwordClient, |
60 public ProfileInfoCacheObserver, | 62 public ProfileInfoCacheObserver, |
61 public SigninManagerBase::Observer, | 63 public SigninManagerBase::Observer, |
62 public SigninManagerFactory::Observer, | 64 public SigninManagerFactory::Observer, |
63 public content::NotificationObserver { | 65 public content::NotificationObserver, |
| 66 public TemplateURLServiceObserver { |
64 public: | 67 public: |
65 // Constructs Chrome's AppListViewDelegate with a NULL Profile. | 68 // Constructs Chrome's AppListViewDelegate with a NULL Profile. |
66 // Does not take ownership of |controller|. TODO(tapted): It should. | 69 // Does not take ownership of |controller|. TODO(tapted): It should. |
67 explicit AppListViewDelegate(AppListControllerDelegate* controller); | 70 explicit AppListViewDelegate(AppListControllerDelegate* controller); |
68 ~AppListViewDelegate() override; | 71 ~AppListViewDelegate() override; |
69 | 72 |
70 // Configure the AppList for the given |profile|. | 73 // Configure the AppList for the given |profile|. |
71 void SetProfile(Profile* profile); | 74 void SetProfile(Profile* profile); |
72 Profile* profile() { return profile_; } | 75 Profile* profile() { return profile_; } |
73 | 76 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 const gfx::Size& size) override; | 112 const gfx::Size& size) override; |
110 void CustomLauncherPageAnimationChanged(double progress) override; | 113 void CustomLauncherPageAnimationChanged(double progress) override; |
111 void CustomLauncherPagePopSubpage() override; | 114 void CustomLauncherPagePopSubpage() override; |
112 #endif | 115 #endif |
113 bool IsSpeechRecognitionEnabled() override; | 116 bool IsSpeechRecognitionEnabled() override; |
114 const Users& GetUsers() const override; | 117 const Users& GetUsers() const override; |
115 bool ShouldCenterWindow() const override; | 118 bool ShouldCenterWindow() const override; |
116 void AddObserver(app_list::AppListViewDelegateObserver* observer) override; | 119 void AddObserver(app_list::AppListViewDelegateObserver* observer) override; |
117 void RemoveObserver(app_list::AppListViewDelegateObserver* observer) override; | 120 void RemoveObserver(app_list::AppListViewDelegateObserver* observer) override; |
118 | 121 |
| 122 // Overridden from TemplateURLServiceObserver: |
| 123 void OnTemplateURLServiceChanged() override; |
| 124 |
119 private: | 125 private: |
120 // Updates the speech webview and start page for the current |profile_|. | 126 // Updates the speech webview and start page for the current |profile_|. |
121 void SetUpSearchUI(); | 127 void SetUpSearchUI(); |
122 | 128 |
123 // Updates the app list's ProfileMenuItems for the current |profile_|. | 129 // Updates the app list's ProfileMenuItems for the current |profile_|. |
124 void SetUpProfileSwitcher(); | 130 void SetUpProfileSwitcher(); |
125 | 131 |
126 // Updates the app list's custom launcher pages for the current |profile_|. | 132 // Updates the app list's custom launcher pages for the current |profile_|. |
127 void SetUpCustomLauncherPages(); | 133 void SetUpCustomLauncherPages(); |
128 | 134 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 bool is_voice_query_; | 191 bool is_voice_query_; |
186 | 192 |
187 Users users_; | 193 Users users_; |
188 | 194 |
189 #if defined(USE_ASH) | 195 #if defined(USE_ASH) |
190 scoped_ptr<AppSyncUIStateWatcher> app_sync_ui_state_watcher_; | 196 scoped_ptr<AppSyncUIStateWatcher> app_sync_ui_state_watcher_; |
191 #endif | 197 #endif |
192 | 198 |
193 ObserverList<app_list::AppListViewDelegateObserver> observers_; | 199 ObserverList<app_list::AppListViewDelegateObserver> observers_; |
194 | 200 |
| 201 ScopedObserver<TemplateURLService, AppListViewDelegate> |
| 202 template_url_service_observer_; |
| 203 |
195 // Used to track the SigninManagers that this instance is observing so that | 204 // Used to track the SigninManagers that this instance is observing so that |
196 // this instance can be removed as an observer on its destruction. | 205 // this instance can be removed as an observer on its destruction. |
197 ScopedObserver<SigninManagerBase, AppListViewDelegate> scoped_observer_; | 206 ScopedObserver<SigninManagerBase, AppListViewDelegate> scoped_observer_; |
198 | 207 |
199 // Window contents of additional custom launcher pages. | 208 // Window contents of additional custom launcher pages. |
200 ScopedVector<apps::CustomLauncherPageContents> custom_page_contents_; | 209 ScopedVector<apps::CustomLauncherPageContents> custom_page_contents_; |
201 | 210 |
202 // Registers for NOTIFICATION_APP_TERMINATING to unload custom launcher pages. | 211 // Registers for NOTIFICATION_APP_TERMINATING to unload custom launcher pages. |
203 content::NotificationRegistrar registrar_; | 212 content::NotificationRegistrar registrar_; |
204 | 213 |
205 DISALLOW_COPY_AND_ASSIGN(AppListViewDelegate); | 214 DISALLOW_COPY_AND_ASSIGN(AppListViewDelegate); |
206 }; | 215 }; |
207 | 216 |
208 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ | 217 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ |
OLD | NEW |