Chromium Code Reviews| 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 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 | 50 |
| 51 class ChromeLauncherControllerUserSwitchObserver; | 51 class ChromeLauncherControllerUserSwitchObserver; |
| 52 | 52 |
| 53 // Implementation of ChromeLauncherController, used for classic Ash. | 53 // Implementation of ChromeLauncherController, used for classic Ash. |
| 54 // In addition to implementing ChromeLauncherController, this class performs | 54 // In addition to implementing ChromeLauncherController, this class performs |
| 55 // a lot of other responsibilities, such as implementing ash::ShelfDelegate, | 55 // a lot of other responsibilities, such as implementing ash::ShelfDelegate, |
| 56 // updating the UI state and the shelf model when apps are uninstalled, etc. | 56 // updating the UI state and the shelf model when apps are uninstalled, etc. |
| 57 class ChromeLauncherControllerImpl | 57 class ChromeLauncherControllerImpl |
| 58 : public ChromeLauncherController, | 58 : public ChromeLauncherController, |
| 59 public ash::ShelfDelegate, | 59 public ash::ShelfDelegate, |
| 60 public ash::ShelfModelObserver, | 60 private ash::ShelfModelObserver, |
| 61 public ash::WindowTreeHostManager::Observer, | 61 private ash::WindowTreeHostManager::Observer, |
| 62 public AppIconLoaderDelegate, | 62 private AppIconLoaderDelegate, |
| 63 public AppSyncUIStateObserver, | 63 private AppSyncUIStateObserver, |
| 64 public LauncherAppUpdater::Delegate, | 64 private LauncherAppUpdater::Delegate, |
| 65 public ash::ShelfItemDelegateManagerObserver { | 65 private ash::ShelfItemDelegateManagerObserver { |
| 66 public: | 66 public: |
| 67 ChromeLauncherControllerImpl(Profile* profile, ash::ShelfModel* model); | 67 ChromeLauncherControllerImpl(Profile* profile, ash::ShelfModel* model); |
| 68 ~ChromeLauncherControllerImpl() override; | 68 ~ChromeLauncherControllerImpl() override; |
| 69 | 69 |
| 70 // Create ChromeLauncherControllerImpl instance and set is as the | 70 // Create ChromeLauncherControllerImpl instance and set is as the |
| 71 // ChromeLauncherController singleton. | 71 // ChromeLauncherController singleton. |
| 72 static ChromeLauncherControllerImpl* CreateInstance(Profile* profile, | 72 static ChromeLauncherControllerImpl* CreateInstance(Profile* profile, |
| 73 ash::ShelfModel* model); | 73 ash::ShelfModel* model); |
| 74 | 74 |
| 75 // ChromeLauncherController: | 75 // ChromeLauncherController: |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 void OnShelfAutoHideBehaviorChanged(ash::Shelf* shelf) override; | 160 void OnShelfAutoHideBehaviorChanged(ash::Shelf* shelf) override; |
| 161 void OnShelfAutoHideStateChanged(ash::Shelf* shelf) override; | 161 void OnShelfAutoHideStateChanged(ash::Shelf* shelf) override; |
| 162 void OnShelfVisibilityStateChanged(ash::Shelf* shelf) override; | 162 void OnShelfVisibilityStateChanged(ash::Shelf* shelf) override; |
| 163 ash::ShelfID GetShelfIDForAppID(const std::string& app_id) override; | 163 ash::ShelfID GetShelfIDForAppID(const std::string& app_id) override; |
| 164 bool HasShelfIDToAppIDMapping(ash::ShelfID id) const override; | 164 bool HasShelfIDToAppIDMapping(ash::ShelfID id) const override; |
| 165 const std::string& GetAppIDForShelfID(ash::ShelfID id) override; | 165 const std::string& GetAppIDForShelfID(ash::ShelfID id) override; |
| 166 void PinAppWithID(const std::string& app_id) override; | 166 void PinAppWithID(const std::string& app_id) override; |
| 167 bool IsAppPinned(const std::string& app_id) override; | 167 bool IsAppPinned(const std::string& app_id) override; |
| 168 void UnpinAppWithID(const std::string& app_id) override; | 168 void UnpinAppWithID(const std::string& app_id) override; |
| 169 | 169 |
| 170 // ash::ShelfItemDelegateManagerObserver: | |
| 171 void OnSetShelfItemDelegate(ash::ShelfID id, | |
| 172 ash::ShelfItemDelegate* item_delegate) override; | |
| 173 | |
| 174 // ash::ShelfModelObserver: | |
| 175 void ShelfItemAdded(int index) override; | |
| 176 void ShelfItemRemoved(int index, ash::ShelfID id) override; | |
| 177 void ShelfItemMoved(int start_index, int target_index) override; | |
| 178 void ShelfItemChanged(int index, const ash::ShelfItem& old_item) override; | |
| 179 | |
| 180 // ash::WindowTreeHostManager::Observer: | |
| 181 void OnDisplayConfigurationChanged() override; | |
| 182 | |
| 183 // LauncherAppUpdater: | 170 // LauncherAppUpdater: |
|
msw
2016/06/13 20:54:16
Shouldn't this also be private to match the base c
mfomitchev
2016/06/13 20:58:33
Changes inheritance of LauncherAppUpdater::Delegat
| |
| 184 void OnAppInstalled(content::BrowserContext* browser_context, | 171 void OnAppInstalled(content::BrowserContext* browser_context, |
| 185 const std::string& app_id) override; | 172 const std::string& app_id) override; |
| 186 void OnAppUpdated(content::BrowserContext* browser_context, | 173 void OnAppUpdated(content::BrowserContext* browser_context, |
| 187 const std::string& app_id) override; | 174 const std::string& app_id) override; |
| 188 void OnAppUninstalled(content::BrowserContext* browser_context, | 175 void OnAppUninstalled(content::BrowserContext* browser_context, |
| 189 const std::string& app_id) override; | 176 const std::string& app_id) override; |
| 190 | 177 |
| 191 // AppSyncUIStateObserver: | |
| 192 void OnAppSyncUIStatusChanged() override; | |
| 193 | |
| 194 // AppIconLoaderDelegate: | |
| 195 void OnAppImageUpdated(const std::string& app_id, | |
| 196 const gfx::ImageSkia& image) override; | |
| 197 | |
| 198 | |
| 199 | |
| 200 protected: | 178 protected: |
| 201 // Creates a new app shortcut item and controller on the shelf at |index|. | 179 // Creates a new app shortcut item and controller on the shelf at |index|. |
| 202 // Use kInsertItemAtEnd to add a shortcut as the last item. | 180 // Use kInsertItemAtEnd to add a shortcut as the last item. |
| 203 ash::ShelfID CreateAppShortcutLauncherItem(const std::string& app_id, | 181 ash::ShelfID CreateAppShortcutLauncherItem(const std::string& app_id, |
| 204 int index); | 182 int index); |
| 205 | 183 |
| 206 // Sets LauncherControllerHelper/AppIconLoader for test, taking ownership. | 184 // Sets LauncherControllerHelper/AppIconLoader for test, taking ownership. |
| 207 void SetLauncherControllerHelperForTest(LauncherControllerHelper* helper); | 185 void SetLauncherControllerHelperForTest(LauncherControllerHelper* helper); |
| 208 void SetAppIconLoadersForTest( | 186 void SetAppIconLoadersForTest( |
| 209 std::vector<std::unique_ptr<AppIconLoader>>& loaders); | 187 std::vector<std::unique_ptr<AppIconLoader>>& loaders); |
| 210 const std::string& GetAppIdFromShelfIdForTest(ash::ShelfID id); | 188 const std::string& GetAppIdFromShelfIdForTest(ash::ShelfID id); |
| 211 | 189 |
| 212 // Sets the ash::ShelfItemDelegateManager only for unittests and doesn't | 190 // Sets the ash::ShelfItemDelegateManager only for unittests and doesn't |
| 213 // take an ownership of it. | 191 // take an ownership of it. |
| 214 void SetShelfItemDelegateManagerForTest( | 192 void SetShelfItemDelegateManagerForTest( |
| 215 ash::ShelfItemDelegateManager* manager); | 193 ash::ShelfItemDelegateManager* manager); |
| 216 | 194 |
| 217 private: | 195 private: |
| 218 friend class ChromeLauncherControllerImplTest; | 196 friend class ChromeLauncherControllerImplTest; |
| 219 friend class ShelfAppBrowserTest; | 197 friend class ShelfAppBrowserTest; |
| 220 friend class LauncherPlatformAppBrowserTest; | 198 friend class LauncherPlatformAppBrowserTest; |
| 199 FRIEND_TEST_ALL_PREFIXES(ChromeLauncherControllerImplTest, AppPanels); | |
| 221 | 200 |
| 222 typedef std::map<ash::ShelfID, LauncherItemController*> IDToItemControllerMap; | 201 typedef std::map<ash::ShelfID, LauncherItemController*> IDToItemControllerMap; |
| 223 typedef std::map<content::WebContents*, std::string> WebContentsToAppIDMap; | 202 typedef std::map<content::WebContents*, std::string> WebContentsToAppIDMap; |
| 224 | 203 |
| 225 // Remembers / restores list of running applications. | 204 // Remembers / restores list of running applications. |
| 226 // Note that this order will neither be stored in the preference nor will it | 205 // Note that this order will neither be stored in the preference nor will it |
| 227 // remember the order of closed applications since it is only temporary. | 206 // remember the order of closed applications since it is only temporary. |
| 228 void RememberUnpinnedRunningApplicationOrder(); | 207 void RememberUnpinnedRunningApplicationOrder(); |
| 229 void RestoreUnpinnedRunningApplicationOrder(const std::string& user_id); | 208 void RestoreUnpinnedRunningApplicationOrder(const std::string& user_id); |
| 230 | 209 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 323 ash::ShelfItemDelegate* item_delegate); | 302 ash::ShelfItemDelegate* item_delegate); |
| 324 | 303 |
| 325 // Attach to a specific profile. | 304 // Attach to a specific profile. |
| 326 void AttachProfile(Profile* proifile); | 305 void AttachProfile(Profile* proifile); |
| 327 | 306 |
| 328 // Forget the current profile to allow attaching to a new one. | 307 // Forget the current profile to allow attaching to a new one. |
| 329 void ReleaseProfile(); | 308 void ReleaseProfile(); |
| 330 | 309 |
| 331 AppIconLoader* GetAppIconLoaderForApp(const std::string& app_id); | 310 AppIconLoader* GetAppIconLoaderForApp(const std::string& app_id); |
| 332 | 311 |
| 312 // ash::ShelfItemDelegateManagerObserver: | |
| 313 void OnSetShelfItemDelegate(ash::ShelfID id, | |
| 314 ash::ShelfItemDelegate* item_delegate) override; | |
| 315 | |
| 316 // ash::ShelfModelObserver: | |
| 317 void ShelfItemAdded(int index) override; | |
| 318 void ShelfItemRemoved(int index, ash::ShelfID id) override; | |
| 319 void ShelfItemMoved(int start_index, int target_index) override; | |
| 320 void ShelfItemChanged(int index, const ash::ShelfItem& old_item) override; | |
| 321 | |
| 322 // ash::WindowTreeHostManager::Observer: | |
| 323 void OnDisplayConfigurationChanged() override; | |
| 324 | |
| 325 // AppSyncUIStateObserver: | |
| 326 void OnAppSyncUIStatusChanged() override; | |
| 327 | |
| 328 // AppIconLoaderDelegate: | |
| 329 void OnAppImageUpdated(const std::string& app_id, | |
| 330 const gfx::ImageSkia& image) override; | |
| 331 | |
| 333 ash::ShelfModel* model_; | 332 ash::ShelfModel* model_; |
| 334 | 333 |
| 335 ash::ShelfItemDelegateManager* item_delegate_manager_; | 334 ash::ShelfItemDelegateManager* item_delegate_manager_; |
| 336 | 335 |
| 337 // Profile used for prefs and loading extensions. This is NOT necessarily the | 336 // Profile used for prefs and loading extensions. This is NOT necessarily the |
| 338 // profile new windows are created with. | 337 // profile new windows are created with. |
| 339 Profile* profile_; | 338 Profile* profile_; |
| 340 | 339 |
| 341 // Controller items in this map are owned by |ShelfItemDelegateManager|. | 340 // Controller items in this map are owned by |ShelfItemDelegateManager|. |
| 342 IDToItemControllerMap id_to_item_controller_map_; | 341 IDToItemControllerMap id_to_item_controller_map_; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 378 // The list of running & un-pinned applications for different users on hidden | 377 // The list of running & un-pinned applications for different users on hidden |
| 379 // desktops. | 378 // desktops. |
| 380 typedef std::vector<std::string> RunningAppListIds; | 379 typedef std::vector<std::string> RunningAppListIds; |
| 381 typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap; | 380 typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap; |
| 382 RunningAppListIdMap last_used_running_application_order_; | 381 RunningAppListIdMap last_used_running_application_order_; |
| 383 | 382 |
| 384 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerImpl); | 383 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerImpl); |
| 385 }; | 384 }; |
| 386 | 385 |
| 387 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_IMPL_H_ | 386 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_IMPL_H_ |
| OLD | NEW |