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_IMPL_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_IMPL_H_ |
6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_IMPL_H_ | 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_IMPL_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
11 #include "ash/common/shelf/shelf_delegate.h" | 11 #include "ash/common/shelf/shelf_delegate.h" |
12 #include "ash/common/shelf/shelf_model_observer.h" | 12 #include "ash/common/shelf/shelf_model_observer.h" |
13 #include "ash/display/window_tree_host_manager.h" | 13 #include "ash/display/window_tree_host_manager.h" |
14 #include "ash/public/cpp/shelf_types.h" | 14 #include "ash/public/cpp/shelf_types.h" |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
19 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" | 19 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" |
20 #include "chrome/browser/ui/ash/app_sync_ui_state_observer.h" | 20 #include "chrome/browser/ui/ash/app_sync_ui_state_observer.h" |
| 21 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" |
21 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 22 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
22 #include "chrome/browser/ui/ash/launcher/launcher_app_updater.h" | 23 #include "chrome/browser/ui/ash/launcher/launcher_app_updater.h" |
23 #include "components/prefs/pref_change_registrar.h" | 24 #include "components/prefs/pref_change_registrar.h" |
24 #include "ui/aura/window_observer.h" | 25 #include "ui/aura/window_observer.h" |
25 | 26 |
26 class AppSyncUIState; | 27 class AppSyncUIState; |
27 class BrowserStatusMonitor; | 28 class BrowserStatusMonitor; |
28 class Profile; | 29 class Profile; |
29 class AppWindowLauncherController; | 30 class AppWindowLauncherController; |
30 class TabContents; | 31 class TabContents; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 content::WebContents* web_contents) const override; | 120 content::WebContents* web_contents) const override; |
120 BrowserShortcutLauncherItemController* | 121 BrowserShortcutLauncherItemController* |
121 GetBrowserShortcutLauncherItemController() override; | 122 GetBrowserShortcutLauncherItemController() override; |
122 LauncherItemController* GetLauncherItemController( | 123 LauncherItemController* GetLauncherItemController( |
123 const ash::ShelfID id) override; | 124 const ash::ShelfID id) override; |
124 bool ShelfBoundsChangesProbablyWithUser( | 125 bool ShelfBoundsChangesProbablyWithUser( |
125 ash::WmShelf* shelf, | 126 ash::WmShelf* shelf, |
126 const AccountId& account_id) const override; | 127 const AccountId& account_id) const override; |
127 void OnUserProfileReadyToSwitch(Profile* profile) override; | 128 void OnUserProfileReadyToSwitch(Profile* profile) override; |
128 ArcAppDeferredLauncherController* GetArcDeferredLauncher() override; | 129 ArcAppDeferredLauncherController* GetArcDeferredLauncher() override; |
| 130 const std::string& GetLaunchIDForShelfID(ash::ShelfID id) override; |
129 void AttachProfile(Profile* profile_to_attach) override; | 131 void AttachProfile(Profile* profile_to_attach) override; |
130 | 132 |
131 // Access to the BrowserStatusMonitor for tests. | 133 // Access to the BrowserStatusMonitor for tests. |
132 BrowserStatusMonitor* browser_status_monitor_for_test() { | 134 BrowserStatusMonitor* browser_status_monitor_for_test() { |
133 return browser_status_monitor_.get(); | 135 return browser_status_monitor_.get(); |
134 } | 136 } |
135 | 137 |
136 // Access to the AppWindowLauncherController list for tests. | 138 // Access to the AppWindowLauncherController list for tests. |
137 const std::vector<std::unique_ptr<AppWindowLauncherController>>& | 139 const std::vector<std::unique_ptr<AppWindowLauncherController>>& |
138 app_window_controllers_for_test() { | 140 app_window_controllers_for_test() { |
(...skipping 15 matching lines...) Expand all Loading... |
154 void OnAppInstalled(content::BrowserContext* browser_context, | 156 void OnAppInstalled(content::BrowserContext* browser_context, |
155 const std::string& app_id) override; | 157 const std::string& app_id) override; |
156 void OnAppUpdated(content::BrowserContext* browser_context, | 158 void OnAppUpdated(content::BrowserContext* browser_context, |
157 const std::string& app_id) override; | 159 const std::string& app_id) override; |
158 void OnAppUninstalledPrepared(content::BrowserContext* browser_context, | 160 void OnAppUninstalledPrepared(content::BrowserContext* browser_context, |
159 const std::string& app_id) override; | 161 const std::string& app_id) override; |
160 | 162 |
161 protected: | 163 protected: |
162 // Creates a new app shortcut item and controller on the shelf at |index|. | 164 // Creates a new app shortcut item and controller on the shelf at |index|. |
163 // Use kInsertItemAtEnd to add a shortcut as the last item. | 165 // Use kInsertItemAtEnd to add a shortcut as the last item. |
164 ash::ShelfID CreateAppShortcutLauncherItem(const std::string& app_id, | 166 ash::ShelfID CreateAppShortcutLauncherItem( |
165 int index); | 167 const ash::launcher::AppLauncherId& app_launcher_id, |
| 168 int index); |
166 | 169 |
167 const std::string& GetAppIdFromShelfIdForTest(ash::ShelfID id); | 170 const std::string& GetAppIdFromShelfIdForTest(ash::ShelfID id); |
168 | 171 |
169 private: | 172 private: |
170 friend class ChromeLauncherControllerImplTest; | 173 friend class ChromeLauncherControllerImplTest; |
171 friend class ShelfAppBrowserTest; | 174 friend class ShelfAppBrowserTest; |
172 friend class LauncherPlatformAppBrowserTest; | 175 friend class LauncherPlatformAppBrowserTest; |
173 FRIEND_TEST_ALL_PREFIXES(ChromeLauncherControllerImplTest, AppPanels); | 176 FRIEND_TEST_ALL_PREFIXES(ChromeLauncherControllerImplTest, AppPanels); |
174 | 177 |
175 typedef std::map<ash::ShelfID, LauncherItemController*> IDToItemControllerMap; | 178 typedef std::map<ash::ShelfID, LauncherItemController*> IDToItemControllerMap; |
176 typedef std::map<content::WebContents*, std::string> WebContentsToAppIDMap; | 179 typedef std::map<content::WebContents*, std::string> WebContentsToAppIDMap; |
177 | 180 |
178 // Remembers / restores list of running applications. | 181 // Remembers / restores list of running applications. |
179 // Note that this order will neither be stored in the preference nor will it | 182 // Note that this order will neither be stored in the preference nor will it |
180 // remember the order of closed applications since it is only temporary. | 183 // remember the order of closed applications since it is only temporary. |
181 void RememberUnpinnedRunningApplicationOrder(); | 184 void RememberUnpinnedRunningApplicationOrder(); |
182 void RestoreUnpinnedRunningApplicationOrder(const std::string& user_id); | 185 void RestoreUnpinnedRunningApplicationOrder(const std::string& user_id); |
183 | 186 |
184 // Creates a new app shortcut item and controller on the shelf at |index|. | 187 // Creates a new app shortcut item and controller on the shelf at |index|. |
185 // Use kInsertItemAtEnd to add a shortcut as the last item. | 188 // Use kInsertItemAtEnd to add a shortcut as the last item. |
186 ash::ShelfID CreateAppShortcutLauncherItemWithType( | 189 ash::ShelfID CreateAppShortcutLauncherItemWithType( |
187 const std::string& app_id, | 190 const ash::launcher::AppLauncherId& app_launcher_id, |
188 int index, | 191 int index, |
189 ash::ShelfItemType shelf_item_type); | 192 ash::ShelfItemType shelf_item_type); |
190 | 193 |
191 // Invoked when the associated browser or app is closed. | 194 // Invoked when the associated browser or app is closed. |
192 void LauncherItemClosed(ash::ShelfID id); | 195 void LauncherItemClosed(ash::ShelfID id); |
193 | 196 |
194 // Internal helpers for pinning and unpinning that handle both | 197 // Internal helpers for pinning and unpinning that handle both |
195 // client-triggered and internal pinning operations. | 198 // client-triggered and internal pinning operations. |
196 void DoPinAppWithID(const std::string& app_id); | 199 void DoPinAppWithID(const std::string& app_id); |
197 void DoUnpinAppWithID(const std::string& app_id, bool update_prefs); | 200 void DoUnpinAppWithID(const std::string& app_id, bool update_prefs); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 typedef std::vector<std::string> RunningAppListIds; | 322 typedef std::vector<std::string> RunningAppListIds; |
320 typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap; | 323 typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap; |
321 RunningAppListIdMap last_used_running_application_order_; | 324 RunningAppListIdMap last_used_running_application_order_; |
322 | 325 |
323 base::WeakPtrFactory<ChromeLauncherControllerImpl> weak_ptr_factory_; | 326 base::WeakPtrFactory<ChromeLauncherControllerImpl> weak_ptr_factory_; |
324 | 327 |
325 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerImpl); | 328 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerImpl); |
326 }; | 329 }; |
327 | 330 |
328 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_IMPL_H_ | 331 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_IMPL_H_ |
OLD | NEW |