| 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 30 matching lines...) Expand all Loading... |
| 41 class BrowserStatusMonitor; | 41 class BrowserStatusMonitor; |
| 42 class ExtensionEnableFlow; | 42 class ExtensionEnableFlow; |
| 43 class GURL; | 43 class GURL; |
| 44 class LauncherItemController; | 44 class LauncherItemController; |
| 45 class Profile; | 45 class Profile; |
| 46 class ShellWindowLauncherController; | 46 class ShellWindowLauncherController; |
| 47 class TabContents; | 47 class TabContents; |
| 48 | 48 |
| 49 namespace ash { | 49 namespace ash { |
| 50 class LauncherItemDelegateManager; | 50 class LauncherItemDelegateManager; |
| 51 class LauncherModel; | 51 class ShelfModel; |
| 52 } | 52 } |
| 53 | 53 |
| 54 namespace aura { | 54 namespace aura { |
| 55 class Window; | 55 class Window; |
| 56 } | 56 } |
| 57 | 57 |
| 58 namespace content { | 58 namespace content { |
| 59 class WebContents; | 59 class WebContents; |
| 60 } | 60 } |
| 61 | 61 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 // Returns true if |id| is valid for the currently active profile. | 123 // Returns true if |id| is valid for the currently active profile. |
| 124 // Used during restore to ignore no longer valid extensions. | 124 // Used during restore to ignore no longer valid extensions. |
| 125 // Note that already running applications are ignored by the restore | 125 // Note that already running applications are ignored by the restore |
| 126 // process. | 126 // process. |
| 127 virtual bool IsValidIDForCurrentUser(const std::string& id) = 0; | 127 virtual bool IsValidIDForCurrentUser(const std::string& id) = 0; |
| 128 | 128 |
| 129 // Sets the currently active profile for the usage of |GetAppID|. | 129 // Sets the currently active profile for the usage of |GetAppID|. |
| 130 virtual void SetCurrentUser(Profile* profile) = 0; | 130 virtual void SetCurrentUser(Profile* profile) = 0; |
| 131 }; | 131 }; |
| 132 | 132 |
| 133 ChromeLauncherController(Profile* profile, ash::LauncherModel* model); | 133 ChromeLauncherController(Profile* profile, ash::ShelfModel* model); |
| 134 virtual ~ChromeLauncherController(); | 134 virtual ~ChromeLauncherController(); |
| 135 | 135 |
| 136 // Initializes this ChromeLauncherController. | 136 // Initializes this ChromeLauncherController. |
| 137 void Init(); | 137 void Init(); |
| 138 | 138 |
| 139 // Creates an instance. | 139 // Creates an instance. |
| 140 static ChromeLauncherController* CreateInstance(Profile* profile, | 140 static ChromeLauncherController* CreateInstance(Profile* profile, |
| 141 ash::LauncherModel* model); | 141 ash::ShelfModel* model); |
| 142 | 142 |
| 143 // Returns the single ChromeLauncherController instance. | 143 // Returns the single ChromeLauncherController instance. |
| 144 static ChromeLauncherController* instance() { return instance_; } | 144 static ChromeLauncherController* instance() { return instance_; } |
| 145 | 145 |
| 146 // Creates a new app item on the launcher for |controller|. | 146 // Creates a new app item on the launcher for |controller|. |
| 147 ash::LauncherID CreateAppLauncherItem(LauncherItemController* controller, | 147 ash::LauncherID CreateAppLauncherItem(LauncherItemController* controller, |
| 148 const std::string& app_id, | 148 const std::string& app_id, |
| 149 ash::LauncherItemStatus status); | 149 ash::LauncherItemStatus status); |
| 150 | 150 |
| 151 // Updates the running status of an item. It will also update the status of | 151 // Updates the running status of an item. It will also update the status of |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 237 |
| 238 // Invoked when the user clicks on button in the launcher to create a new | 238 // Invoked when the user clicks on button in the launcher to create a new |
| 239 // incognito window. | 239 // incognito window. |
| 240 void CreateNewIncognitoWindow(); | 240 void CreateNewIncognitoWindow(); |
| 241 | 241 |
| 242 // Updates the pinned pref state. The pinned state consists of a list pref. | 242 // Updates the pinned pref state. The pinned state consists of a list pref. |
| 243 // Each item of the list is a dictionary. The key |kAppIDPath| gives the | 243 // Each item of the list is a dictionary. The key |kAppIDPath| gives the |
| 244 // id of the app. | 244 // id of the app. |
| 245 void PersistPinnedState(); | 245 void PersistPinnedState(); |
| 246 | 246 |
| 247 ash::LauncherModel* model(); | 247 ash::ShelfModel* model(); |
| 248 | 248 |
| 249 // Accessor to the currently loaded profile. Note that in multi profile use | 249 // Accessor to the currently loaded profile. Note that in multi profile use |
| 250 // cases this might change over time. | 250 // cases this might change over time. |
| 251 Profile* profile(); | 251 Profile* profile(); |
| 252 | 252 |
| 253 // Gets the shelf auto-hide behavior on |root_window|. | 253 // Gets the shelf auto-hide behavior on |root_window|. |
| 254 ash::ShelfAutoHideBehavior GetShelfAutoHideBehavior( | 254 ash::ShelfAutoHideBehavior GetShelfAutoHideBehavior( |
| 255 aura::Window* root_window) const; | 255 aura::Window* root_window) const; |
| 256 | 256 |
| 257 // Returns |true| if the user is allowed to modify the shelf auto-hide | 257 // Returns |true| if the user is allowed to modify the shelf auto-hide |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 void SetShelfAlignmentFromPrefs(); | 458 void SetShelfAlignmentFromPrefs(); |
| 459 | 459 |
| 460 // Sets both of auto-hide behavior and alignment from prefs. | 460 // Sets both of auto-hide behavior and alignment from prefs. |
| 461 void SetShelfBehaviorsFromPrefs(); | 461 void SetShelfBehaviorsFromPrefs(); |
| 462 | 462 |
| 463 // Returns the most recently active web contents for an app. | 463 // Returns the most recently active web contents for an app. |
| 464 content::WebContents* GetLastActiveWebContents(const std::string& app_id); | 464 content::WebContents* GetLastActiveWebContents(const std::string& app_id); |
| 465 | 465 |
| 466 // Creates an app launcher to insert at |index|. Note that |index| may be | 466 // Creates an app launcher to insert at |index|. Note that |index| may be |
| 467 // adjusted by the model to meet ordering constraints. | 467 // adjusted by the model to meet ordering constraints. |
| 468 // The |launcher_item_type| will be set into the LauncherModel. | 468 // The |launcher_item_type| will be set into the ShelfModel. |
| 469 ash::LauncherID InsertAppLauncherItem( | 469 ash::LauncherID InsertAppLauncherItem( |
| 470 LauncherItemController* controller, | 470 LauncherItemController* controller, |
| 471 const std::string& app_id, | 471 const std::string& app_id, |
| 472 ash::LauncherItemStatus status, | 472 ash::LauncherItemStatus status, |
| 473 int index, | 473 int index, |
| 474 ash::LauncherItemType launcher_item_type); | 474 ash::LauncherItemType launcher_item_type); |
| 475 | 475 |
| 476 bool HasItemController(ash::LauncherID id) const; | 476 bool HasItemController(ash::LauncherID id) const; |
| 477 | 477 |
| 478 // Enumerate all Web contents which match a given shortcut |controller|. | 478 // Enumerate all Web contents which match a given shortcut |controller|. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 // Forget the current profile to allow attaching to a new one. | 528 // Forget the current profile to allow attaching to a new one. |
| 529 void ReleaseProfile(); | 529 void ReleaseProfile(); |
| 530 | 530 |
| 531 // Returns true if |app_id| is a Packaged App that has already launched on the | 531 // Returns true if |app_id| is a Packaged App that has already launched on the |
| 532 // native desktop and, if so, executes it as a desktop shortcut to activate | 532 // native desktop and, if so, executes it as a desktop shortcut to activate |
| 533 // desktop mode and send another OnLaunched event to the Extension. | 533 // desktop mode and send another OnLaunched event to the Extension. |
| 534 bool LaunchedInNativeDesktop(const std::string& app_id); | 534 bool LaunchedInNativeDesktop(const std::string& app_id); |
| 535 | 535 |
| 536 static ChromeLauncherController* instance_; | 536 static ChromeLauncherController* instance_; |
| 537 | 537 |
| 538 ash::LauncherModel* model_; | 538 ash::ShelfModel* model_; |
| 539 | 539 |
| 540 ash::LauncherItemDelegateManager* item_delegate_manager_; | 540 ash::LauncherItemDelegateManager* item_delegate_manager_; |
| 541 | 541 |
| 542 // Profile used for prefs and loading extensions. This is NOT necessarily the | 542 // Profile used for prefs and loading extensions. This is NOT necessarily the |
| 543 // profile new windows are created with. | 543 // profile new windows are created with. |
| 544 Profile* profile_; | 544 Profile* profile_; |
| 545 | 545 |
| 546 IDToItemControllerMap id_to_item_controller_map_; | 546 IDToItemControllerMap id_to_item_controller_map_; |
| 547 | 547 |
| 548 // Maintains activation order of web contents for each app. | 548 // Maintains activation order of web contents for each app. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 // If true, incoming pinned state changes should be ignored. | 580 // If true, incoming pinned state changes should be ignored. |
| 581 bool ignore_persist_pinned_state_change_; | 581 bool ignore_persist_pinned_state_change_; |
| 582 | 582 |
| 583 // True if each user has an own desktop. | 583 // True if each user has an own desktop. |
| 584 bool multi_profile_desktop_separation_; | 584 bool multi_profile_desktop_separation_; |
| 585 | 585 |
| 586 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); | 586 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); |
| 587 }; | 587 }; |
| 588 | 588 |
| 589 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ | 589 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ |
| OLD | NEW |