| 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_VIEWS_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 namespace ash { | 25 namespace ash { |
| 26 class LauncherModel; | 26 class LauncherModel; |
| 27 } | 27 } |
| 28 | 28 |
| 29 class BrowserLauncherItemController; | 29 class BrowserLauncherItemController; |
| 30 class BrowserLauncherItemControllerTest; | 30 class BrowserLauncherItemControllerTest; |
| 31 class PrefService; | 31 class PrefService; |
| 32 class Profile; | 32 class Profile; |
| 33 class TabContents; | 33 class TabContents; |
| 34 typedef TabContents TabContentsWrapper; | |
| 35 | 34 |
| 36 // ChromeLauncherController manages the launcher items needed for tabbed | 35 // ChromeLauncherController manages the launcher items needed for tabbed |
| 37 // browsers (BrowserLauncherItemController) and browser shortcuts. | 36 // browsers (BrowserLauncherItemController) and browser shortcuts. |
| 38 class ChromeLauncherController : public ash::LauncherDelegate, | 37 class ChromeLauncherController : public ash::LauncherDelegate, |
| 39 public ash::LauncherModelObserver, | 38 public ash::LauncherModelObserver, |
| 40 public content::NotificationObserver, | 39 public content::NotificationObserver, |
| 41 public ShellWindowRegistry::Observer { | 40 public ShellWindowRegistry::Observer { |
| 42 public: | 41 public: |
| 43 // Indicates if a launcher item is incognito or not. | 42 // Indicates if a launcher item is incognito or not. |
| 44 enum IncognitoState { | 43 enum IncognitoState { |
| 45 STATE_INCOGNITO, | 44 STATE_INCOGNITO, |
| 46 STATE_NOT_INCOGNITO, | 45 STATE_NOT_INCOGNITO, |
| 47 }; | 46 }; |
| 48 | 47 |
| 49 // Interface used to load app icons. This is in it's own class so that it can | 48 // Interface used to load app icons. This is in it's own class so that it can |
| 50 // be mocked. | 49 // be mocked. |
| 51 class AppIconLoader { | 50 class AppIconLoader { |
| 52 public: | 51 public: |
| 53 virtual ~AppIconLoader() {} | 52 virtual ~AppIconLoader() {} |
| 54 | 53 |
| 55 // Returns the app id of the specified tab, or an empty string if there is | 54 // Returns the app id of the specified tab, or an empty string if there is |
| 56 // no app. | 55 // no app. |
| 57 virtual std::string GetAppID(TabContentsWrapper* tab) = 0; | 56 virtual std::string GetAppID(TabContents* tab) = 0; |
| 58 | 57 |
| 59 // Returns true if |id| is valid. Used during restore to ignore no longer | 58 // Returns true if |id| is valid. Used during restore to ignore no longer |
| 60 // valid extensions. | 59 // valid extensions. |
| 61 virtual bool IsValidID(const std::string& id) = 0; | 60 virtual bool IsValidID(const std::string& id) = 0; |
| 62 | 61 |
| 63 // Fetches the image for the specified id. When done (which may be | 62 // Fetches the image for the specified id. When done (which may be |
| 64 // synchronous), this should invoke SetAppImage() on the LauncherUpdater. | 63 // synchronous), this should invoke SetAppImage() on the LauncherUpdater. |
| 65 virtual void FetchImage(const std::string& id) = 0; | 64 virtual void FetchImage(const std::string& id) = 0; |
| 66 }; | 65 }; |
| 67 | 66 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // Closes the specified item. | 111 // Closes the specified item. |
| 113 void Close(ash::LauncherID id); | 112 void Close(ash::LauncherID id); |
| 114 | 113 |
| 115 // Returns true if the specified item is open. | 114 // Returns true if the specified item is open. |
| 116 bool IsOpen(ash::LauncherID id); | 115 bool IsOpen(ash::LauncherID id); |
| 117 | 116 |
| 118 // Returns the launch type of app for the specified id. | 117 // Returns the launch type of app for the specified id. |
| 119 ExtensionPrefs::LaunchType GetLaunchType(ash::LauncherID id); | 118 ExtensionPrefs::LaunchType GetLaunchType(ash::LauncherID id); |
| 120 | 119 |
| 121 // Returns the id of the app for the specified tab. | 120 // Returns the id of the app for the specified tab. |
| 122 std::string GetAppID(TabContentsWrapper* tab); | 121 std::string GetAppID(TabContents* tab); |
| 123 | 122 |
| 124 // Sets the image for an app tab. This is intended to be invoked from the | 123 // Sets the image for an app tab. This is intended to be invoked from the |
| 125 // AppIconLoader. | 124 // AppIconLoader. |
| 126 void SetAppImage(const std::string& app_id, const SkBitmap* image); | 125 void SetAppImage(const std::string& app_id, const SkBitmap* image); |
| 127 | 126 |
| 128 // Returns true if a pinned launcher item with given |app_id| could be found. | 127 // Returns true if a pinned launcher item with given |app_id| could be found. |
| 129 bool IsAppPinned(const std::string& app_id); | 128 bool IsAppPinned(const std::string& app_id); |
| 130 | 129 |
| 131 // Pins an app with |app_id| to launcher. If there is a running instance in | 130 // Pins an app with |app_id| to launcher. If there is a running instance in |
| 132 // launcher, the running instance is pinned. If there is no running instance, | 131 // launcher, the running instance is pinned. If there is no running instance, |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 scoped_ptr<AppIconLoader> app_icon_loader_; | 263 scoped_ptr<AppIconLoader> app_icon_loader_; |
| 265 | 264 |
| 266 content::NotificationRegistrar notification_registrar_; | 265 content::NotificationRegistrar notification_registrar_; |
| 267 | 266 |
| 268 PrefChangeRegistrar pref_change_registrar_; | 267 PrefChangeRegistrar pref_change_registrar_; |
| 269 | 268 |
| 270 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); | 269 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); |
| 271 }; | 270 }; |
| 272 | 271 |
| 273 #endif // CHROME_BROWSER_UI_VIEWS_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ | 272 #endif // CHROME_BROWSER_UI_VIEWS_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ |
| OLD | NEW |