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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 aura::Window* root_window) const; | 256 aura::Window* root_window) const; |
257 | 257 |
258 // Returns |true| if the user is allowed to modify the shelf auto-hide | 258 // Returns |true| if the user is allowed to modify the shelf auto-hide |
259 // behavior on |root_window|. | 259 // behavior on |root_window|. |
260 bool CanUserModifyShelfAutoHideBehavior(aura::Window* root_window) const; | 260 bool CanUserModifyShelfAutoHideBehavior(aura::Window* root_window) const; |
261 | 261 |
262 // Toggles the shelf auto-hide behavior on |root_window|. Does nothing if the | 262 // Toggles the shelf auto-hide behavior on |root_window|. Does nothing if the |
263 // user is not allowed to modify the auto-hide behavior. | 263 // user is not allowed to modify the auto-hide behavior. |
264 void ToggleShelfAutoHideBehavior(aura::Window* root_window); | 264 void ToggleShelfAutoHideBehavior(aura::Window* root_window); |
265 | 265 |
266 // The tab no longer represents its previously identified application. | |
267 void RemoveTabFromRunningApp(content::WebContents* tab, | |
268 const std::string& app_id); | |
269 | |
270 // Notify the controller that the state of an non platform app's tabs | 266 // Notify the controller that the state of an non platform app's tabs |
271 // have changed, | 267 // have changed, |
272 void UpdateAppState(content::WebContents* contents, AppState app_state); | 268 void UpdateAppState(content::WebContents* contents, AppState app_state); |
273 | 269 |
274 // Returns ShelfID for |contents|. If |contents| is not an app or is not | 270 // Returns ShelfID for |contents|. If |contents| is not an app or is not |
275 // pinned, returns the id of browser shrotcut. | 271 // pinned, returns the id of browser shrotcut. |
276 ash::ShelfID GetShelfIDForWebContents(content::WebContents* contents); | 272 ash::ShelfID GetShelfIDForWebContents(content::WebContents* contents); |
277 | 273 |
278 // Limits application refocusing to urls that match |url| for |id|. | 274 // Limits application refocusing to urls that match |url| for |id|. |
279 void SetRefocusURLPatternForTest(ash::ShelfID id, const GURL& url); | 275 void SetRefocusURLPatternForTest(ash::ShelfID id, const GURL& url); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 // take an ownership of it. | 403 // take an ownership of it. |
408 void SetShelfItemDelegateManagerForTest( | 404 void SetShelfItemDelegateManagerForTest( |
409 ash::ShelfItemDelegateManager* manager); | 405 ash::ShelfItemDelegateManager* manager); |
410 | 406 |
411 private: | 407 private: |
412 friend class ChromeLauncherControllerTest; | 408 friend class ChromeLauncherControllerTest; |
413 friend class ShelfAppBrowserTest; | 409 friend class ShelfAppBrowserTest; |
414 friend class LauncherPlatformAppBrowserTest; | 410 friend class LauncherPlatformAppBrowserTest; |
415 | 411 |
416 typedef std::map<ash::ShelfID, LauncherItemController*> IDToItemControllerMap; | 412 typedef std::map<ash::ShelfID, LauncherItemController*> IDToItemControllerMap; |
417 typedef std::list<content::WebContents*> WebContentsList; | |
418 typedef std::map<std::string, WebContentsList> AppIDToWebContentsListMap; | |
419 typedef std::map<content::WebContents*, std::string> WebContentsToAppIDMap; | 413 typedef std::map<content::WebContents*, std::string> WebContentsToAppIDMap; |
420 | 414 |
421 // Remembers / restores list of running applications. | 415 // Remembers / restores list of running applications. |
422 // Note that this order will neither be stored in the preference nor will it | 416 // Note that this order will neither be stored in the preference nor will it |
423 // remember the order of closed applications since it is only temporary. | 417 // remember the order of closed applications since it is only temporary. |
424 void RememberUnpinnedRunningApplicationOrder(); | 418 void RememberUnpinnedRunningApplicationOrder(); |
425 void RestoreUnpinnedRunningApplicationOrder(const std::string& user_id); | 419 void RestoreUnpinnedRunningApplicationOrder(const std::string& user_id); |
426 | 420 |
427 // Creates a new app shortcut item and controller on the shelf at |index|. | 421 // Creates a new app shortcut item and controller on the shelf at |index|. |
428 // Use kInsertItemAtEnd to add a shortcut as the last item. | 422 // Use kInsertItemAtEnd to add a shortcut as the last item. |
(...skipping 28 matching lines...) Expand all Loading... |
457 | 451 |
458 // Sets the shelf auto-hide behavior from prefs. | 452 // Sets the shelf auto-hide behavior from prefs. |
459 void SetShelfAutoHideBehaviorFromPrefs(); | 453 void SetShelfAutoHideBehaviorFromPrefs(); |
460 | 454 |
461 // Sets the shelf alignment from prefs. | 455 // Sets the shelf alignment from prefs. |
462 void SetShelfAlignmentFromPrefs(); | 456 void SetShelfAlignmentFromPrefs(); |
463 | 457 |
464 // Sets both of auto-hide behavior and alignment from prefs. | 458 // Sets both of auto-hide behavior and alignment from prefs. |
465 void SetShelfBehaviorsFromPrefs(); | 459 void SetShelfBehaviorsFromPrefs(); |
466 | 460 |
467 // Returns the most recently active web contents for an app. | 461 // Returns the shelf item status for the given |app_id|, which can be either |
468 content::WebContents* GetLastActiveWebContents(const std::string& app_id); | 462 // STATUS_ACTIVE (if the app is active), STATUS_RUNNING (if there is such an |
| 463 // app) or STATUS_CLOSED. |
| 464 ash::ShelfItemStatus GetAppState(const::std::string& app_id); |
469 | 465 |
470 // 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 |
471 // adjusted by the model to meet ordering constraints. | 467 // adjusted by the model to meet ordering constraints. |
472 // The |shelf_item_type| will be set into the ShelfModel. | 468 // The |shelf_item_type| will be set into the ShelfModel. |
473 ash::ShelfID InsertAppLauncherItem(LauncherItemController* controller, | 469 ash::ShelfID InsertAppLauncherItem(LauncherItemController* controller, |
474 const std::string& app_id, | 470 const std::string& app_id, |
475 ash::ShelfItemStatus status, | 471 ash::ShelfItemStatus status, |
476 int index, | 472 int index, |
477 ash::ShelfItemType shelf_item_type); | 473 ash::ShelfItemType shelf_item_type); |
478 | 474 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 ash::ShelfModel* model_; | 537 ash::ShelfModel* model_; |
542 | 538 |
543 ash::ShelfItemDelegateManager* item_delegate_manager_; | 539 ash::ShelfItemDelegateManager* item_delegate_manager_; |
544 | 540 |
545 // Profile used for prefs and loading extensions. This is NOT necessarily the | 541 // Profile used for prefs and loading extensions. This is NOT necessarily the |
546 // profile new windows are created with. | 542 // profile new windows are created with. |
547 Profile* profile_; | 543 Profile* profile_; |
548 | 544 |
549 IDToItemControllerMap id_to_item_controller_map_; | 545 IDToItemControllerMap id_to_item_controller_map_; |
550 | 546 |
551 // Maintains activation order of web contents for each app. | |
552 AppIDToWebContentsListMap app_id_to_web_contents_list_; | |
553 | |
554 // Direct access to app_id for a web contents. | 547 // Direct access to app_id for a web contents. |
555 WebContentsToAppIDMap web_contents_to_app_id_; | 548 WebContentsToAppIDMap web_contents_to_app_id_; |
556 | 549 |
557 // Used to track app windows. | 550 // Used to track app windows. |
558 scoped_ptr<AppWindowLauncherController> app_window_controller_; | 551 scoped_ptr<AppWindowLauncherController> app_window_controller_; |
559 | 552 |
560 // Used to get app info for tabs. | 553 // Used to get app info for tabs. |
561 scoped_ptr<AppTabHelper> app_tab_helper_; | 554 scoped_ptr<AppTabHelper> app_tab_helper_; |
562 | 555 |
563 // Used to load the image for an app item. | 556 // Used to load the image for an app item. |
(...skipping 25 matching lines...) Expand all Loading... |
589 // The list of running & un-pinned applications for different users on hidden | 582 // The list of running & un-pinned applications for different users on hidden |
590 // desktops. | 583 // desktops. |
591 typedef std::vector<std::string> RunningAppListIds; | 584 typedef std::vector<std::string> RunningAppListIds; |
592 typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap; | 585 typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap; |
593 RunningAppListIdMap last_used_running_application_order_; | 586 RunningAppListIdMap last_used_running_application_order_; |
594 | 587 |
595 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); | 588 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); |
596 }; | 589 }; |
597 | 590 |
598 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ | 591 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ |
OLD | NEW |