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

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

Issue 2790803002: mash: Remove V1 app shelf item locking; monitor running status instead. (Closed)
Patch Set: spelling 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // ChromeLauncherController: 63 // ChromeLauncherController:
64 ash::ShelfID CreateAppLauncherItem(LauncherItemController* controller, 64 ash::ShelfID CreateAppLauncherItem(LauncherItemController* controller,
65 ash::ShelfItemStatus status) override; 65 ash::ShelfItemStatus status) override;
66 const ash::ShelfItem* GetItem(ash::ShelfID id) const override; 66 const ash::ShelfItem* GetItem(ash::ShelfID id) const override;
67 void SetItemType(ash::ShelfID id, ash::ShelfItemType type) override; 67 void SetItemType(ash::ShelfID id, ash::ShelfItemType type) override;
68 void SetItemStatus(ash::ShelfID id, ash::ShelfItemStatus status) override; 68 void SetItemStatus(ash::ShelfID id, ash::ShelfItemStatus status) override;
69 void SetItemController(ash::ShelfID id, 69 void SetItemController(ash::ShelfID id,
70 LauncherItemController* controller) override; 70 LauncherItemController* controller) override;
71 void CloseLauncherItem(ash::ShelfID id) override; 71 void CloseLauncherItem(ash::ShelfID id) override;
72 bool IsPinned(ash::ShelfID id) override; 72 bool IsPinned(ash::ShelfID id) override;
73 void LockV1AppWithID(const std::string& app_id) override; 73 void SetV1AppStatus(const std::string& app_id,
74 void UnlockV1AppWithID(const std::string& app_id) override; 74 ash::ShelfItemStatus status) override;
75 void Launch(ash::ShelfID id, int event_flags) override; 75 void Launch(ash::ShelfID id, int event_flags) override;
76 void Close(ash::ShelfID id) override; 76 void Close(ash::ShelfID id) override;
77 bool IsOpen(ash::ShelfID id) override; 77 bool IsOpen(ash::ShelfID id) override;
78 bool IsPlatformApp(ash::ShelfID id) override; 78 bool IsPlatformApp(ash::ShelfID id) override;
79 void ActivateApp(const std::string& app_id, 79 void ActivateApp(const std::string& app_id,
80 ash::ShelfLaunchSource source, 80 ash::ShelfLaunchSource source,
81 int event_flags) override; 81 int event_flags) override;
82 void SetLauncherItemImage(ash::ShelfID shelf_id, 82 void SetLauncherItemImage(ash::ShelfID shelf_id,
83 const gfx::ImageSkia& image) override; 83 const gfx::ImageSkia& image) override;
84 void UpdateAppState(content::WebContents* contents, 84 void UpdateAppState(content::WebContents* contents,
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 void OnAppUpdated(content::BrowserContext* browser_context, 141 void OnAppUpdated(content::BrowserContext* browser_context,
142 const std::string& app_id) override; 142 const std::string& app_id) override;
143 void OnAppUninstalledPrepared(content::BrowserContext* browser_context, 143 void OnAppUninstalledPrepared(content::BrowserContext* browser_context,
144 const std::string& app_id) override; 144 const std::string& app_id) override;
145 145
146 protected: 146 protected:
147 // ChromeLauncherController: 147 // ChromeLauncherController:
148 void OnInit() override; 148 void OnInit() override;
149 149
150 // Creates a new app shortcut item and controller on the shelf at |index|. 150 // Creates a new app shortcut item and controller on the shelf at |index|.
151 // Use kInsertItemAtEnd to add a shortcut as the last item.
152 ash::ShelfID CreateAppShortcutLauncherItem( 151 ash::ShelfID CreateAppShortcutLauncherItem(
153 const ash::AppLaunchId& app_launch_id, 152 const ash::AppLaunchId& app_launch_id,
154 int index); 153 int index);
155 154
156 private: 155 private:
157 friend class ChromeLauncherControllerImplTest; 156 friend class ChromeLauncherControllerImplTest;
158 friend class ShelfAppBrowserTest; 157 friend class ShelfAppBrowserTest;
159 friend class LauncherPlatformAppBrowserTest; 158 friend class LauncherPlatformAppBrowserTest;
160 friend class TestChromeLauncherControllerImpl; 159 friend class TestChromeLauncherControllerImpl;
161 FRIEND_TEST_ALL_PREFIXES(ChromeLauncherControllerImplTest, AppPanels); 160 FRIEND_TEST_ALL_PREFIXES(ChromeLauncherControllerImplTest, AppPanels);
162 161
163 typedef std::map<ash::ShelfID, LauncherItemController*> IDToItemControllerMap; 162 typedef std::map<ash::ShelfID, LauncherItemController*> IDToItemControllerMap;
164 typedef std::map<content::WebContents*, std::string> WebContentsToAppIDMap; 163 typedef std::map<content::WebContents*, std::string> WebContentsToAppIDMap;
165 164
166 // Remembers / restores list of running applications. 165 // Remembers / restores list of running applications.
167 // Note that this order will neither be stored in the preference nor will it 166 // Note that this order will neither be stored in the preference nor will it
168 // remember the order of closed applications since it is only temporary. 167 // remember the order of closed applications since it is only temporary.
169 void RememberUnpinnedRunningApplicationOrder(); 168 void RememberUnpinnedRunningApplicationOrder();
170 void RestoreUnpinnedRunningApplicationOrder(const std::string& user_id); 169 void RestoreUnpinnedRunningApplicationOrder(const std::string& user_id);
171 170
172 // Creates a new app shortcut item and controller on the shelf at |index|.
173 // Use kInsertItemAtEnd to add a shortcut as the last item.
174 ash::ShelfID CreateAppShortcutLauncherItemWithType(
175 const ash::AppLaunchId& app_launch_id,
176 int index,
177 ash::ShelfItemType shelf_item_type);
178
179 // Invoked when the associated browser or app is closed. 171 // Invoked when the associated browser or app is closed.
180 void LauncherItemClosed(ash::ShelfID id); 172 void LauncherItemClosed(ash::ShelfID id);
181 173
182 // Internal helpers for pinning and unpinning that handle both 174 // Internal helpers for pinning and unpinning that handle both
183 // client-triggered and internal pinning operations. 175 // client-triggered and internal pinning operations.
184 void DoPinAppWithID(const std::string& app_id); 176 void DoPinAppWithID(const std::string& app_id);
185 void DoUnpinAppWithID(const std::string& app_id, bool update_prefs); 177 void DoUnpinAppWithID(const std::string& app_id, bool update_prefs);
186 178
187 // Pin a running app with |shelf_id| internally to |index|. 179 // Pin a running app with |shelf_id| internally to |index|.
188 void PinRunningAppInternal(int index, ash::ShelfID shelf_id); 180 void PinRunningAppInternal(int index, ash::ShelfID shelf_id);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 typedef std::vector<std::string> RunningAppListIds; 297 typedef std::vector<std::string> RunningAppListIds;
306 typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap; 298 typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap;
307 RunningAppListIdMap last_used_running_application_order_; 299 RunningAppListIdMap last_used_running_application_order_;
308 300
309 base::WeakPtrFactory<ChromeLauncherControllerImpl> weak_ptr_factory_; 301 base::WeakPtrFactory<ChromeLauncherControllerImpl> weak_ptr_factory_;
310 302
311 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerImpl); 303 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerImpl);
312 }; 304 };
313 305
314 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_IMPL_H_ 306 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698