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

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

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

Powered by Google App Engine
This is Rietveld 408576698