| 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> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "ash/display/display_controller.h" | 14 #include "ash/display/display_controller.h" |
| 15 #include "ash/launcher/launcher_delegate.h" | 15 #include "ash/launcher/launcher_delegate.h" |
| 16 #include "ash/launcher/launcher_item_delegate.h" |
| 16 #include "ash/launcher/launcher_model_observer.h" | 17 #include "ash/launcher/launcher_model_observer.h" |
| 17 #include "ash/launcher/launcher_types.h" | 18 #include "ash/launcher/launcher_types.h" |
| 18 #include "ash/shelf/shelf_layout_manager_observer.h" | 19 #include "ash/shelf/shelf_layout_manager_observer.h" |
| 19 #include "ash/shelf/shelf_types.h" | 20 #include "ash/shelf/shelf_types.h" |
| 20 #include "ash/shell_observer.h" | 21 #include "ash/shell_observer.h" |
| 21 #include "base/basictypes.h" | 22 #include "base/basictypes.h" |
| 22 #include "base/compiler_specific.h" | 23 #include "base/compiler_specific.h" |
| 23 #include "base/memory/scoped_ptr.h" | 24 #include "base/memory/scoped_ptr.h" |
| 24 #include "base/memory/scoped_vector.h" | 25 #include "base/memory/scoped_vector.h" |
| 25 #include "base/prefs/pref_change_registrar.h" | 26 #include "base/prefs/pref_change_registrar.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 37 class Browser; | 38 class Browser; |
| 38 class BrowserShortcutLauncherItemController; | 39 class BrowserShortcutLauncherItemController; |
| 39 class ExtensionEnableFlow; | 40 class ExtensionEnableFlow; |
| 40 class GURL; | 41 class GURL; |
| 41 class LauncherItemController; | 42 class LauncherItemController; |
| 42 class Profile; | 43 class Profile; |
| 43 class ShellWindowLauncherController; | 44 class ShellWindowLauncherController; |
| 44 class TabContents; | 45 class TabContents; |
| 45 | 46 |
| 46 namespace ash { | 47 namespace ash { |
| 48 class LauncherItemDelegate; |
| 47 class LauncherModel; | 49 class LauncherModel; |
| 48 } | 50 } |
| 49 | 51 |
| 50 namespace aura { | 52 namespace aura { |
| 51 class Window; | 53 class Window; |
| 52 } | 54 } |
| 53 | 55 |
| 54 namespace content { | 56 namespace content { |
| 55 class NotificationRegistrar; | 57 class NotificationRegistrar; |
| 56 class WebContents; | 58 class WebContents; |
| 57 } | 59 } |
| 58 | 60 |
| 59 namespace ui { | 61 namespace ui { |
| 60 class BaseWindow; | 62 class BaseWindow; |
| 61 } | 63 } |
| 62 | 64 |
| 63 // A list of the elements which makes up a simple menu description. | 65 // A list of the elements which makes up a simple menu description. |
| 64 typedef ScopedVector<ChromeLauncherAppMenuItem> ChromeLauncherAppMenuItems; | 66 typedef ScopedVector<ChromeLauncherAppMenuItem> ChromeLauncherAppMenuItems; |
| 65 | 67 |
| 66 // ChromeLauncherController manages the launcher items needed for content | 68 // ChromeLauncherController manages the launcher items needed for content |
| 67 // windows. Launcher items have a type, an optional app id, and a controller. | 69 // windows. Launcher items have a type, an optional app id, and a controller. |
| 68 // This incarnation groups running tabs/windows in application specific lists. | 70 // This incarnation groups running tabs/windows in application specific lists. |
| 69 // * Browser app windows have BrowserLauncherItemController, owned by the | 71 // * Browser app windows have BrowserLauncherItemController, owned by the |
| 70 // BrowserView instance. | 72 // BrowserView instance. |
| 71 // * App shell windows have ShellWindowLauncherItemController, owned by | 73 // * App shell windows have ShellWindowLauncherItemController, owned by |
| 72 // ShellWindowLauncherController. | 74 // ShellWindowLauncherController. |
| 73 // * Shortcuts have no LauncherItemController. | 75 // * Shortcuts have no LauncherItemController. |
| 74 class ChromeLauncherController : public ash::LauncherDelegate, | 76 class ChromeLauncherController : public ash::LauncherDelegate, |
| 77 public ash::LauncherItemDelegate, |
| 75 public ash::LauncherModelObserver, | 78 public ash::LauncherModelObserver, |
| 76 public ash::ShellObserver, | 79 public ash::ShellObserver, |
| 77 public ash::DisplayController::Observer, | 80 public ash::DisplayController::Observer, |
| 78 public content::NotificationObserver, | 81 public content::NotificationObserver, |
| 79 public extensions::AppIconLoader::Delegate, | 82 public extensions::AppIconLoader::Delegate, |
| 80 public PrefServiceSyncableObserver, | 83 public PrefServiceSyncableObserver, |
| 81 public AppSyncUIStateObserver, | 84 public AppSyncUIStateObserver, |
| 82 public ExtensionEnableFlowDelegate, | 85 public ExtensionEnableFlowDelegate, |
| 83 public chrome::BrowserListObserver, | 86 public chrome::BrowserListObserver, |
| 84 public ash::ShelfLayoutManagerObserver { | 87 public ash::ShelfLayoutManagerObserver { |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 // Returns the extension identified by |app_id|. | 263 // Returns the extension identified by |app_id|. |
| 261 const extensions::Extension* GetExtensionForAppID( | 264 const extensions::Extension* GetExtensionForAppID( |
| 262 const std::string& app_id) const; | 265 const std::string& app_id) const; |
| 263 | 266 |
| 264 // Activates a |window|. If |allow_minimize| is true and the system allows | 267 // Activates a |window|. If |allow_minimize| is true and the system allows |
| 265 // it, the the window will get minimized instead. | 268 // it, the the window will get minimized instead. |
| 266 void ActivateWindowOrMinimizeIfActive(ui::BaseWindow* window, | 269 void ActivateWindowOrMinimizeIfActive(ui::BaseWindow* window, |
| 267 bool allow_minimize); | 270 bool allow_minimize); |
| 268 | 271 |
| 269 // ash::LauncherDelegate overrides: | 272 // ash::LauncherDelegate overrides: |
| 273 virtual ash::LauncherID GetIDByWindow(aura::Window* window) OVERRIDE; |
| 274 virtual void OnLauncherCreated(ash::Launcher* launcher) OVERRIDE; |
| 275 virtual void OnLauncherDestroyed(ash::Launcher* launcher) OVERRIDE; |
| 276 virtual ash::LauncherID GetLauncherIDForAppID( |
| 277 const std::string& app_id) OVERRIDE; |
| 278 virtual void PinAppWithID(const std::string& app_id) OVERRIDE; |
| 279 virtual bool IsAppPinned(const std::string& app_id) OVERRIDE; |
| 280 virtual void UnpinAppsWithID(const std::string& app_id) OVERRIDE; |
| 281 virtual ash::LauncherItemDelegate* GetLauncherItemDelegate( |
| 282 const ash::LauncherItem& item) OVERRIDE; |
| 283 |
| 284 // ash::LauncherItemDelegate overrides: |
| 270 virtual void ItemSelected(const ash::LauncherItem& item, | 285 virtual void ItemSelected(const ash::LauncherItem& item, |
| 271 const ui::Event& event) OVERRIDE; | 286 const ui::Event& event) OVERRIDE; |
| 272 virtual string16 GetTitle(const ash::LauncherItem& item) OVERRIDE; | 287 virtual string16 GetTitle(const ash::LauncherItem& item) OVERRIDE; |
| 273 virtual ui::MenuModel* CreateContextMenu( | 288 virtual ui::MenuModel* CreateContextMenu( |
| 274 const ash::LauncherItem& item, aura::RootWindow* root) OVERRIDE; | 289 const ash::LauncherItem& item, aura::RootWindow* root) OVERRIDE; |
| 275 virtual ash::LauncherMenuModel* CreateApplicationMenu( | 290 virtual ash::LauncherMenuModel* CreateApplicationMenu( |
| 276 const ash::LauncherItem& item, | 291 const ash::LauncherItem& item, |
| 277 int event_flags) OVERRIDE; | 292 int event_flags) OVERRIDE; |
| 278 virtual ash::LauncherID GetIDByWindow(aura::Window* window) OVERRIDE; | |
| 279 virtual bool IsDraggable(const ash::LauncherItem& item) OVERRIDE; | 293 virtual bool IsDraggable(const ash::LauncherItem& item) OVERRIDE; |
| 280 virtual bool ShouldShowTooltip(const ash::LauncherItem& item) OVERRIDE; | 294 virtual bool ShouldShowTooltip(const ash::LauncherItem& item) OVERRIDE; |
| 281 virtual void OnLauncherCreated(ash::Launcher* launcher) OVERRIDE; | |
| 282 virtual void OnLauncherDestroyed(ash::Launcher* launcher) OVERRIDE; | |
| 283 virtual ash::LauncherID GetLauncherIDForAppID( | |
| 284 const std::string& app_id) OVERRIDE; | |
| 285 virtual void PinAppWithID(const std::string& app_id) OVERRIDE; | |
| 286 virtual bool IsAppPinned(const std::string& app_id) OVERRIDE; | |
| 287 virtual void UnpinAppsWithID(const std::string& app_id) OVERRIDE; | |
| 288 | 295 |
| 289 // ash::LauncherModelObserver overrides: | 296 // ash::LauncherModelObserver overrides: |
| 290 virtual void LauncherItemAdded(int index) OVERRIDE; | 297 virtual void LauncherItemAdded(int index) OVERRIDE; |
| 291 virtual void LauncherItemRemoved(int index, ash::LauncherID id) OVERRIDE; | 298 virtual void LauncherItemRemoved(int index, ash::LauncherID id) OVERRIDE; |
| 292 virtual void LauncherItemMoved(int start_index, int target_index) OVERRIDE; | 299 virtual void LauncherItemMoved(int start_index, int target_index) OVERRIDE; |
| 293 virtual void LauncherItemChanged(int index, | 300 virtual void LauncherItemChanged(int index, |
| 294 const ash::LauncherItem& old_item) OVERRIDE; | 301 const ash::LauncherItem& old_item) OVERRIDE; |
| 295 virtual void LauncherStatusChanged() OVERRIDE; | 302 virtual void LauncherStatusChanged() OVERRIDE; |
| 296 | 303 |
| 297 // content::NotificationObserver overrides: | 304 // content::NotificationObserver overrides: |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 // The owned browser shortcut item. | 512 // The owned browser shortcut item. |
| 506 scoped_ptr<BrowserShortcutLauncherItemController> browser_item_controller_; | 513 scoped_ptr<BrowserShortcutLauncherItemController> browser_item_controller_; |
| 507 | 514 |
| 508 // If true, incoming pinned state changes should be ignored. | 515 // If true, incoming pinned state changes should be ignored. |
| 509 bool ignore_persist_pinned_state_change_; | 516 bool ignore_persist_pinned_state_change_; |
| 510 | 517 |
| 511 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); | 518 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); |
| 512 }; | 519 }; |
| 513 | 520 |
| 514 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ | 521 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ |
| OLD | NEW |