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_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "ash/launcher/launcher_delegate.h" | 12 #include "ash/launcher/launcher_delegate.h" |
13 #include "ash/launcher/launcher_model_observer.h" | 13 #include "ash/launcher/launcher_model_observer.h" |
14 #include "ash/launcher/launcher_types.h" | 14 #include "ash/launcher/launcher_types.h" |
15 #include "ash/shell_observer.h" | 15 #include "ash/shell_observer.h" |
16 #include "ash/wm/shelf_types.h" | 16 #include "ash/wm/shelf_types.h" |
17 #include "base/basictypes.h" | 17 #include "base/basictypes.h" |
18 #include "base/compiler_specific.h" | 18 #include "base/compiler_specific.h" |
19 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
20 #include "base/prefs/public/pref_change_registrar.h" | 20 #include "base/prefs/public/pref_change_registrar.h" |
21 #include "base/timer.h" | 21 #include "base/timer.h" |
22 #include "chrome/browser/api/sync/profile_sync_service_observer.h" | 22 #include "chrome/browser/api/sync/profile_sync_service_observer.h" |
| 23 #include "chrome/browser/prefs/pref_service_observer.h" |
23 #include "chrome/browser/extensions/extension_prefs.h" | 24 #include "chrome/browser/extensions/extension_prefs.h" |
24 #include "content/public/browser/notification_observer.h" | 25 #include "content/public/browser/notification_observer.h" |
25 #include "content/public/browser/notification_registrar.h" | 26 #include "content/public/browser/notification_registrar.h" |
26 #include "ui/aura/window_observer.h" | 27 #include "ui/aura/window_observer.h" |
27 | 28 |
28 namespace ash { | 29 namespace ash { |
29 class LauncherModel; | 30 class LauncherModel; |
30 } | 31 } |
31 | 32 |
32 namespace aura { | 33 namespace aura { |
(...skipping 14 matching lines...) Expand all Loading... |
47 // * Tabbed browsers and browser app windows have BrowserLauncherItemController, | 48 // * Tabbed browsers and browser app windows have BrowserLauncherItemController, |
48 // owned by the BrowserView instance. | 49 // owned by the BrowserView instance. |
49 // * App shell windows have ShellWindowLauncherItemController, owned by | 50 // * App shell windows have ShellWindowLauncherItemController, owned by |
50 // ShellWindowLauncherController. | 51 // ShellWindowLauncherController. |
51 // * Shortcuts have no LauncherItemController. | 52 // * Shortcuts have no LauncherItemController. |
52 class ChromeLauncherController | 53 class ChromeLauncherController |
53 : public ash::LauncherDelegate, | 54 : public ash::LauncherDelegate, |
54 public ash::LauncherModelObserver, | 55 public ash::LauncherModelObserver, |
55 public ash::ShellObserver, | 56 public ash::ShellObserver, |
56 public content::NotificationObserver, | 57 public content::NotificationObserver, |
57 public ProfileSyncServiceObserver { | 58 public ProfileSyncServiceObserver, |
| 59 public PrefServiceObserver { |
58 public: | 60 public: |
59 // Indicates if a launcher item is incognito or not. | 61 // Indicates if a launcher item is incognito or not. |
60 enum IncognitoState { | 62 enum IncognitoState { |
61 STATE_INCOGNITO, | 63 STATE_INCOGNITO, |
62 STATE_NOT_INCOGNITO, | 64 STATE_NOT_INCOGNITO, |
63 }; | 65 }; |
64 | 66 |
65 // Used to update the state of non plaform apps, as tab contents change. | 67 // Used to update the state of non plaform apps, as tab contents change. |
66 enum AppState { | 68 enum AppState { |
67 APP_STATE_ACTIVE, | 69 APP_STATE_ACTIVE, |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 virtual void Observe(int type, | 262 virtual void Observe(int type, |
261 const content::NotificationSource& source, | 263 const content::NotificationSource& source, |
262 const content::NotificationDetails& details) OVERRIDE; | 264 const content::NotificationDetails& details) OVERRIDE; |
263 | 265 |
264 // Overridden from ash::ShellObserver: | 266 // Overridden from ash::ShellObserver: |
265 virtual void OnShelfAlignmentChanged() OVERRIDE; | 267 virtual void OnShelfAlignmentChanged() OVERRIDE; |
266 | 268 |
267 // Overridden from ProfileSyncServiceObserver: | 269 // Overridden from ProfileSyncServiceObserver: |
268 virtual void OnStateChanged() OVERRIDE; | 270 virtual void OnStateChanged() OVERRIDE; |
269 | 271 |
| 272 // Overriden from PrefServiceObserver: |
| 273 virtual void OnHasSyncedChanged() OVERRIDE; |
| 274 |
270 private: | 275 private: |
271 friend class BrowserLauncherItemControllerTest; | 276 friend class BrowserLauncherItemControllerTest; |
272 friend class ChromeLauncherControllerTest; | 277 friend class ChromeLauncherControllerTest; |
273 friend class LauncherAppBrowserTest; | 278 friend class LauncherAppBrowserTest; |
274 friend class LauncherPlatformAppBrowserTest; | 279 friend class LauncherPlatformAppBrowserTest; |
275 | 280 |
276 typedef std::map<ash::LauncherID, LauncherItemController*> | 281 typedef std::map<ash::LauncherID, LauncherItemController*> |
277 IDToItemControllerMap; | 282 IDToItemControllerMap; |
278 typedef std::list<TabContents*> TabContentsList; | 283 typedef std::list<TabContents*> TabContentsList; |
279 typedef std::map<std::string, TabContentsList> AppIDToTabContentsListMap; | 284 typedef std::map<std::string, TabContentsList> AppIDToTabContentsListMap; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 | 365 |
361 PrefChangeRegistrar pref_change_registrar_; | 366 PrefChangeRegistrar pref_change_registrar_; |
362 | 367 |
363 ProfileSyncService* observed_sync_service_; | 368 ProfileSyncService* observed_sync_service_; |
364 base::OneShotTimer<ChromeLauncherController> loading_timer_; | 369 base::OneShotTimer<ChromeLauncherController> loading_timer_; |
365 | 370 |
366 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); | 371 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); |
367 }; | 372 }; |
368 | 373 |
369 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ | 374 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ |
OLD | NEW |