OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_MUS_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_MUS_H_ |
6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_MUS_H_ | 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_MUS_H_ |
7 | 7 |
| 8 #include <map> |
8 #include <memory> | 9 #include <memory> |
| 10 #include <string> |
9 | 11 |
10 #include "base/macros.h" | 12 #include "base/macros.h" |
11 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 13 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
12 | 14 |
13 class ChromeMashShelfController; | 15 class ChromeShelfItemDelegate; |
14 | 16 |
15 class ChromeLauncherControllerMus : public ChromeLauncherController { | 17 class ChromeLauncherControllerMus : public ChromeLauncherController { |
16 public: | 18 public: |
17 // Create a ChromeLauncherControllerMus instance and set it as the | 19 // Create a ChromeLauncherControllerMus instance and set it as the |
18 // ChromeLauncherController singleton. | 20 // ChromeLauncherController singleton. |
19 static ChromeLauncherController* CreateInstance(); | 21 static ChromeLauncherController* CreateInstance(); |
20 | 22 |
21 ~ChromeLauncherControllerMus() override; | 23 ~ChromeLauncherControllerMus() override; |
22 | 24 |
23 // ChromeLauncherController: | 25 // ChromeLauncherController: |
24 void Init() override; | 26 void Init() override; |
25 ash::ShelfID CreateAppLauncherItem(LauncherItemController* controller, | 27 ash::ShelfID CreateAppLauncherItem(LauncherItemController* controller, |
26 const std::string& app_id, | 28 const std::string& app_id, |
27 ash::ShelfItemStatus status) override; | 29 ash::ShelfItemStatus status) override; |
28 void SetItemStatus(ash::ShelfID id, ash::ShelfItemStatus status) override; | 30 void SetItemStatus(ash::ShelfID id, ash::ShelfItemStatus status) override; |
29 void SetItemController(ash::ShelfID id, | 31 void SetItemController(ash::ShelfID id, |
30 LauncherItemController* controller) override; | 32 LauncherItemController* controller) override; |
31 void CloseLauncherItem(ash::ShelfID id) override; | 33 void CloseLauncherItem(ash::ShelfID id) override; |
32 void Pin(ash::ShelfID id) override; | 34 void Pin(ash::ShelfID id) override; |
33 void Unpin(ash::ShelfID id) override; | 35 void Unpin(ash::ShelfID id) override; |
34 bool IsPinned(ash::ShelfID id) override; | 36 bool IsPinned(ash::ShelfID id) override; |
35 void TogglePinned(ash::ShelfID id) override; | 37 void TogglePinned(ash::ShelfID id) override; |
36 bool IsPinnable(ash::ShelfID id) const override; | 38 bool IsPinnable(ash::ShelfID id) const override; |
37 void LockV1AppWithID(const std::string& app_id) override; | 39 void LockV1AppWithID(const std::string& app_id) override; |
38 void UnlockV1AppWithID(const std::string& app_id) override; | 40 void UnlockV1AppWithID(const std::string& app_id) override; |
39 void Launch(ash::ShelfID id, int event_flags) override; | 41 void Launch(ash::ShelfID id, int event_flags) override; |
40 void Close(ash::ShelfID id) override; | 42 void Close(ash::ShelfID id) override; |
41 bool IsOpen(ash::ShelfID id) override; | 43 bool IsOpen(ash::ShelfID id) override; |
42 bool IsPlatformApp(ash::ShelfID id) override; | 44 bool IsPlatformApp(ash::ShelfID id) override; |
43 void LaunchApp(const std::string& app_id, | |
44 ash::LaunchSource source, | |
45 int event_flags) override; | |
46 void ActivateApp(const std::string& app_id, | 45 void ActivateApp(const std::string& app_id, |
47 ash::LaunchSource source, | 46 ash::LaunchSource source, |
48 int event_flags) override; | 47 int event_flags) override; |
49 extensions::LaunchType GetLaunchType(ash::ShelfID id) override; | 48 extensions::LaunchType GetLaunchType(ash::ShelfID id) override; |
50 void SetLauncherItemImage(ash::ShelfID shelf_id, | 49 void SetLauncherItemImage(ash::ShelfID shelf_id, |
51 const gfx::ImageSkia& image) override; | 50 const gfx::ImageSkia& image) override; |
52 bool IsWindowedAppInLauncher(const std::string& app_id) override; | 51 bool IsWindowedAppInLauncher(const std::string& app_id) override; |
53 void SetLaunchType(ash::ShelfID id, | 52 void SetLaunchType(ash::ShelfID id, |
54 extensions::LaunchType launch_type) override; | 53 extensions::LaunchType launch_type) override; |
55 Profile* GetProfile() override; | |
56 void UpdateAppState(content::WebContents* contents, | 54 void UpdateAppState(content::WebContents* contents, |
57 AppState app_state) override; | 55 AppState app_state) override; |
58 ash::ShelfID GetShelfIDForWebContents( | 56 ash::ShelfID GetShelfIDForWebContents( |
59 content::WebContents* contents) override; | 57 content::WebContents* contents) override; |
60 void SetRefocusURLPatternForTest(ash::ShelfID id, const GURL& url) override; | 58 void SetRefocusURLPatternForTest(ash::ShelfID id, const GURL& url) override; |
61 ash::ShelfItemDelegate::PerformedAction ActivateWindowOrMinimizeIfActive( | 59 ash::ShelfItemDelegate::PerformedAction ActivateWindowOrMinimizeIfActive( |
62 ui::BaseWindow* window, | 60 ui::BaseWindow* window, |
63 bool allow_minimize) override; | 61 bool allow_minimize) override; |
64 void ActiveUserChanged(const std::string& user_email) override; | 62 void ActiveUserChanged(const std::string& user_email) override; |
65 void AdditionalUserAddedToSession(Profile* profile) override; | 63 void AdditionalUserAddedToSession(Profile* profile) override; |
(...skipping 12 matching lines...) Expand all Loading... |
78 BrowserShortcutLauncherItemController* | 76 BrowserShortcutLauncherItemController* |
79 GetBrowserShortcutLauncherItemController() override; | 77 GetBrowserShortcutLauncherItemController() override; |
80 LauncherItemController* GetLauncherItemController( | 78 LauncherItemController* GetLauncherItemController( |
81 const ash::ShelfID id) override; | 79 const ash::ShelfID id) override; |
82 bool ShelfBoundsChangesProbablyWithUser( | 80 bool ShelfBoundsChangesProbablyWithUser( |
83 ash::WmShelf* shelf, | 81 ash::WmShelf* shelf, |
84 const AccountId& account_id) const override; | 82 const AccountId& account_id) const override; |
85 void OnUserProfileReadyToSwitch(Profile* profile) override; | 83 void OnUserProfileReadyToSwitch(Profile* profile) override; |
86 ArcAppDeferredLauncherController* GetArcDeferredLauncher() override; | 84 ArcAppDeferredLauncherController* GetArcDeferredLauncher() override; |
87 | 85 |
| 86 // AppIconLoaderDelegate: |
| 87 void OnAppImageUpdated(const std::string& app_id, |
| 88 const gfx::ImageSkia& image) override; |
| 89 |
88 private: | 90 private: |
89 ChromeLauncherControllerMus(); | 91 ChromeLauncherControllerMus(); |
90 | 92 |
91 std::unique_ptr<ChromeMashShelfController> shelf_controller_; | 93 // Pin the items set in the current profile's preferences. |
| 94 void PinAppsFromPrefs(); |
| 95 |
| 96 std::map<std::string, std::unique_ptr<ChromeShelfItemDelegate>> |
| 97 app_id_to_item_delegate_; |
92 | 98 |
93 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerMus); | 99 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerMus); |
94 }; | 100 }; |
95 | 101 |
96 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_MUS_H_ | 102 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_MUS_H_ |
OLD | NEW |