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

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

Issue 2791463002: mash: Remove ShelfDelegate; move functions to ShelfModel. (Closed)
Patch Set: Address comment. 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
11 #include "ash/display/window_tree_host_manager.h" 11 #include "ash/display/window_tree_host_manager.h"
12 #include "ash/public/cpp/shelf_types.h" 12 #include "ash/public/cpp/shelf_types.h"
13 #include "ash/shelf/shelf_delegate.h"
14 #include "ash/shelf/shelf_model_observer.h" 13 #include "ash/shelf/shelf_model_observer.h"
15 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
16 #include "base/macros.h" 15 #include "base/macros.h"
17 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
18 #include "build/build_config.h" 17 #include "build/build_config.h"
19 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" 18 #include "chrome/browser/ui/app_list/app_list_syncable_service.h"
20 #include "chrome/browser/ui/ash/app_sync_ui_state_observer.h" 19 #include "chrome/browser/ui/ash/app_sync_ui_state_observer.h"
21 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" 20 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h"
22 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 21 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
23 #include "chrome/browser/ui/ash/launcher/launcher_app_updater.h" 22 #include "chrome/browser/ui/ash/launcher/launcher_app_updater.h"
24 #include "components/prefs/pref_change_registrar.h" 23 #include "components/prefs/pref_change_registrar.h"
25 #include "components/sync_preferences/pref_service_syncable_observer.h" 24 #include "components/sync_preferences/pref_service_syncable_observer.h"
26 #include "ui/aura/window_observer.h" 25 #include "ui/aura/window_observer.h"
27 26
28 class AppSyncUIState; 27 class AppSyncUIState;
29 class BrowserStatusMonitor; 28 class BrowserStatusMonitor;
30 class Profile; 29 class Profile;
31 class AppWindowLauncherController; 30 class AppWindowLauncherController;
32 31
33 namespace ash { 32 namespace ash {
34 class ShelfModel; 33 class ShelfModel;
35 namespace launcher { 34 namespace launcher {
36 class ChromeLauncherPrefsObserver; 35 class ChromeLauncherPrefsObserver;
37 } 36 }
38 } 37 }
39 38
40 namespace content {
41 class BrowserContext;
42 }
43
44 class ChromeLauncherControllerUserSwitchObserver; 39 class ChromeLauncherControllerUserSwitchObserver;
45 40
46 // Implementation of ChromeLauncherController, used for classic Ash. 41 // Implementation of ChromeLauncherController, used for classic Ash.
47 // In addition to implementing ChromeLauncherController, this class performs 42 // This class manipulates Ash's ShelfModel to support Chrome and its apps.
48 // a lot of other responsibilities, such as implementing ash::ShelfDelegate,
49 // updating the UI state and the shelf model when apps are uninstalled, etc.
50 class ChromeLauncherControllerImpl 43 class ChromeLauncherControllerImpl
51 : public ChromeLauncherController, 44 : public ChromeLauncherController,
52 public ash::ShelfDelegate,
53 public LauncherAppUpdater::Delegate, 45 public LauncherAppUpdater::Delegate,
54 private ash::ShelfModelObserver, 46 private ash::ShelfModelObserver,
55 private ash::WindowTreeHostManager::Observer, 47 private ash::WindowTreeHostManager::Observer,
56 private AppSyncUIStateObserver, 48 private AppSyncUIStateObserver,
57 private app_list::AppListSyncableService::Observer, 49 private app_list::AppListSyncableService::Observer,
58 private sync_preferences::PrefServiceSyncableObserver { 50 private sync_preferences::PrefServiceSyncableObserver {
59 public: 51 public:
60 ChromeLauncherControllerImpl(Profile* profile, ash::ShelfModel* model); 52 ChromeLauncherControllerImpl(Profile* profile, ash::ShelfModel* model);
61 ~ChromeLauncherControllerImpl() override; 53 ~ChromeLauncherControllerImpl() override;
62 54
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 BrowserStatusMonitor* browser_status_monitor_for_test() { 108 BrowserStatusMonitor* browser_status_monitor_for_test() {
117 return browser_status_monitor_.get(); 109 return browser_status_monitor_.get();
118 } 110 }
119 111
120 // Access to the AppWindowLauncherController list for tests. 112 // Access to the AppWindowLauncherController list for tests.
121 const std::vector<std::unique_ptr<AppWindowLauncherController>>& 113 const std::vector<std::unique_ptr<AppWindowLauncherController>>&
122 app_window_controllers_for_test() { 114 app_window_controllers_for_test() {
123 return app_window_controllers_; 115 return app_window_controllers_;
124 } 116 }
125 117
126 // ash::ShelfDelegate: 118 // Helpers that call through to corresponding ShelfModel functions.
127 ash::ShelfID GetShelfIDForAppID(const std::string& app_id) override; 119 ash::ShelfID GetShelfIDForAppID(const std::string& app_id);
128 ash::ShelfID GetShelfIDForAppIDAndLaunchID( 120 ash::ShelfID GetShelfIDForAppIDAndLaunchID(const std::string& app_id,
129 const std::string& app_id, 121 const std::string& launch_id);
130 const std::string& launch_id) override; 122 const std::string& GetAppIDForShelfID(ash::ShelfID id);
131 const std::string& GetAppIDForShelfID(ash::ShelfID id) override; 123 void PinAppWithID(const std::string& app_id);
132 void PinAppWithID(const std::string& app_id) override; 124 bool IsAppPinned(const std::string& app_id);
133 bool IsAppPinned(const std::string& app_id) override; 125 void UnpinAppWithID(const std::string& app_id);
134 void UnpinAppWithID(const std::string& app_id) override;
135 126
136 // LauncherAppUpdater::Delegate: 127 // LauncherAppUpdater::Delegate:
137 void OnAppInstalled(content::BrowserContext* browser_context, 128 void OnAppInstalled(content::BrowserContext* browser_context,
138 const std::string& app_id) override; 129 const std::string& app_id) override;
139 void OnAppUpdated(content::BrowserContext* browser_context, 130 void OnAppUpdated(content::BrowserContext* browser_context,
140 const std::string& app_id) override; 131 const std::string& app_id) override;
141 void OnAppUninstalledPrepared(content::BrowserContext* browser_context, 132 void OnAppUninstalledPrepared(content::BrowserContext* browser_context,
142 const std::string& app_id) override; 133 const std::string& app_id) override;
143 134
144 protected: 135 protected:
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 typedef std::vector<std::string> RunningAppListIds; 275 typedef std::vector<std::string> RunningAppListIds;
285 typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap; 276 typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap;
286 RunningAppListIdMap last_used_running_application_order_; 277 RunningAppListIdMap last_used_running_application_order_;
287 278
288 base::WeakPtrFactory<ChromeLauncherControllerImpl> weak_ptr_factory_; 279 base::WeakPtrFactory<ChromeLauncherControllerImpl> weak_ptr_factory_;
289 280
290 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerImpl); 281 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerImpl);
291 }; 282 };
292 283
293 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_IMPL_H_ 284 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698