| 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/chrome_launcher_prefs.h" |
| 22 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 22 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 23 #include "chrome/browser/ui/ash/launcher/launcher_app_updater.h" | 23 #include "chrome/browser/ui/ash/launcher/launcher_app_updater.h" |
| 24 #include "components/prefs/pref_change_registrar.h" | 24 #include "components/prefs/pref_change_registrar.h" |
| 25 #include "components/sync_preferences/pref_service_syncable_observer.h" |
| 25 #include "ui/aura/window_observer.h" | 26 #include "ui/aura/window_observer.h" |
| 26 | 27 |
| 27 class AppSyncUIState; | 28 class AppSyncUIState; |
| 28 class BrowserStatusMonitor; | 29 class BrowserStatusMonitor; |
| 29 class Profile; | 30 class Profile; |
| 30 class AppWindowLauncherController; | 31 class AppWindowLauncherController; |
| 31 | 32 |
| 32 namespace ash { | 33 namespace ash { |
| 33 class ShelfModel; | 34 class ShelfModel; |
| 34 namespace launcher { | 35 namespace launcher { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 46 // In addition to implementing ChromeLauncherController, this class performs | 47 // In addition to implementing ChromeLauncherController, this class performs |
| 47 // a lot of other responsibilities, such as implementing ash::ShelfDelegate, | 48 // a lot of other responsibilities, such as implementing ash::ShelfDelegate, |
| 48 // updating the UI state and the shelf model when apps are uninstalled, etc. | 49 // updating the UI state and the shelf model when apps are uninstalled, etc. |
| 49 class ChromeLauncherControllerImpl | 50 class ChromeLauncherControllerImpl |
| 50 : public ChromeLauncherController, | 51 : public ChromeLauncherController, |
| 51 public ash::ShelfDelegate, | 52 public ash::ShelfDelegate, |
| 52 public LauncherAppUpdater::Delegate, | 53 public LauncherAppUpdater::Delegate, |
| 53 private ash::ShelfModelObserver, | 54 private ash::ShelfModelObserver, |
| 54 private ash::WindowTreeHostManager::Observer, | 55 private ash::WindowTreeHostManager::Observer, |
| 55 private AppSyncUIStateObserver, | 56 private AppSyncUIStateObserver, |
| 56 private app_list::AppListSyncableService::Observer { | 57 private app_list::AppListSyncableService::Observer, |
| 58 private sync_preferences::PrefServiceSyncableObserver { |
| 57 public: | 59 public: |
| 58 ChromeLauncherControllerImpl(Profile* profile, ash::ShelfModel* model); | 60 ChromeLauncherControllerImpl(Profile* profile, ash::ShelfModel* model); |
| 59 ~ChromeLauncherControllerImpl() override; | 61 ~ChromeLauncherControllerImpl() override; |
| 60 | 62 |
| 61 // ChromeLauncherController: | 63 // ChromeLauncherController: |
| 62 void Init() override; | 64 void Init() override; |
| 63 ash::ShelfID CreateAppLauncherItem(LauncherItemController* controller, | 65 ash::ShelfID CreateAppLauncherItem(LauncherItemController* controller, |
| 64 const std::string& app_id, | 66 const std::string& app_id, |
| 65 ash::ShelfItemStatus status) override; | 67 ash::ShelfItemStatus status) override; |
| 66 const ash::ShelfItem* GetItem(ash::ShelfID id) const override; | 68 const ash::ShelfItem* GetItem(ash::ShelfID id) const override; |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 // AppSyncUIStateObserver: | 260 // AppSyncUIStateObserver: |
| 259 void OnAppSyncUIStatusChanged() override; | 261 void OnAppSyncUIStatusChanged() override; |
| 260 | 262 |
| 261 // AppIconLoaderDelegate: | 263 // AppIconLoaderDelegate: |
| 262 void OnAppImageUpdated(const std::string& app_id, | 264 void OnAppImageUpdated(const std::string& app_id, |
| 263 const gfx::ImageSkia& image) override; | 265 const gfx::ImageSkia& image) override; |
| 264 | 266 |
| 265 // app_list::AppListSyncableService::Observer: | 267 // app_list::AppListSyncableService::Observer: |
| 266 void OnSyncModelUpdated() override; | 268 void OnSyncModelUpdated() override; |
| 267 | 269 |
| 270 // sync_preferences::PrefServiceSyncableObserver: |
| 271 void OnIsSyncingChanged() override; |
| 272 |
| 268 // Unpins shelf item and optionally updates pin prefs when |update_prefs| is | 273 // Unpins shelf item and optionally updates pin prefs when |update_prefs| is |
| 269 // set to true. | 274 // set to true. |
| 270 void UnpinAndUpdatePrefs(ash::ShelfID id, bool update_prefs); | 275 void UnpinAndUpdatePrefs(ash::ShelfID id, bool update_prefs); |
| 271 | 276 |
| 272 ash::ShelfModel* model_; | 277 ash::ShelfModel* model_; |
| 273 | 278 |
| 274 // Controller items in this map are owned by |ShelfModel|. | 279 // Controller items in this map are owned by |ShelfModel|. |
| 275 IDToItemControllerMap id_to_item_controller_map_; | 280 IDToItemControllerMap id_to_item_controller_map_; |
| 276 | 281 |
| 277 // Direct access to app_id for a web contents. | 282 // Direct access to app_id for a web contents. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 307 typedef std::vector<std::string> RunningAppListIds; | 312 typedef std::vector<std::string> RunningAppListIds; |
| 308 typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap; | 313 typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap; |
| 309 RunningAppListIdMap last_used_running_application_order_; | 314 RunningAppListIdMap last_used_running_application_order_; |
| 310 | 315 |
| 311 base::WeakPtrFactory<ChromeLauncherControllerImpl> weak_ptr_factory_; | 316 base::WeakPtrFactory<ChromeLauncherControllerImpl> weak_ptr_factory_; |
| 312 | 317 |
| 313 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerImpl); | 318 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerImpl); |
| 314 }; | 319 }; |
| 315 | 320 |
| 316 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_IMPL_H_ | 321 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_IMPL_H_ |
| OLD | NEW |