OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <set> | 10 #include <set> |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "base/memory/scoped_ptr.h" | 24 #include "base/memory/scoped_ptr.h" |
25 #include "base/memory/scoped_vector.h" | 25 #include "base/memory/scoped_vector.h" |
26 #include "base/prefs/pref_change_registrar.h" | 26 #include "base/prefs/pref_change_registrar.h" |
27 #include "chrome/browser/extensions/app_icon_loader.h" | 27 #include "chrome/browser/extensions/app_icon_loader.h" |
28 #include "chrome/browser/prefs/pref_service_syncable_observer.h" | 28 #include "chrome/browser/prefs/pref_service_syncable_observer.h" |
29 #include "chrome/browser/ui/ash/app_sync_ui_state_observer.h" | 29 #include "chrome/browser/ui/ash/app_sync_ui_state_observer.h" |
30 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h" | 30 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h" |
31 #include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h" | 31 #include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h" |
32 #include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h" | 32 #include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h" |
33 #include "chrome/common/extensions/extension_constants.h" | 33 #include "chrome/common/extensions/extension_constants.h" |
34 #include "content/public/browser/notification_observer.h" | 34 #include "extensions/browser/extension_registry_observer.h" |
35 #include "content/public/browser/notification_registrar.h" | |
36 #include "ui/aura/window_observer.h" | 35 #include "ui/aura/window_observer.h" |
37 | 36 |
38 class AppSyncUIState; | 37 class AppSyncUIState; |
39 class Browser; | 38 class Browser; |
40 class BrowserShortcutLauncherItemController; | 39 class BrowserShortcutLauncherItemController; |
41 class BrowserStatusMonitor; | 40 class BrowserStatusMonitor; |
42 class ExtensionEnableFlow; | 41 class ExtensionEnableFlow; |
43 class GURL; | 42 class GURL; |
44 class LauncherItemController; | 43 class LauncherItemController; |
45 class Profile; | 44 class Profile; |
46 class AppWindowLauncherController; | 45 class AppWindowLauncherController; |
47 class TabContents; | 46 class TabContents; |
48 | 47 |
49 namespace ash { | 48 namespace ash { |
50 class ShelfItemDelegateManager; | 49 class ShelfItemDelegateManager; |
51 class ShelfModel; | 50 class ShelfModel; |
52 } | 51 } |
53 | 52 |
54 namespace aura { | 53 namespace aura { |
55 class Window; | 54 class Window; |
56 } | 55 } |
57 | 56 |
58 namespace content { | 57 namespace content { |
| 58 class BrowserContext; |
59 class WebContents; | 59 class WebContents; |
60 } | 60 } |
61 | 61 |
62 namespace extensions { | 62 namespace extensions { |
63 class Extension; | 63 class Extension; |
64 } | 64 } |
65 | 65 |
66 namespace ui { | 66 namespace ui { |
67 class BaseWindow; | 67 class BaseWindow; |
68 } | 68 } |
(...skipping 17 matching lines...) Expand all Loading... |
86 // This incarnation groups running tabs/windows in application specific lists. | 86 // This incarnation groups running tabs/windows in application specific lists. |
87 // * Browser app windows have BrowserLauncherItemController, owned by the | 87 // * Browser app windows have BrowserLauncherItemController, owned by the |
88 // BrowserView instance. | 88 // BrowserView instance. |
89 // * App windows have AppWindowLauncherItemController, owned by | 89 // * App windows have AppWindowLauncherItemController, owned by |
90 // AppWindowLauncherController. | 90 // AppWindowLauncherController. |
91 // * Shortcuts have no LauncherItemController. | 91 // * Shortcuts have no LauncherItemController. |
92 class ChromeLauncherController : public ash::ShelfDelegate, | 92 class ChromeLauncherController : public ash::ShelfDelegate, |
93 public ash::ShelfModelObserver, | 93 public ash::ShelfModelObserver, |
94 public ash::ShellObserver, | 94 public ash::ShellObserver, |
95 public ash::DisplayController::Observer, | 95 public ash::DisplayController::Observer, |
96 public content::NotificationObserver, | 96 public extensions::ExtensionRegistryObserver, |
97 public extensions::AppIconLoader::Delegate, | 97 public extensions::AppIconLoader::Delegate, |
98 public PrefServiceSyncableObserver, | 98 public PrefServiceSyncableObserver, |
99 public AppSyncUIStateObserver, | 99 public AppSyncUIStateObserver, |
100 public ExtensionEnableFlowDelegate, | 100 public ExtensionEnableFlowDelegate, |
101 public ash::ShelfLayoutManagerObserver { | 101 public ash::ShelfLayoutManagerObserver { |
102 public: | 102 public: |
103 // Indicates if a shelf item is incognito or not. | 103 // Indicates if a shelf item is incognito or not. |
104 enum IncognitoState { | 104 enum IncognitoState { |
105 STATE_INCOGNITO, | 105 STATE_INCOGNITO, |
106 STATE_NOT_INCOGNITO, | 106 STATE_NOT_INCOGNITO, |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 virtual void UnpinAppWithID(const std::string& app_id) OVERRIDE; | 301 virtual void UnpinAppWithID(const std::string& app_id) OVERRIDE; |
302 | 302 |
303 // ash::ShelfModelObserver overrides: | 303 // ash::ShelfModelObserver overrides: |
304 virtual void ShelfItemAdded(int index) OVERRIDE; | 304 virtual void ShelfItemAdded(int index) OVERRIDE; |
305 virtual void ShelfItemRemoved(int index, ash::ShelfID id) OVERRIDE; | 305 virtual void ShelfItemRemoved(int index, ash::ShelfID id) OVERRIDE; |
306 virtual void ShelfItemMoved(int start_index, int target_index) OVERRIDE; | 306 virtual void ShelfItemMoved(int start_index, int target_index) OVERRIDE; |
307 virtual void ShelfItemChanged(int index, | 307 virtual void ShelfItemChanged(int index, |
308 const ash::ShelfItem& old_item) OVERRIDE; | 308 const ash::ShelfItem& old_item) OVERRIDE; |
309 virtual void ShelfStatusChanged() OVERRIDE; | 309 virtual void ShelfStatusChanged() OVERRIDE; |
310 | 310 |
311 // content::NotificationObserver overrides: | |
312 virtual void Observe(int type, | |
313 const content::NotificationSource& source, | |
314 const content::NotificationDetails& details) OVERRIDE; | |
315 | |
316 // ash::ShellObserver overrides: | 311 // ash::ShellObserver overrides: |
317 virtual void OnShelfAlignmentChanged(aura::Window* root_window) OVERRIDE; | 312 virtual void OnShelfAlignmentChanged(aura::Window* root_window) OVERRIDE; |
318 | 313 |
319 // ash::DisplayController::Observer overrides: | 314 // ash::DisplayController::Observer overrides: |
320 virtual void OnDisplayConfigurationChanged() OVERRIDE; | 315 virtual void OnDisplayConfigurationChanged() OVERRIDE; |
321 | 316 |
| 317 // ExtensionRegistryObserver overrides: |
| 318 virtual void OnExtensionLoaded( |
| 319 content::BrowserContext* browser_context, |
| 320 const extensions::Extension* extension) OVERRIDE; |
| 321 virtual void OnExtensionUnloaded( |
| 322 content::BrowserContext* browser_context, |
| 323 const extensions::Extension* extension, |
| 324 extensions::UnloadedExtensionInfo::Reason reason) OVERRIDE; |
| 325 |
322 // PrefServiceSyncableObserver overrides: | 326 // PrefServiceSyncableObserver overrides: |
323 virtual void OnIsSyncingChanged() OVERRIDE; | 327 virtual void OnIsSyncingChanged() OVERRIDE; |
324 | 328 |
325 // AppSyncUIStateObserver overrides: | 329 // AppSyncUIStateObserver overrides: |
326 virtual void OnAppSyncUIStatusChanged() OVERRIDE; | 330 virtual void OnAppSyncUIStatusChanged() OVERRIDE; |
327 | 331 |
328 // ExtensionEnableFlowDelegate overrides: | 332 // ExtensionEnableFlowDelegate overrides: |
329 virtual void ExtensionEnableFlowFinished() OVERRIDE; | 333 virtual void ExtensionEnableFlowFinished() OVERRIDE; |
330 virtual void ExtensionEnableFlowAborted(bool user_initiated) OVERRIDE; | 334 virtual void ExtensionEnableFlowAborted(bool user_initiated) OVERRIDE; |
331 | 335 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 | 530 |
527 // Get the browser shortcut's index in the shelf using the current's systems | 531 // Get the browser shortcut's index in the shelf using the current's systems |
528 // configuration of pinned and known (but not running) apps. | 532 // configuration of pinned and known (but not running) apps. |
529 int GetChromeIconIndexForCreation(); | 533 int GetChromeIconIndexForCreation(); |
530 | 534 |
531 // Get the list of pinned programs from the preferences. | 535 // Get the list of pinned programs from the preferences. |
532 std::vector<std::string> GetListOfPinnedAppsAndBrowser(); | 536 std::vector<std::string> GetListOfPinnedAppsAndBrowser(); |
533 | 537 |
534 // Close all windowed V1 applications of a certain extension which was already | 538 // Close all windowed V1 applications of a certain extension which was already |
535 // deleted. | 539 // deleted. |
536 void CloseWindowedAppsFromRemovedExtension(const std::string& app_id); | 540 void CloseWindowedAppsFromRemovedExtension(const std::string& app_id, |
| 541 const Profile* profile); |
537 | 542 |
538 // Set ShelfItemDelegate |item_delegate| for |id| and take an ownership. | 543 // Set ShelfItemDelegate |item_delegate| for |id| and take an ownership. |
539 // TODO(simon.hong81): Make this take a scoped_ptr of |item_delegate|. | 544 // TODO(simon.hong81): Make this take a scoped_ptr of |item_delegate|. |
540 void SetShelfItemDelegate(ash::ShelfID id, | 545 void SetShelfItemDelegate(ash::ShelfID id, |
541 ash::ShelfItemDelegate* item_delegate); | 546 ash::ShelfItemDelegate* item_delegate); |
542 | 547 |
543 // Attach to a specific profile. | 548 // Attach to a specific profile. |
544 void AttachProfile(Profile* proifile); | 549 void AttachProfile(Profile* proifile); |
545 | 550 |
546 // Forget the current profile to allow attaching to a new one. | 551 // Forget the current profile to allow attaching to a new one. |
(...skipping 21 matching lines...) Expand all Loading... |
568 | 573 |
569 // Used to track app windows. | 574 // Used to track app windows. |
570 scoped_ptr<AppWindowLauncherController> app_window_controller_; | 575 scoped_ptr<AppWindowLauncherController> app_window_controller_; |
571 | 576 |
572 // Used to get app info for tabs. | 577 // Used to get app info for tabs. |
573 scoped_ptr<AppTabHelper> app_tab_helper_; | 578 scoped_ptr<AppTabHelper> app_tab_helper_; |
574 | 579 |
575 // Used to load the image for an app item. | 580 // Used to load the image for an app item. |
576 scoped_ptr<extensions::AppIconLoader> app_icon_loader_; | 581 scoped_ptr<extensions::AppIconLoader> app_icon_loader_; |
577 | 582 |
578 content::NotificationRegistrar notification_registrar_; | |
579 | |
580 PrefChangeRegistrar pref_change_registrar_; | 583 PrefChangeRegistrar pref_change_registrar_; |
581 | 584 |
582 AppSyncUIState* app_sync_ui_state_; | 585 AppSyncUIState* app_sync_ui_state_; |
583 | 586 |
584 scoped_ptr<ExtensionEnableFlow> extension_enable_flow_; | 587 scoped_ptr<ExtensionEnableFlow> extension_enable_flow_; |
585 | 588 |
586 // Shelves that are currently being observed. | 589 // Shelves that are currently being observed. |
587 std::set<ash::Shelf*> shelves_; | 590 std::set<ash::Shelf*> shelves_; |
588 | 591 |
589 // The owned browser status monitor. | 592 // The owned browser status monitor. |
(...skipping 11 matching lines...) Expand all Loading... |
601 // The list of running & un-pinned applications for different users on hidden | 604 // The list of running & un-pinned applications for different users on hidden |
602 // desktops. | 605 // desktops. |
603 typedef std::vector<std::string> RunningAppListIds; | 606 typedef std::vector<std::string> RunningAppListIds; |
604 typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap; | 607 typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap; |
605 RunningAppListIdMap last_used_running_application_order_; | 608 RunningAppListIdMap last_used_running_application_order_; |
606 | 609 |
607 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); | 610 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); |
608 }; | 611 }; |
609 | 612 |
610 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ | 613 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ |
OLD | NEW |