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

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

Issue 2798173002: mash: Remove ChromeLauncherController's |id_to_item_controller_map_|. (Closed)
Patch Set: Address comment; fix browser tests. Created 3 years, 8 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_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
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 ChromeLauncherControllerImpl(Profile* profile, ash::ShelfModel* model); 60 ChromeLauncherControllerImpl(Profile* profile, ash::ShelfModel* model);
61 ~ChromeLauncherControllerImpl() override; 61 ~ChromeLauncherControllerImpl() override;
62 62
63 // ChromeLauncherController: 63 // ChromeLauncherController:
64 ash::ShelfID CreateAppLauncherItem( 64 ash::ShelfID CreateAppLauncherItem(
65 std::unique_ptr<ash::ShelfItemDelegate> item_delegate, 65 std::unique_ptr<ash::ShelfItemDelegate> item_delegate,
66 ash::ShelfItemStatus status) override; 66 ash::ShelfItemStatus status) override;
67 const ash::ShelfItem* GetItem(ash::ShelfID id) const override; 67 const ash::ShelfItem* GetItem(ash::ShelfID id) const override;
68 void SetItemType(ash::ShelfID id, ash::ShelfItemType type) override; 68 void SetItemType(ash::ShelfID id, ash::ShelfItemType type) override;
69 void SetItemStatus(ash::ShelfID id, ash::ShelfItemStatus status) override; 69 void SetItemStatus(ash::ShelfID id, ash::ShelfItemStatus status) override;
70 void SetShelfItemDelegate(
71 ash::ShelfID id,
72 std::unique_ptr<ash::ShelfItemDelegate> item_delegate) override;
73 void CloseLauncherItem(ash::ShelfID id) override; 70 void CloseLauncherItem(ash::ShelfID id) override;
74 bool IsPinned(ash::ShelfID id) override; 71 bool IsPinned(ash::ShelfID id) override;
75 void SetV1AppStatus(const std::string& app_id, 72 void SetV1AppStatus(const std::string& app_id,
76 ash::ShelfItemStatus status) override; 73 ash::ShelfItemStatus status) override;
77 void Launch(ash::ShelfID id, int event_flags) override; 74 void Launch(ash::ShelfID id, int event_flags) override;
78 void Close(ash::ShelfID id) override; 75 void Close(ash::ShelfID id) override;
79 bool IsOpen(ash::ShelfID id) override; 76 bool IsOpen(ash::ShelfID id) override;
80 bool IsPlatformApp(ash::ShelfID id) override; 77 bool IsPlatformApp(ash::ShelfID id) override;
81 void ActivateApp(const std::string& app_id, 78 void ActivateApp(const std::string& app_id,
82 ash::ShelfLaunchSource source, 79 ash::ShelfLaunchSource source,
(...skipping 17 matching lines...) Expand all
100 void ActivateShellApp(const std::string& app_id, int window_index) override; 97 void ActivateShellApp(const std::string& app_id, int window_index) override;
101 bool IsWebContentHandledByApplication(content::WebContents* web_contents, 98 bool IsWebContentHandledByApplication(content::WebContents* web_contents,
102 const std::string& app_id) override; 99 const std::string& app_id) override;
103 bool ContentCanBeHandledByGmailApp( 100 bool ContentCanBeHandledByGmailApp(
104 content::WebContents* web_contents) override; 101 content::WebContents* web_contents) override;
105 gfx::Image GetAppListIcon(content::WebContents* web_contents) const override; 102 gfx::Image GetAppListIcon(content::WebContents* web_contents) const override;
106 base::string16 GetAppListTitle( 103 base::string16 GetAppListTitle(
107 content::WebContents* web_contents) const override; 104 content::WebContents* web_contents) const override;
108 BrowserShortcutLauncherItemController* 105 BrowserShortcutLauncherItemController*
109 GetBrowserShortcutLauncherItemController() override; 106 GetBrowserShortcutLauncherItemController() override;
110 ash::ShelfItemDelegate* GetShelfItemDelegate(const ash::ShelfID id) override;
111 bool ShelfBoundsChangesProbablyWithUser( 107 bool ShelfBoundsChangesProbablyWithUser(
112 ash::WmShelf* shelf, 108 ash::WmShelf* shelf,
113 const AccountId& account_id) const override; 109 const AccountId& account_id) const override;
114 void OnUserProfileReadyToSwitch(Profile* profile) override; 110 void OnUserProfileReadyToSwitch(Profile* profile) override;
115 ArcAppDeferredLauncherController* GetArcDeferredLauncher() override; 111 ArcAppDeferredLauncherController* GetArcDeferredLauncher() override;
116 const std::string& GetLaunchIDForShelfID(ash::ShelfID id) override; 112 const std::string& GetLaunchIDForShelfID(ash::ShelfID id) override;
117 void AttachProfile(Profile* profile_to_attach) override; 113 void AttachProfile(Profile* profile_to_attach) override;
118 114
119 // Access to the BrowserStatusMonitor for tests. 115 // Access to the BrowserStatusMonitor for tests.
120 BrowserStatusMonitor* browser_status_monitor_for_test() { 116 BrowserStatusMonitor* browser_status_monitor_for_test() {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 const ash::AppLaunchId& app_launch_id, 150 const ash::AppLaunchId& app_launch_id,
155 int index); 151 int index);
156 152
157 private: 153 private:
158 friend class ChromeLauncherControllerImplTest; 154 friend class ChromeLauncherControllerImplTest;
159 friend class ShelfAppBrowserTest; 155 friend class ShelfAppBrowserTest;
160 friend class LauncherPlatformAppBrowserTest; 156 friend class LauncherPlatformAppBrowserTest;
161 friend class TestChromeLauncherControllerImpl; 157 friend class TestChromeLauncherControllerImpl;
162 FRIEND_TEST_ALL_PREFIXES(ChromeLauncherControllerImplTest, AppPanels); 158 FRIEND_TEST_ALL_PREFIXES(ChromeLauncherControllerImplTest, AppPanels);
163 159
164 typedef std::map<ash::ShelfID, ash::ShelfItemDelegate*> IDToItemControllerMap;
165 typedef std::map<content::WebContents*, std::string> WebContentsToAppIDMap; 160 typedef std::map<content::WebContents*, std::string> WebContentsToAppIDMap;
166 161
167 // Remembers / restores list of running applications. 162 // Remembers / restores list of running applications.
168 // Note that this order will neither be stored in the preference nor will it 163 // Note that this order will neither be stored in the preference nor will it
169 // remember the order of closed applications since it is only temporary. 164 // remember the order of closed applications since it is only temporary.
170 void RememberUnpinnedRunningApplicationOrder(); 165 void RememberUnpinnedRunningApplicationOrder();
171 void RestoreUnpinnedRunningApplicationOrder(const std::string& user_id); 166 void RestoreUnpinnedRunningApplicationOrder(const std::string& user_id);
172 167
173 // Invoked when the associated browser or app is closed. 168 // Invoked when the associated browser or app is closed.
174 void LauncherItemClosed(ash::ShelfID id); 169 void RemoveShelfItem(ash::ShelfID id);
175 170
176 // Internal helpers for pinning and unpinning that handle both 171 // Internal helpers for pinning and unpinning that handle both
177 // client-triggered and internal pinning operations. 172 // client-triggered and internal pinning operations.
178 void DoPinAppWithID(const std::string& app_id); 173 void DoPinAppWithID(const std::string& app_id);
179 void DoUnpinAppWithID(const std::string& app_id, bool update_prefs); 174 void DoUnpinAppWithID(const std::string& app_id, bool update_prefs);
180 175
181 // Pin a running app with |shelf_id| internally to |index|. 176 // Pin a running app with |shelf_id| internally to |index|.
182 void PinRunningAppInternal(int index, ash::ShelfID shelf_id); 177 void PinRunningAppInternal(int index, ash::ShelfID shelf_id);
183 178
184 // Unpin a locked application. This is an internal call which converts the 179 // Unpin a locked application. This is an internal call which converts the
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 const Profile* profile); 225 const Profile* profile);
231 226
232 // Forget the current profile to allow attaching to a new one. 227 // Forget the current profile to allow attaching to a new one.
233 void ReleaseProfile(); 228 void ReleaseProfile();
234 229
235 // ash::ShelfModelObserver: 230 // ash::ShelfModelObserver:
236 void ShelfItemAdded(int index) override; 231 void ShelfItemAdded(int index) override;
237 void ShelfItemRemoved(int index, const ash::ShelfItem& old_item) override; 232 void ShelfItemRemoved(int index, const ash::ShelfItem& old_item) override;
238 void ShelfItemMoved(int start_index, int target_index) override; 233 void ShelfItemMoved(int start_index, int target_index) override;
239 void ShelfItemChanged(int index, const ash::ShelfItem& old_item) override; 234 void ShelfItemChanged(int index, const ash::ShelfItem& old_item) override;
240 void OnSetShelfItemDelegate(ash::ShelfID id,
241 ash::ShelfItemDelegate* item_delegate) override;
242 235
243 // ash::WindowTreeHostManager::Observer: 236 // ash::WindowTreeHostManager::Observer:
244 void OnDisplayConfigurationChanged() override; 237 void OnDisplayConfigurationChanged() override;
245 238
246 // AppSyncUIStateObserver: 239 // AppSyncUIStateObserver:
247 void OnAppSyncUIStatusChanged() override; 240 void OnAppSyncUIStatusChanged() override;
248 241
249 // AppIconLoaderDelegate: 242 // AppIconLoaderDelegate:
250 void OnAppImageUpdated(const std::string& app_id, 243 void OnAppImageUpdated(const std::string& app_id,
251 const gfx::ImageSkia& image) override; 244 const gfx::ImageSkia& image) override;
252 245
253 // app_list::AppListSyncableService::Observer: 246 // app_list::AppListSyncableService::Observer:
254 void OnSyncModelUpdated() override; 247 void OnSyncModelUpdated() override;
255 248
256 // sync_preferences::PrefServiceSyncableObserver: 249 // sync_preferences::PrefServiceSyncableObserver:
257 void OnIsSyncingChanged() override; 250 void OnIsSyncingChanged() override;
258 251
259 // An internal helper to unpin a shelf item; this does not update prefs. 252 // An internal helper to unpin a shelf item; this does not update prefs.
260 void UnpinShelfItemInternal(ash::ShelfID id); 253 void UnpinShelfItemInternal(ash::ShelfID id);
261 254
262 ash::ShelfModel* model_; 255 ash::ShelfModel* model_;
263 256
264 // Controller items in this map are owned by |ShelfModel|.
265 IDToItemControllerMap id_to_item_controller_map_;
266
267 // Direct access to app_id for a web contents. 257 // Direct access to app_id for a web contents.
268 WebContentsToAppIDMap web_contents_to_app_id_; 258 WebContentsToAppIDMap web_contents_to_app_id_;
269 259
270 // Used to track app windows. 260 // Used to track app windows.
271 std::vector<std::unique_ptr<AppWindowLauncherController>> 261 std::vector<std::unique_ptr<AppWindowLauncherController>>
272 app_window_controllers_; 262 app_window_controllers_;
273 263
274 // Used to handle app load/unload events. 264 // Used to handle app load/unload events.
275 std::vector<std::unique_ptr<LauncherAppUpdater>> app_updaters_; 265 std::vector<std::unique_ptr<LauncherAppUpdater>> app_updaters_;
276 266
(...skipping 17 matching lines...) Expand all
294 typedef std::vector<std::string> RunningAppListIds; 284 typedef std::vector<std::string> RunningAppListIds;
295 typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap; 285 typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap;
296 RunningAppListIdMap last_used_running_application_order_; 286 RunningAppListIdMap last_used_running_application_order_;
297 287
298 base::WeakPtrFactory<ChromeLauncherControllerImpl> weak_ptr_factory_; 288 base::WeakPtrFactory<ChromeLauncherControllerImpl> weak_ptr_factory_;
299 289
300 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerImpl); 290 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerImpl);
301 }; 291 };
302 292
303 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_IMPL_H_ 293 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698