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/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
16 #include "base/scoped_observer.h" | 16 #include "base/scoped_observer.h" |
17 #include "chrome/browser/profiles/profile_info_cache_observer.h" | 17 #include "chrome/browser/profiles/profile_info_cache_observer.h" |
18 #include "chrome/browser/search/hotword_client.h" | 18 #include "chrome/browser/search/hotword_client.h" |
19 #include "chrome/browser/signin/signin_manager_factory.h" | 19 #include "chrome/browser/signin/signin_manager_factory.h" |
20 #include "chrome/browser/ui/app_list/start_page_observer.h" | 20 #include "chrome/browser/ui/app_list/start_page_observer.h" |
21 #include "components/signin/core/browser/signin_manager_base.h" | 21 #include "components/signin/core/browser/signin_manager_base.h" |
| 22 #include "content/public/browser/notification_observer.h" |
| 23 #include "content/public/browser/notification_registrar.h" |
22 #include "ui/app_list/app_list_view_delegate.h" | 24 #include "ui/app_list/app_list_view_delegate.h" |
23 | 25 |
24 class AppListControllerDelegate; | 26 class AppListControllerDelegate; |
25 class Profile; | 27 class Profile; |
26 | 28 |
27 namespace apps { | 29 namespace apps { |
28 class CustomLauncherPageContents; | 30 class CustomLauncherPageContents; |
29 } | 31 } |
30 | 32 |
31 namespace app_list { | 33 namespace app_list { |
(...skipping 11 matching lines...) Expand all Loading... |
43 | 45 |
44 #if defined(USE_ASH) | 46 #if defined(USE_ASH) |
45 class AppSyncUIStateWatcher; | 47 class AppSyncUIStateWatcher; |
46 #endif | 48 #endif |
47 | 49 |
48 class AppListViewDelegate : public app_list::AppListViewDelegate, | 50 class AppListViewDelegate : public app_list::AppListViewDelegate, |
49 public app_list::StartPageObserver, | 51 public app_list::StartPageObserver, |
50 public HotwordClient, | 52 public HotwordClient, |
51 public ProfileInfoCacheObserver, | 53 public ProfileInfoCacheObserver, |
52 public SigninManagerBase::Observer, | 54 public SigninManagerBase::Observer, |
53 public SigninManagerFactory::Observer { | 55 public SigninManagerFactory::Observer, |
| 56 public content::NotificationObserver { |
54 public: | 57 public: |
55 // Constructs Chrome's AppListViewDelegate, initially for |profile|. | 58 // Constructs Chrome's AppListViewDelegate, initially for |profile|. |
56 // Does not take ownership of |controller|. TODO(tapted): It should. | 59 // Does not take ownership of |controller|. TODO(tapted): It should. |
57 AppListViewDelegate(Profile* profile, | 60 AppListViewDelegate(Profile* profile, |
58 AppListControllerDelegate* controller); | 61 AppListControllerDelegate* controller); |
59 virtual ~AppListViewDelegate(); | 62 virtual ~AppListViewDelegate(); |
60 | 63 |
61 private: | 64 private: |
62 // Configure the AppList for the given |profile|. | 65 // Configure the AppList for the given |profile|. |
63 void SetProfile(Profile* profile); | 66 void SetProfile(Profile* profile); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 const std::string& username) OVERRIDE; | 139 const std::string& username) OVERRIDE; |
137 | 140 |
138 // Overridden from ProfileInfoCacheObserver: | 141 // Overridden from ProfileInfoCacheObserver: |
139 virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE; | 142 virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE; |
140 virtual void OnProfileWasRemoved(const base::FilePath& profile_path, | 143 virtual void OnProfileWasRemoved(const base::FilePath& profile_path, |
141 const base::string16& profile_name) OVERRIDE; | 144 const base::string16& profile_name) OVERRIDE; |
142 virtual void OnProfileNameChanged( | 145 virtual void OnProfileNameChanged( |
143 const base::FilePath& profile_path, | 146 const base::FilePath& profile_path, |
144 const base::string16& old_profile_name) OVERRIDE; | 147 const base::string16& old_profile_name) OVERRIDE; |
145 | 148 |
| 149 // Overridden from content::NotificationObserver: |
| 150 virtual void Observe(int type, |
| 151 const content::NotificationSource& source, |
| 152 const content::NotificationDetails& details) OVERRIDE; |
| 153 |
146 // Unowned pointer to the controller. | 154 // Unowned pointer to the controller. |
147 AppListControllerDelegate* controller_; | 155 AppListControllerDelegate* controller_; |
148 // Unowned pointer to the associated profile. May change if SetProfileByPath | 156 // Unowned pointer to the associated profile. May change if SetProfileByPath |
149 // is called. | 157 // is called. |
150 Profile* profile_; | 158 Profile* profile_; |
151 // Unowned pointer to the model owned by AppListSyncableService. Will change | 159 // Unowned pointer to the model owned by AppListSyncableService. Will change |
152 // if |profile_| changes. | 160 // if |profile_| changes. |
153 app_list::AppListModel* model_; | 161 app_list::AppListModel* model_; |
154 | 162 |
155 // Note: order ensures |search_controller_| is destroyed before |speech_ui_|. | 163 // Note: order ensures |search_controller_| is destroyed before |speech_ui_|. |
(...skipping 10 matching lines...) Expand all Loading... |
166 | 174 |
167 ObserverList<app_list::AppListViewDelegateObserver> observers_; | 175 ObserverList<app_list::AppListViewDelegateObserver> observers_; |
168 | 176 |
169 // Used to track the SigninManagers that this instance is observing so that | 177 // Used to track the SigninManagers that this instance is observing so that |
170 // this instance can be removed as an observer on its destruction. | 178 // this instance can be removed as an observer on its destruction. |
171 ScopedObserver<SigninManagerBase, AppListViewDelegate> scoped_observer_; | 179 ScopedObserver<SigninManagerBase, AppListViewDelegate> scoped_observer_; |
172 | 180 |
173 // Window contents of additional custom launcher pages. | 181 // Window contents of additional custom launcher pages. |
174 ScopedVector<apps::CustomLauncherPageContents> custom_page_contents_; | 182 ScopedVector<apps::CustomLauncherPageContents> custom_page_contents_; |
175 | 183 |
| 184 // Registers for NOTIFICATION_APP_TERMINATING to unload custom launcher pages. |
| 185 content::NotificationRegistrar registrar_; |
| 186 |
176 DISALLOW_COPY_AND_ASSIGN(AppListViewDelegate); | 187 DISALLOW_COPY_AND_ASSIGN(AppListViewDelegate); |
177 }; | 188 }; |
178 | 189 |
179 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ | 190 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_VIEW_DELEGATE_H_ |
OLD | NEW |