Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1329)

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller.h

Issue 1921403002: Pin apps from prefs on the mash shelf. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Only include arc for cros. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory> 10 #include <memory>
(...skipping 16 matching lines...) Expand all
27 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h" 27 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h"
28 #include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h" 28 #include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h"
29 #include "chrome/browser/ui/ash/launcher/launcher_app_updater.h" 29 #include "chrome/browser/ui/ash/launcher/launcher_app_updater.h"
30 #include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h" 30 #include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h"
31 #include "components/prefs/pref_change_registrar.h" 31 #include "components/prefs/pref_change_registrar.h"
32 #include "components/syncable_prefs/pref_service_syncable_observer.h" 32 #include "components/syncable_prefs/pref_service_syncable_observer.h"
33 #include "extensions/common/constants.h" 33 #include "extensions/common/constants.h"
34 #include "ui/aura/window_observer.h" 34 #include "ui/aura/window_observer.h"
35 35
36 class AppSyncUIState; 36 class AppSyncUIState;
37 class AppTabHelper;
37 class Browser; 38 class Browser;
38 class BrowserShortcutLauncherItemController; 39 class BrowserShortcutLauncherItemController;
39 class BrowserStatusMonitor; 40 class BrowserStatusMonitor;
40 class ExtensionEnableFlow; 41 class ExtensionEnableFlow;
41 class GURL; 42 class GURL;
42 class LauncherItemController; 43 class LauncherItemController;
43 class Profile; 44 class Profile;
44 class AppWindowLauncherController; 45 class AppWindowLauncherController;
45 class TabContents; 46 class TabContents;
46 47
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 }; 100 };
100 101
101 // Used to update the state of non plaform apps, as web contents change. 102 // Used to update the state of non plaform apps, as web contents change.
102 enum AppState { 103 enum AppState {
103 APP_STATE_ACTIVE, 104 APP_STATE_ACTIVE,
104 APP_STATE_WINDOW_ACTIVE, 105 APP_STATE_WINDOW_ACTIVE,
105 APP_STATE_INACTIVE, 106 APP_STATE_INACTIVE,
106 APP_STATE_REMOVED 107 APP_STATE_REMOVED
107 }; 108 };
108 109
109 // Mockable interface to get app ids from tabs.
110 class AppTabHelper {
111 public:
112 virtual ~AppTabHelper() {}
113
114 // Returns the app id of the specified tab, or an empty string if there is
115 // no app. All known profiles will be queried for this.
116 virtual std::string GetAppID(content::WebContents* tab) = 0;
117
118 // Returns true if |id| is valid for the currently active profile.
119 // Used during restore to ignore no longer valid extensions.
120 // Note that already running applications are ignored by the restore
121 // process.
122 virtual bool IsValidIDForCurrentUser(const std::string& id) = 0;
123
124 // Sets the currently active profile for the usage of |GetAppID|.
125 virtual void SetCurrentUser(Profile* profile) = 0;
126 };
127
128 ChromeLauncherController(Profile* profile, ash::ShelfModel* model); 110 ChromeLauncherController(Profile* profile, ash::ShelfModel* model);
129 ~ChromeLauncherController() override; 111 ~ChromeLauncherController() override;
130 112
131 // Initializes this ChromeLauncherController. 113 // Initializes this ChromeLauncherController.
132 void Init(); 114 void Init();
133 115
134 // Creates an instance. 116 // Creates an instance.
135 static ChromeLauncherController* CreateInstance(Profile* profile, 117 static ChromeLauncherController* CreateInstance(Profile* profile,
136 ash::ShelfModel* model); 118 ash::ShelfModel* model);
137 119
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 458
477 // Create ShelfItem for Browser Shortcut. 459 // Create ShelfItem for Browser Shortcut.
478 ash::ShelfID CreateBrowserShortcutLauncherItem(); 460 ash::ShelfID CreateBrowserShortcutLauncherItem();
479 461
480 // Check if the given |web_contents| is in incognito mode. 462 // Check if the given |web_contents| is in incognito mode.
481 bool IsIncognito(const content::WebContents* web_contents) const; 463 bool IsIncognito(const content::WebContents* web_contents) const;
482 464
483 // Update browser shortcut's index. 465 // Update browser shortcut's index.
484 void PersistChromeItemIndex(int index); 466 void PersistChromeItemIndex(int index);
485 467
486 // Get browser shortcut's index from pref.
487 int GetChromeIconIndexFromPref() const;
488
489 // Depending on the provided flags, move either the chrome icon, the app icon 468 // Depending on the provided flags, move either the chrome icon, the app icon
490 // or none to the given |target_index|. The provided |chrome_index| and 469 // or none to the given |target_index|. The provided |chrome_index| and
491 // |app_list_index| locations will get adjusted within this call to finalize 470 // |app_list_index| locations will get adjusted within this call to finalize
492 // the action and to make sure that the other item can still be moved 471 // the action and to make sure that the other item can still be moved
493 // afterwards (index adjustments). 472 // afterwards (index adjustments).
494 void MoveChromeOrApplistToFinalPosition( 473 void MoveChromeOrApplistToFinalPosition(
495 bool is_chrome, 474 bool is_chrome,
496 bool is_app_list, 475 bool is_app_list,
497 int target_index, 476 int target_index,
498 int* chrome_index, 477 int* chrome_index,
499 int* app_list_index); 478 int* app_list_index);
500 479
501 // Finds the index of where to insert the next item. 480 // Finds the index of where to insert the next item.
502 int FindInsertionPoint(bool is_app_list); 481 int FindInsertionPoint(bool is_app_list);
503 482
504 // Get the browser shortcut's index in the shelf using the current's systems 483 // Get the browser shortcut's index in the shelf using the current's systems
505 // configuration of pinned and known (but not running) apps. 484 // configuration of pinned and known (but not running) apps.
506 int GetChromeIconIndexForCreation(); 485 int GetChromeIconIndexForCreation();
507 486
508 // Get the list of pinned programs from the preferences.
509 std::vector<std::string> GetListOfPinnedAppsAndBrowser();
510
511 // Close all windowed V1 applications of a certain extension which was already 487 // Close all windowed V1 applications of a certain extension which was already
512 // deleted. 488 // deleted.
513 void CloseWindowedAppsFromRemovedExtension(const std::string& app_id, 489 void CloseWindowedAppsFromRemovedExtension(const std::string& app_id,
514 const Profile* profile); 490 const Profile* profile);
515 491
516 // Set ShelfItemDelegate |item_delegate| for |id| and take an ownership. 492 // Set ShelfItemDelegate |item_delegate| for |id| and take an ownership.
517 // TODO(simon.hong81): Make this take a scoped_ptr of |item_delegate|. 493 // TODO(simon.hong81): Make this take a scoped_ptr of |item_delegate|.
518 void SetShelfItemDelegate(ash::ShelfID id, 494 void SetShelfItemDelegate(ash::ShelfID id,
519 ash::ShelfItemDelegate* item_delegate); 495 ash::ShelfItemDelegate* item_delegate);
520 496
(...skipping 21 matching lines...) Expand all
542 // Direct access to app_id for a web contents. 518 // Direct access to app_id for a web contents.
543 WebContentsToAppIDMap web_contents_to_app_id_; 519 WebContentsToAppIDMap web_contents_to_app_id_;
544 520
545 // Used to track app windows. 521 // Used to track app windows.
546 std::vector<std::unique_ptr<AppWindowLauncherController>> 522 std::vector<std::unique_ptr<AppWindowLauncherController>>
547 app_window_controllers_; 523 app_window_controllers_;
548 524
549 // Used to get app info for tabs. 525 // Used to get app info for tabs.
550 std::unique_ptr<AppTabHelper> app_tab_helper_; 526 std::unique_ptr<AppTabHelper> app_tab_helper_;
551 527
552 // Used to load the image for an extension app item. 528 // Used to load the images for app items.
553 std::vector<std::unique_ptr<AppIconLoader>> app_icon_loaders_; 529 std::vector<std::unique_ptr<AppIconLoader>> app_icon_loaders_;
554 530
555 // Used to handle app load/unload events. 531 // Used to handle app load/unload events.
556 std::vector<std::unique_ptr<LauncherAppUpdater>> app_updaters_; 532 std::vector<std::unique_ptr<LauncherAppUpdater>> app_updaters_;
557 533
558 PrefChangeRegistrar pref_change_registrar_; 534 PrefChangeRegistrar pref_change_registrar_;
559 535
560 AppSyncUIState* app_sync_ui_state_; 536 AppSyncUIState* app_sync_ui_state_;
561 537
562 std::unique_ptr<ExtensionEnableFlow> extension_enable_flow_; 538 std::unique_ptr<ExtensionEnableFlow> extension_enable_flow_;
(...skipping 13 matching lines...) Expand all
576 // The list of running & un-pinned applications for different users on hidden 552 // The list of running & un-pinned applications for different users on hidden
577 // desktops. 553 // desktops.
578 typedef std::vector<std::string> RunningAppListIds; 554 typedef std::vector<std::string> RunningAppListIds;
579 typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap; 555 typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap;
580 RunningAppListIdMap last_used_running_application_order_; 556 RunningAppListIdMap last_used_running_application_order_;
581 557
582 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); 558 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController);
583 }; 559 };
584 560
585 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ 561 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698