| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ash/launcher/launcher_delegate.h" | 10 #include "ash/launcher/launcher_delegate.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // valid extensions. | 81 // valid extensions. |
| 82 virtual bool IsValidID(const std::string& id) = 0; | 82 virtual bool IsValidID(const std::string& id) = 0; |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 ChromeLauncherController() {} | 85 ChromeLauncherController() {} |
| 86 virtual ~ChromeLauncherController(); | 86 virtual ~ChromeLauncherController(); |
| 87 | 87 |
| 88 // Initializes this ChromeLauncherController. | 88 // Initializes this ChromeLauncherController. |
| 89 virtual void Init() = 0; | 89 virtual void Init() = 0; |
| 90 | 90 |
| 91 // Returns the new per application interface of the given launcher. If it is | |
| 92 // a per browser (old) controller, it will return NULL; | |
| 93 // TODO(skuhne): Remove when we rip out the old launcher. | |
| 94 virtual ChromeLauncherControllerPerApp* GetPerAppInterface() = 0; | |
| 95 | |
| 96 // Creates an instance. | 91 // Creates an instance. |
| 97 static ChromeLauncherController* CreateInstance(Profile* profile, | 92 static ChromeLauncherController* CreateInstance(Profile* profile, |
| 98 ash::LauncherModel* model); | 93 ash::LauncherModel* model); |
| 99 | 94 |
| 100 // Returns the single ChromeLauncherController instance. | 95 // Returns the single ChromeLauncherController instance. |
| 101 static ChromeLauncherController* instance() { return instance_; } | 96 static ChromeLauncherController* instance() { return instance_; } |
| 102 | 97 |
| 103 // Creates a new tabbed item on the launcher for |controller|. | |
| 104 virtual ash::LauncherID CreateTabbedLauncherItem( | |
| 105 LauncherItemController* controller, | |
| 106 IncognitoState is_incognito, | |
| 107 ash::LauncherItemStatus status) = 0; | |
| 108 | |
| 109 // Creates a new app item on the launcher for |controller|. | 98 // Creates a new app item on the launcher for |controller|. |
| 110 virtual ash::LauncherID CreateAppLauncherItem( | 99 virtual ash::LauncherID CreateAppLauncherItem( |
| 111 LauncherItemController* controller, | 100 LauncherItemController* controller, |
| 112 const std::string& app_id, | 101 const std::string& app_id, |
| 113 ash::LauncherItemStatus status) = 0; | 102 ash::LauncherItemStatus status) = 0; |
| 114 | 103 |
| 115 // Updates the running status of an item. | 104 // Updates the running status of an item. |
| 116 virtual void SetItemStatus(ash::LauncherID id, | 105 virtual void SetItemStatus(ash::LauncherID id, |
| 117 ash::LauncherItemStatus status) = 0; | 106 ash::LauncherItemStatus status) = 0; |
| 118 | 107 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 const ui::Event& event) OVERRIDE = 0; | 258 const ui::Event& event) OVERRIDE = 0; |
| 270 virtual string16 GetTitle(const ash::LauncherItem& item) OVERRIDE = 0; | 259 virtual string16 GetTitle(const ash::LauncherItem& item) OVERRIDE = 0; |
| 271 virtual ui::MenuModel* CreateContextMenu( | 260 virtual ui::MenuModel* CreateContextMenu( |
| 272 const ash::LauncherItem& item, aura::RootWindow* root) OVERRIDE = 0; | 261 const ash::LauncherItem& item, aura::RootWindow* root) OVERRIDE = 0; |
| 273 virtual ash::LauncherMenuModel* CreateApplicationMenu( | 262 virtual ash::LauncherMenuModel* CreateApplicationMenu( |
| 274 const ash::LauncherItem& item, | 263 const ash::LauncherItem& item, |
| 275 int event_flags) OVERRIDE = 0; | 264 int event_flags) OVERRIDE = 0; |
| 276 virtual ash::LauncherID GetIDByWindow(aura::Window* window) OVERRIDE = 0; | 265 virtual ash::LauncherID GetIDByWindow(aura::Window* window) OVERRIDE = 0; |
| 277 virtual bool IsDraggable(const ash::LauncherItem& item) OVERRIDE = 0; | 266 virtual bool IsDraggable(const ash::LauncherItem& item) OVERRIDE = 0; |
| 278 virtual bool ShouldShowTooltip(const ash::LauncherItem& item) OVERRIDE = 0; | 267 virtual bool ShouldShowTooltip(const ash::LauncherItem& item) OVERRIDE = 0; |
| 279 virtual bool IsPerAppLauncher() OVERRIDE; | |
| 280 | 268 |
| 281 // extensions::AppIconLoader overrides: | 269 // extensions::AppIconLoader overrides: |
| 282 virtual void SetAppImage(const std::string& app_id, | 270 virtual void SetAppImage(const std::string& app_id, |
| 283 const gfx::ImageSkia& image) OVERRIDE = 0; | 271 const gfx::ImageSkia& image) OVERRIDE = 0; |
| 284 | 272 |
| 285 protected: | 273 protected: |
| 286 friend class LauncherItemControllerPerAppTest; | 274 friend class LauncherItemControllerPerAppTest; |
| 287 friend class LauncherPlatformAppBrowserTest; | 275 friend class LauncherPlatformAppBrowserTest; |
| 288 friend class LauncherAppBrowserTest; | 276 friend class LauncherAppBrowserTest; |
| 289 // TODO(skuhne): Remove these when the old launcher get removed. | |
| 290 friend class LauncherPlatformPerAppAppBrowserTest; | |
| 291 friend class LauncherPerAppAppBrowserTest; | 277 friend class LauncherPerAppAppBrowserTest; |
| 292 | 278 |
| 293 // Creates a new app shortcut item and controller on the launcher at |index|. | 279 // Creates a new app shortcut item and controller on the launcher at |index|. |
| 294 // Use kInsertItemAtEnd to add a shortcut as the last item. | 280 // Use kInsertItemAtEnd to add a shortcut as the last item. |
| 295 virtual ash::LauncherID CreateAppShortcutLauncherItem( | 281 virtual ash::LauncherID CreateAppShortcutLauncherItem( |
| 296 const std::string& app_id, | 282 const std::string& app_id, |
| 297 int index) = 0; | 283 int index) = 0; |
| 298 | 284 |
| 299 // Sets the AppTabHelper/AppIconLoader, taking ownership of the helper class. | 285 // Sets the AppTabHelper/AppIconLoader, taking ownership of the helper class. |
| 300 // These are intended for testing. | 286 // These are intended for testing. |
| 301 virtual void SetAppTabHelperForTest(AppTabHelper* helper) = 0; | 287 virtual void SetAppTabHelperForTest(AppTabHelper* helper) = 0; |
| 302 virtual void SetAppIconLoaderForTest(extensions::AppIconLoader* loader) = 0; | 288 virtual void SetAppIconLoaderForTest(extensions::AppIconLoader* loader) = 0; |
| 303 virtual const std::string& GetAppIdFromLauncherIdForTest( | 289 virtual const std::string& GetAppIdFromLauncherIdForTest( |
| 304 ash::LauncherID id) = 0; | 290 ash::LauncherID id) = 0; |
| 305 | 291 |
| 306 private: | 292 private: |
| 307 static ChromeLauncherController* instance_; | 293 static ChromeLauncherController* instance_; |
| 308 }; | 294 }; |
| 309 | 295 |
| 310 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ | 296 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ |
| OLD | NEW |