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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 return app_window_controllers_; | 140 return app_window_controllers_; |
140 } | 141 } |
141 | 142 |
142 // ash::ShelfDelegate: | 143 // ash::ShelfDelegate: |
143 ash::ShelfID GetShelfIDForAppID(const std::string& app_id) override; | 144 ash::ShelfID GetShelfIDForAppID(const std::string& app_id) override; |
144 ash::ShelfID GetShelfIDForAppIDAndLaunchID( | 145 ash::ShelfID GetShelfIDForAppIDAndLaunchID( |
145 const std::string& app_id, | 146 const std::string& app_id, |
146 const std::string& launch_id) override; | 147 const std::string& launch_id) override; |
147 bool HasShelfIDToAppIDMapping(ash::ShelfID id) const override; | 148 bool HasShelfIDToAppIDMapping(ash::ShelfID id) const override; |
148 const std::string& GetAppIDForShelfID(ash::ShelfID id) override; | 149 const std::string& GetAppIDForShelfID(ash::ShelfID id) override; |
150 const std::string& GetLaunchIDForShelfID(ash::ShelfID id) override; | |
stevenjb
2016/10/21 21:40:40
I agree with James' earlier comment. We can make t
Andra Paraschiv
2016/10/24 08:26:16
Thank you for this, Steven, I moved it from ash de
| |
149 void PinAppWithID(const std::string& app_id) override; | 151 void PinAppWithID(const std::string& app_id) override; |
150 bool IsAppPinned(const std::string& app_id) override; | 152 bool IsAppPinned(const std::string& app_id) override; |
151 void UnpinAppWithID(const std::string& app_id) override; | 153 void UnpinAppWithID(const std::string& app_id) override; |
152 | 154 |
153 // LauncherAppUpdater::Delegate: | 155 // LauncherAppUpdater::Delegate: |
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 |