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. |
| 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 |
423 // Re-syncs launcher model with prefs::kPinnedLauncherApps. | 431 // Re-syncs launcher model with prefs::kPinnedLauncherApps. |
424 void UpdateAppLaunchersFromPref(); | 432 void UpdateAppLaunchersFromPref(); |
425 | 433 |
426 // Persists the shelf auto-hide behavior to prefs. | 434 // Persists the shelf auto-hide behavior to prefs. |
427 void SetShelfAutoHideBehaviorPrefs(ash::ShelfAutoHideBehavior behavior, | 435 void SetShelfAutoHideBehaviorPrefs(ash::ShelfAutoHideBehavior behavior, |
428 aura::RootWindow* root_window); | 436 aura::RootWindow* root_window); |
429 | 437 |
430 // Sets the shelf auto-hide behavior from prefs. | 438 // Sets the shelf auto-hide behavior from prefs. |
431 void SetShelfAutoHideBehaviorFromPrefs(); | 439 void SetShelfAutoHideBehaviorFromPrefs(); |
432 | 440 |
(...skipping 19 matching lines...) Expand all Loading... |
452 bool HasItemController(ash::LauncherID id) const; | 460 bool HasItemController(ash::LauncherID id) const; |
453 | 461 |
454 // Enumerate all Web contents which match a given shortcut |controller|. | 462 // Enumerate all Web contents which match a given shortcut |controller|. |
455 std::vector<content::WebContents*> GetV1ApplicationsFromController( | 463 std::vector<content::WebContents*> GetV1ApplicationsFromController( |
456 LauncherItemController* controller); | 464 LauncherItemController* controller); |
457 | 465 |
458 // Create LauncherItem for Browser Shortcut. | 466 // Create LauncherItem for Browser Shortcut. |
459 ash::LauncherID CreateBrowserShortcutLauncherItem(); | 467 ash::LauncherID CreateBrowserShortcutLauncherItem(); |
460 | 468 |
461 // Check if the given |web_contents| is in incognito mode. | 469 // Check if the given |web_contents| is in incognito mode. |
462 bool IsIncognito(content::WebContents* web_contents) const; | 470 bool IsIncognito(const content::WebContents* web_contents) const; |
463 | 471 |
464 // Update browser shortcut's index. | 472 // Update browser shortcut's index. |
465 void PersistChromeItemIndex(int index); | 473 void PersistChromeItemIndex(int index); |
466 | 474 |
467 // Get browser shortcut's index from pref. | 475 // Get browser shortcut's index from pref. |
468 int GetChromeIconIndexFromPref() const; | 476 int GetChromeIconIndexFromPref() const; |
469 | 477 |
| 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 |
470 // Close all windowed V1 applications of a certain extension which was already | 485 // Close all windowed V1 applications of a certain extension which was already |
471 // deleted. | 486 // deleted. |
472 void CloseWindowedAppsFromRemovedExtension(const std::string& app_id); | 487 void CloseWindowedAppsFromRemovedExtension(const std::string& app_id); |
473 | 488 |
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 | |
479 // Register LauncherItemDelegate. | 489 // Register LauncherItemDelegate. |
480 void RegisterLauncherItemDelegate(); | 490 void RegisterLauncherItemDelegate(); |
481 | 491 |
482 // Attach to a specific profile. | 492 // Attach to a specific profile. |
483 void AttachProfile(Profile* proifile); | 493 void AttachProfile(Profile* proifile); |
484 | 494 |
485 // Forget the current profile to allow attaching to a new one. | 495 // Forget the current profile to allow attaching to a new one. |
486 void ReleaseProfile(); | 496 void ReleaseProfile(); |
487 | 497 |
488 static ChromeLauncherController* instance_; | 498 static ChromeLauncherController* instance_; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 // A special observer class to detect user switches. | 540 // A special observer class to detect user switches. |
531 scoped_ptr<ChromeLauncherControllerUserSwitchObserver> user_switch_observer_; | 541 scoped_ptr<ChromeLauncherControllerUserSwitchObserver> user_switch_observer_; |
532 | 542 |
533 // If true, incoming pinned state changes should be ignored. | 543 // If true, incoming pinned state changes should be ignored. |
534 bool ignore_persist_pinned_state_change_; | 544 bool ignore_persist_pinned_state_change_; |
535 | 545 |
536 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); | 546 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); |
537 }; | 547 }; |
538 | 548 |
539 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ | 549 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ |
OLD | NEW |