| 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 : public ash::LauncherDelegate, | 89 class ChromeLauncherController |
| 90 public ash::LauncherItemDelegate, | 90 : public ash::LauncherDelegate, |
| 91 public ash::LauncherModelObserver, | 91 public ash::LauncherItemDelegate, |
| 92 public ash::ShellObserver, | 92 public ash::LauncherModelObserver, |
| 93 public ash::DisplayController::Observer, | 93 public ash::ShellObserver, |
| 94 public content::NotificationObserver, | 94 public ash::DisplayController::Observer, |
| 95 public extensions::AppIconLoader::Delegate, | 95 public content::NotificationObserver, |
| 96 public PrefServiceSyncableObserver, | 96 public extensions::AppIconLoader::Delegate, |
| 97 public AppSyncUIStateObserver, | 97 public PrefServiceSyncableObserver, |
| 98 public ExtensionEnableFlowDelegate, | 98 public AppSyncUIStateObserver, |
| 99 public ash::ShelfLayoutManagerObserver { | 99 public ExtensionEnableFlowDelegate, |
| 100 public ash::ShelfLayoutManagerObserver { |
| 100 public: | 101 public: |
| 101 // Indicates if a launcher item is incognito or not. | 102 // Indicates if a launcher item is incognito or not. |
| 102 enum IncognitoState { | 103 enum IncognitoState { |
| 103 STATE_INCOGNITO, | 104 STATE_INCOGNITO, |
| 104 STATE_NOT_INCOGNITO, | 105 STATE_NOT_INCOGNITO, |
| 105 }; | 106 }; |
| 106 | 107 |
| 107 // Used to update the state of non plaform apps, as web contents change. | 108 // Used to update the state of non plaform apps, as web contents change. |
| 108 enum AppState { | 109 enum AppState { |
| 109 APP_STATE_ACTIVE, | 110 APP_STATE_ACTIVE, |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 Profile* GetProfileForNewWindows(); | 413 Profile* GetProfileForNewWindows(); |
| 413 | 414 |
| 414 // Invoked when the associated browser or app is closed. | 415 // Invoked when the associated browser or app is closed. |
| 415 void LauncherItemClosed(ash::LauncherID id); | 416 void LauncherItemClosed(ash::LauncherID id); |
| 416 | 417 |
| 417 // Internal helpers for pinning and unpinning that handle both | 418 // Internal helpers for pinning and unpinning that handle both |
| 418 // client-triggered and internal pinning operations. | 419 // client-triggered and internal pinning operations. |
| 419 void DoPinAppWithID(const std::string& app_id); | 420 void DoPinAppWithID(const std::string& app_id); |
| 420 void DoUnpinAppWithID(const std::string& app_id); | 421 void DoUnpinAppWithID(const std::string& app_id); |
| 421 | 422 |
| 422 // Pin a running app with |launcher_id| internally to |index|. It returns | |
| 423 // the index where the item was pinned. | |
| 424 int PinRunningAppInternal(int index, ash::LauncherID launcher_id); | |
| 425 | |
| 426 // Unpin a locked application. This is an internal call which converts the | |
| 427 // model type of the given app index from a shortcut into an unpinned running | |
| 428 // app. | |
| 429 void UnpinRunningAppInternal(int index); | |
| 430 | |
| 431 // Re-syncs launcher model with prefs::kPinnedLauncherApps. | 423 // Re-syncs launcher model with prefs::kPinnedLauncherApps. |
| 432 void UpdateAppLaunchersFromPref(); | 424 void UpdateAppLaunchersFromPref(); |
| 433 | 425 |
| 434 // Persists the shelf auto-hide behavior to prefs. | 426 // Persists the shelf auto-hide behavior to prefs. |
| 435 void SetShelfAutoHideBehaviorPrefs(ash::ShelfAutoHideBehavior behavior, | 427 void SetShelfAutoHideBehaviorPrefs(ash::ShelfAutoHideBehavior behavior, |
| 436 aura::RootWindow* root_window); | 428 aura::RootWindow* root_window); |
| 437 | 429 |
| 438 // Sets the shelf auto-hide behavior from prefs. | 430 // Sets the shelf auto-hide behavior from prefs. |
| 439 void SetShelfAutoHideBehaviorFromPrefs(); | 431 void SetShelfAutoHideBehaviorFromPrefs(); |
| 440 | 432 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 460 bool HasItemController(ash::LauncherID id) const; | 452 bool HasItemController(ash::LauncherID id) const; |
| 461 | 453 |
| 462 // Enumerate all Web contents which match a given shortcut |controller|. | 454 // Enumerate all Web contents which match a given shortcut |controller|. |
| 463 std::vector<content::WebContents*> GetV1ApplicationsFromController( | 455 std::vector<content::WebContents*> GetV1ApplicationsFromController( |
| 464 LauncherItemController* controller); | 456 LauncherItemController* controller); |
| 465 | 457 |
| 466 // Create LauncherItem for Browser Shortcut. | 458 // Create LauncherItem for Browser Shortcut. |
| 467 ash::LauncherID CreateBrowserShortcutLauncherItem(); | 459 ash::LauncherID CreateBrowserShortcutLauncherItem(); |
| 468 | 460 |
| 469 // Check if the given |web_contents| is in incognito mode. | 461 // Check if the given |web_contents| is in incognito mode. |
| 470 bool IsIncognito(const content::WebContents* web_contents) const; | 462 bool IsIncognito(content::WebContents* web_contents) const; |
| 471 | 463 |
| 472 // Update browser shortcut's index. | 464 // Update browser shortcut's index. |
| 473 void PersistChromeItemIndex(int index); | 465 void PersistChromeItemIndex(int index); |
| 474 | 466 |
| 475 // Get browser shortcut's index from pref. | 467 // Get browser shortcut's index from pref. |
| 476 int GetChromeIconIndexFromPref() const; | 468 int GetChromeIconIndexFromPref() const; |
| 477 | 469 |
| 478 // Get the browser shortcut's index in the shelf using the current's systems | |
| 479 // configuration of pinned and known (but not running) apps. | |
| 480 int GetChromeIconIndexForCreation(); | |
| 481 | |
| 482 // Get the list of pinned programs from the preferences. | |
| 483 std::vector<std::string> GetListOfPinnedAppsAndBrowser(); | |
| 484 | |
| 485 // Close all windowed V1 applications of a certain extension which was already | 470 // Close all windowed V1 applications of a certain extension which was already |
| 486 // deleted. | 471 // deleted. |
| 487 void CloseWindowedAppsFromRemovedExtension(const std::string& app_id); | 472 void CloseWindowedAppsFromRemovedExtension(const std::string& app_id); |
| 488 | 473 |
| 474 // Move a launcher item ignoring the pinned state changes from |index| to |
| 475 // |target_index|. |
| 476 void MoveItemWithoutPinnedStateChangeNotification(int source_index, |
| 477 int target_index); |
| 478 |
| 489 // Register LauncherItemDelegate. | 479 // Register LauncherItemDelegate. |
| 490 void RegisterLauncherItemDelegate(); | 480 void RegisterLauncherItemDelegate(); |
| 491 | 481 |
| 492 // Attach to a specific profile. | 482 // Attach to a specific profile. |
| 493 void AttachProfile(Profile* proifile); | 483 void AttachProfile(Profile* proifile); |
| 494 | 484 |
| 495 // Forget the current profile to allow attaching to a new one. | 485 // Forget the current profile to allow attaching to a new one. |
| 496 void ReleaseProfile(); | 486 void ReleaseProfile(); |
| 497 | 487 |
| 498 static ChromeLauncherController* instance_; | 488 static ChromeLauncherController* instance_; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 // A special observer class to detect user switches. | 530 // A special observer class to detect user switches. |
| 541 scoped_ptr<ChromeLauncherControllerUserSwitchObserver> user_switch_observer_; | 531 scoped_ptr<ChromeLauncherControllerUserSwitchObserver> user_switch_observer_; |
| 542 | 532 |
| 543 // If true, incoming pinned state changes should be ignored. | 533 // If true, incoming pinned state changes should be ignored. |
| 544 bool ignore_persist_pinned_state_change_; | 534 bool ignore_persist_pinned_state_change_; |
| 545 | 535 |
| 546 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); | 536 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); |
| 547 }; | 537 }; |
| 548 | 538 |
| 549 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ | 539 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ |
| OLD | NEW |