Chromium Code Reviews| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 // ChromeLauncherController manages the launcher items needed for content | 79 // ChromeLauncherController manages the launcher items needed for content |
| 80 // windows. Launcher items have a type, an optional app id, and a controller. | 80 // windows. Launcher items have a type, an optional app id, and a controller. |
| 81 // This incarnation groups running tabs/windows in application specific lists. | 81 // This incarnation groups running tabs/windows in application specific lists. |
| 82 // * Browser app windows have BrowserLauncherItemController, owned by the | 82 // * Browser app windows have BrowserLauncherItemController, owned by the |
| 83 // BrowserView instance. | 83 // BrowserView instance. |
| 84 // * App shell windows have ShellWindowLauncherItemController, owned by | 84 // * App shell windows have ShellWindowLauncherItemController, owned by |
| 85 // ShellWindowLauncherController. | 85 // ShellWindowLauncherController. |
| 86 // * Shortcuts have no LauncherItemController. | 86 // * Shortcuts have no LauncherItemController. |
| 87 // TODO(simon.hong81): Move LauncherItemDelegate out from | 87 // TODO(simon.hong81): Move LauncherItemDelegate out from |
| 88 // ChromeLauncherController and makes separate subclass with it. | 88 // ChromeLauncherController and makes separate subclass with it. |
| 89 class ChromeLauncherController | 89 class ChromeLauncherController : public ash::LauncherDelegate, |
| 90 : public ash::LauncherDelegate, | 90 public ash::LauncherItemDelegate, |
| 91 public ash::LauncherItemDelegate, | 91 public ash::LauncherModelObserver, |
| 92 public ash::LauncherModelObserver, | 92 public ash::ShellObserver, |
| 93 public ash::ShellObserver, | 93 public ash::DisplayController::Observer, |
| 94 public ash::DisplayController::Observer, | 94 public content::NotificationObserver, |
| 95 public content::NotificationObserver, | 95 public extensions::AppIconLoader::Delegate, |
| 96 public extensions::AppIconLoader::Delegate, | 96 public PrefServiceSyncableObserver, |
| 97 public PrefServiceSyncableObserver, | 97 public AppSyncUIStateObserver, |
| 98 public AppSyncUIStateObserver, | 98 public ExtensionEnableFlowDelegate, |
| 99 public ExtensionEnableFlowDelegate, | 99 public ash::ShelfLayoutManagerObserver { |
| 100 public ash::ShelfLayoutManagerObserver { | |
| 101 public: | 100 public: |
| 102 // Indicates if a launcher item is incognito or not. | 101 // Indicates if a launcher item is incognito or not. |
| 103 enum IncognitoState { | 102 enum IncognitoState { |
| 104 STATE_INCOGNITO, | 103 STATE_INCOGNITO, |
| 105 STATE_NOT_INCOGNITO, | 104 STATE_NOT_INCOGNITO, |
| 106 }; | 105 }; |
| 107 | 106 |
| 108 // Used to update the state of non plaform apps, as web contents change. | 107 // Used to update the state of non plaform apps, as web contents change. |
| 109 enum AppState { | 108 enum AppState { |
| 110 APP_STATE_ACTIVE, | 109 APP_STATE_ACTIVE, |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 413 Profile* GetProfileForNewWindows(); | 412 Profile* GetProfileForNewWindows(); |
| 414 | 413 |
| 415 // Invoked when the associated browser or app is closed. | 414 // Invoked when the associated browser or app is closed. |
| 416 void LauncherItemClosed(ash::LauncherID id); | 415 void LauncherItemClosed(ash::LauncherID id); |
| 417 | 416 |
| 418 // Internal helpers for pinning and unpinning that handle both | 417 // Internal helpers for pinning and unpinning that handle both |
| 419 // client-triggered and internal pinning operations. | 418 // client-triggered and internal pinning operations. |
| 420 void DoPinAppWithID(const std::string& app_id); | 419 void DoPinAppWithID(const std::string& app_id); |
| 421 void DoUnpinAppWithID(const std::string& app_id); | 420 void DoUnpinAppWithID(const std::string& app_id); |
| 422 | 421 |
| 422 // Pin a running app with |launcher_id| internally to |index|. It returns | |
| 423 // the index where the item was pinned. Note that this will not update the | |
| 424 // preferences. | |
| 425 int PinRunningAppInternal(int index, ash::LauncherID launcher_id); | |
| 426 | |
| 427 // Unpin a locked application. This is an internal call which converts the | |
| 428 // model type of the given app index from a shortcut into an unpinned running | |
| 429 // app. | |
| 430 void UnpinRunningAppInternal(int index); | |
| 431 | |
| 423 // Re-syncs launcher model with prefs::kPinnedLauncherApps. | 432 // Re-syncs launcher model with prefs::kPinnedLauncherApps. |
| 424 void UpdateAppLaunchersFromPref(); | 433 void UpdateAppLaunchersFromPref(); |
| 425 | 434 |
| 426 // Persists the shelf auto-hide behavior to prefs. | 435 // Persists the shelf auto-hide behavior to prefs. |
| 427 void SetShelfAutoHideBehaviorPrefs(ash::ShelfAutoHideBehavior behavior, | 436 void SetShelfAutoHideBehaviorPrefs(ash::ShelfAutoHideBehavior behavior, |
| 428 aura::RootWindow* root_window); | 437 aura::RootWindow* root_window); |
| 429 | 438 |
| 430 // Sets the shelf auto-hide behavior from prefs. | 439 // Sets the shelf auto-hide behavior from prefs. |
| 431 void SetShelfAutoHideBehaviorFromPrefs(); | 440 void SetShelfAutoHideBehaviorFromPrefs(); |
| 432 | 441 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 452 bool HasItemController(ash::LauncherID id) const; | 461 bool HasItemController(ash::LauncherID id) const; |
| 453 | 462 |
| 454 // Enumerate all Web contents which match a given shortcut |controller|. | 463 // Enumerate all Web contents which match a given shortcut |controller|. |
| 455 std::vector<content::WebContents*> GetV1ApplicationsFromController( | 464 std::vector<content::WebContents*> GetV1ApplicationsFromController( |
| 456 LauncherItemController* controller); | 465 LauncherItemController* controller); |
| 457 | 466 |
| 458 // Create LauncherItem for Browser Shortcut. | 467 // Create LauncherItem for Browser Shortcut. |
| 459 ash::LauncherID CreateBrowserShortcutLauncherItem(); | 468 ash::LauncherID CreateBrowserShortcutLauncherItem(); |
| 460 | 469 |
| 461 // Check if the given |web_contents| is in incognito mode. | 470 // Check if the given |web_contents| is in incognito mode. |
| 462 bool IsIncognito(content::WebContents* web_contents) const; | 471 bool IsIncognito(content::WebContents* web_contents) const; |
|
oshima
2013/09/19 21:42:11
can web_content be const?
Mr4D (OOO till 08-26)
2013/09/19 22:31:50
Done.
| |
| 463 | 472 |
| 464 // Update browser shortcut's index. | 473 // Update browser shortcut's index. |
| 465 void PersistChromeItemIndex(int index); | 474 void PersistChromeItemIndex(int index); |
| 466 | 475 |
| 467 // Get browser shortcut's index from pref. | 476 // Get browser shortcut's index from pref. |
| 468 int GetChromeIconIndexFromPref() const; | 477 int GetChromeIconIndexFromPref() const; |
| 469 | 478 |
| 479 // Get the browser shortcut's index in the shelf using the current's systems | |
| 480 // configuration of pinned and known (but not running) apps. | |
| 481 int GetChromeIconIndexForCreation(); | |
| 482 | |
| 483 // Get the list of pinned programs from the preferences. | |
| 484 void GetListOfPinnedAppsAndBrowser(std::vector<std::string>* pinned_apps); | |
|
oshima
2013/09/19 21:42:11
Just return std::vector<std::string>
(See http://e
Mr4D (OOO till 08-26)
2013/09/19 22:31:50
Done.
| |
| 485 | |
| 470 // Close all windowed V1 applications of a certain extension which was already | 486 // Close all windowed V1 applications of a certain extension which was already |
| 471 // deleted. | 487 // deleted. |
| 472 void CloseWindowedAppsFromRemovedExtension(const std::string& app_id); | 488 void CloseWindowedAppsFromRemovedExtension(const std::string& app_id); |
| 473 | 489 |
| 474 // Move a launcher item ignoring the pinned state changes from |index| to | 490 // Move a launcher item ignoring the pinned state changes from |index| to |
| 475 // |target_index|. | 491 // |target_index|. |
| 476 void MoveItemWithoutPinnedStateChangeNotification(int source_index, | 492 void MoveItemWithoutPinnedStateChangeNotification(int source_index, |
| 477 int target_index); | 493 int target_index); |
| 478 | 494 |
| 479 // Register LauncherItemDelegate. | 495 // Register LauncherItemDelegate. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 530 // A special observer class to detect user switches. | 546 // A special observer class to detect user switches. |
| 531 scoped_ptr<ChromeLauncherControllerUserSwitchObserver> user_switch_observer_; | 547 scoped_ptr<ChromeLauncherControllerUserSwitchObserver> user_switch_observer_; |
| 532 | 548 |
| 533 // If true, incoming pinned state changes should be ignored. | 549 // If true, incoming pinned state changes should be ignored. |
| 534 bool ignore_persist_pinned_state_change_; | 550 bool ignore_persist_pinned_state_change_; |
| 535 | 551 |
| 536 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); | 552 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); |
| 537 }; | 553 }; |
| 538 | 554 |
| 539 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ | 555 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ |
| OLD | NEW |