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

Side by Side Diff: ash/common/wm_shell.h

Issue 2738133003: Promotes a handful of members from WmShell to Shell (Closed)
Patch Set: merge Created 3 years, 9 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
« no previous file with comments | « ash/common/wm/overview/window_selector.cc ('k') | ash/common/wm_shell.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 ASH_COMMON_WM_SHELL_H_ 5 #ifndef ASH_COMMON_WM_SHELL_H_
6 #define ASH_COMMON_WM_SHELL_H_ 6 #define ASH_COMMON_WM_SHELL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <vector> 11 #include <vector>
12 12
13 #include "ash/ash_export.h" 13 #include "ash/ash_export.h"
14 #include "ash/common/metrics/gesture_action_type.h" 14 #include "ash/common/metrics/gesture_action_type.h"
15 #include "ash/common/metrics/user_metrics_action.h" 15 #include "ash/common/metrics/user_metrics_action.h"
16 #include "ash/common/session/session_state_observer.h" 16 #include "ash/common/session/session_state_observer.h"
17 #include "ash/common/wm/lock_state_observer.h" 17 #include "ash/common/wm/lock_state_observer.h"
18 #include "base/observer_list.h" 18 #include "base/observer_list.h"
19 #include "components/ui_devtools/devtools_server.h"
20 #include "ui/base/ui_base_types.h" 19 #include "ui/base/ui_base_types.h"
21 #include "ui/compositor/layer_type.h" 20 #include "ui/compositor/layer_type.h"
22 #include "ui/wm/public/activation_change_observer.h" 21 #include "ui/wm/public/activation_change_observer.h"
23 #include "ui/wm/public/window_types.h" 22 #include "ui/wm/public/window_types.h"
24 23
25 namespace app_list { 24 namespace app_list {
26 class AppList; 25 class AppList;
27 } 26 }
28 27
29 namespace base {
30 class SequencedWorkerPool;
31 }
32
33 namespace display { 28 namespace display {
34 class Display; 29 class Display;
35 class ManagedDisplayInfo; 30 class ManagedDisplayInfo;
36 } 31 }
37 32
38 namespace gfx { 33 namespace gfx {
39 class Insets; 34 class Insets;
40 class Point; 35 class Point;
41 } 36 }
42 37
43 namespace preferences { 38 namespace preferences {
44 class PrefClientStore; 39 class PrefClientStore;
45 } 40 }
46 41
47 namespace views { 42 namespace views {
48 class PointerWatcher; 43 class PointerWatcher;
49 enum class PointerWatcherEventTypes; 44 enum class PointerWatcherEventTypes;
50 } 45 }
51 46
52 namespace ash { 47 namespace ash {
53 class AcceleratorController; 48 class AcceleratorController;
54 class AccessibilityDelegate;
55 class BrightnessControlDelegate; 49 class BrightnessControlDelegate;
56 class CastConfigController; 50 class CastConfigController;
57 class FocusCycler; 51 class FocusCycler;
58 class ImmersiveContextAsh; 52 class ImmersiveContextAsh;
59 class ImmersiveFullscreenController; 53 class ImmersiveFullscreenController;
60 class KeyEventWatcher; 54 class KeyEventWatcher;
61 class KeyboardBrightnessControlDelegate; 55 class KeyboardBrightnessControlDelegate;
62 class KeyboardUI; 56 class KeyboardUI;
63 class LocaleNotificationController; 57 class LocaleNotificationController;
64 class LogoutConfirmationController; 58 class LogoutConfirmationController;
65 class MaximizeModeController; 59 class MaximizeModeController;
66 class MediaController; 60 class MediaController;
67 class MruWindowTracker; 61 class MruWindowTracker;
68 class NewWindowController; 62 class NewWindowController;
69 class PaletteDelegate;
70 class RootWindowController; 63 class RootWindowController;
71 class ScopedDisableInternalMouseAndKeyboard; 64 class ScopedDisableInternalMouseAndKeyboard;
72 class SessionController; 65 class SessionController;
73 class SessionStateDelegate; 66 class SessionStateDelegate;
74 class ShelfController; 67 class ShelfController;
75 class ShelfDelegate; 68 class ShelfDelegate;
76 class ShelfModel; 69 class ShelfModel;
77 class ShelfWindowWatcher; 70 class ShelfWindowWatcher;
78 class ShellDelegate; 71 class ShellDelegate;
79 struct ShellInitParams; 72 struct ShellInitParams;
80 class ShutdownController; 73 class ShutdownController;
81 class SystemTrayDelegate; 74 class SystemTrayDelegate;
82 class SystemTrayController; 75 class SystemTrayController;
83 class SystemTrayNotifier; 76 class SystemTrayNotifier;
84 class ToastManager;
85 class VpnList; 77 class VpnList;
86 class WallpaperController;
87 class WallpaperDelegate; 78 class WallpaperDelegate;
88 class WindowCycleController; 79 class WindowCycleController;
89 class WindowCycleEventFilter; 80 class WindowCycleEventFilter;
90 class WindowResizer; 81 class WindowResizer;
91 class WindowSelectorController; 82 class WindowSelectorController;
92 class WmDisplayObserver; 83 class WmDisplayObserver;
93 class WmWindow; 84 class WmWindow;
94 class WorkspaceEventHandler; 85 class WorkspaceEventHandler;
95 86
96 enum class LoginStatus; 87 enum class LoginStatus;
97 enum class TaskSwitchSource; 88 enum class TaskSwitchSource;
98 89
99 namespace wm { 90 namespace wm {
100 class MaximizeModeEventHandler; 91 class MaximizeModeEventHandler;
101 class WindowState; 92 class WindowState;
102 } 93 }
103 94
104 // Similar to ash::Shell. Eventually the two will be merged. 95 // Similar to ash::Shell. Eventually the two will be merged.
105 class ASH_EXPORT WmShell : public SessionStateObserver { 96 class ASH_EXPORT WmShell : public SessionStateObserver {
106 public: 97 public:
107 ~WmShell() override; 98 ~WmShell() override;
108 99
109 // This is necessary for a handful of places that is difficult to plumb 100 // This is necessary for a handful of places that is difficult to plumb
110 // through context. 101 // through context.
111 static void Set(WmShell* instance); 102 static void Set(WmShell* instance);
112 static WmShell* Get(); 103 static WmShell* Get();
113 static bool HasInstance() { return instance_ != nullptr; } 104 static bool HasInstance() { return instance_ != nullptr; }
114 105
115 virtual void Initialize(const scoped_refptr<base::SequencedWorkerPool>& pool);
116 virtual void Shutdown(); 106 virtual void Shutdown();
117 107
118 ShellDelegate* delegate() { return delegate_.get(); } 108 ShellDelegate* delegate() { return delegate_.get(); }
119 109
120 AcceleratorController* accelerator_controller() { 110 AcceleratorController* accelerator_controller() {
121 return accelerator_controller_.get(); 111 return accelerator_controller_.get();
122 } 112 }
123 113
124 AccessibilityDelegate* accessibility_delegate() {
125 return accessibility_delegate_.get();
126 }
127
128 app_list::AppList* app_list() { return app_list_.get(); } 114 app_list::AppList* app_list() { return app_list_.get(); }
129 115
130 BrightnessControlDelegate* brightness_control_delegate() { 116 BrightnessControlDelegate* brightness_control_delegate() {
131 return brightness_control_delegate_.get(); 117 return brightness_control_delegate_.get();
132 } 118 }
133 119
134 CastConfigController* cast_config() { return cast_config_.get(); } 120 CastConfigController* cast_config() { return cast_config_.get(); }
135 121
136 FocusCycler* focus_cycler() { return focus_cycler_.get(); } 122 FocusCycler* focus_cycler() { return focus_cycler_.get(); }
137 123
(...skipping 16 matching lines...) Expand all
154 } 140 }
155 141
156 MruWindowTracker* mru_window_tracker() { return mru_window_tracker_.get(); } 142 MruWindowTracker* mru_window_tracker() { return mru_window_tracker_.get(); }
157 143
158 MediaController* media_controller() { return media_controller_.get(); } 144 MediaController* media_controller() { return media_controller_.get(); }
159 145
160 NewWindowController* new_window_controller() { 146 NewWindowController* new_window_controller() {
161 return new_window_controller_.get(); 147 return new_window_controller_.get();
162 } 148 }
163 149
164 PaletteDelegate* palette_delegate() { return palette_delegate_.get(); }
165
166 preferences::PrefClientStore* pref_store() { return pref_store_.get(); } 150 preferences::PrefClientStore* pref_store() { return pref_store_.get(); }
167 151
168 SessionController* session_controller() { return session_controller_.get(); } 152 SessionController* session_controller() { return session_controller_.get(); }
169 153
170 ShelfController* shelf_controller() { return shelf_controller_.get(); } 154 ShelfController* shelf_controller() { return shelf_controller_.get(); }
171 155
172 ShelfDelegate* shelf_delegate() { return shelf_delegate_.get(); } 156 ShelfDelegate* shelf_delegate() { return shelf_delegate_.get(); }
173 157
174 ShelfModel* shelf_model(); 158 ShelfModel* shelf_model();
175 159
176 ShutdownController* shutdown_controller() { 160 ShutdownController* shutdown_controller() {
177 return shutdown_controller_.get(); 161 return shutdown_controller_.get();
178 } 162 }
179 163
180 SystemTrayController* system_tray_controller() { 164 SystemTrayController* system_tray_controller() {
181 return system_tray_controller_.get(); 165 return system_tray_controller_.get();
182 } 166 }
183 167
184 SystemTrayNotifier* system_tray_notifier() { 168 SystemTrayNotifier* system_tray_notifier() {
185 return system_tray_notifier_.get(); 169 return system_tray_notifier_.get();
186 } 170 }
187 171
188 SystemTrayDelegate* system_tray_delegate() { 172 SystemTrayDelegate* system_tray_delegate() {
189 return system_tray_delegate_.get(); 173 return system_tray_delegate_.get();
190 } 174 }
191 175
192 ToastManager* toast_manager() { return toast_manager_.get(); }
193
194 VpnList* vpn_list() { return vpn_list_.get(); } 176 VpnList* vpn_list() { return vpn_list_.get(); }
195 177
196 WallpaperController* wallpaper_controller() {
197 return wallpaper_controller_.get();
198 }
199
200 WallpaperDelegate* wallpaper_delegate() { return wallpaper_delegate_.get(); } 178 WallpaperDelegate* wallpaper_delegate() { return wallpaper_delegate_.get(); }
201 179
202 WindowCycleController* window_cycle_controller() { 180 WindowCycleController* window_cycle_controller() {
203 return window_cycle_controller_.get(); 181 return window_cycle_controller_.get();
204 } 182 }
205 183
206 WindowSelectorController* window_selector_controller() { 184 WindowSelectorController* window_selector_controller() {
207 return window_selector_controller_.get(); 185 return window_selector_controller_.get();
208 } 186 }
209 187
210 const scoped_refptr<base::SequencedWorkerPool>& blocking_pool() {
211 return blocking_pool_;
212 }
213
214 // Returns true when ash is running as a service_manager::Service. 188 // Returns true when ash is running as a service_manager::Service.
215 virtual bool IsRunningInMash() const = 0; 189 virtual bool IsRunningInMash() const = 0;
216 190
217 virtual WmWindow* GetFocusedWindow() = 0; 191 virtual WmWindow* GetFocusedWindow() = 0;
218 virtual WmWindow* GetActiveWindow() = 0; 192 virtual WmWindow* GetActiveWindow() = 0;
219 193
220 virtual WmWindow* GetCaptureWindow() = 0; 194 virtual WmWindow* GetCaptureWindow() = 0;
221 195
222 // Convenience for GetPrimaryRootWindow()->GetRootWindowController(). 196 // Convenience for GetPrimaryRootWindow()->GetRootWindowController().
223 RootWindowController* GetPrimaryRootWindowController(); 197 RootWindowController* GetPrimaryRootWindowController();
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 virtual void AddPointerWatcher(views::PointerWatcher* watcher, 340 virtual void AddPointerWatcher(views::PointerWatcher* watcher,
367 views::PointerWatcherEventTypes events) = 0; 341 views::PointerWatcherEventTypes events) = 0;
368 virtual void RemovePointerWatcher(views::PointerWatcher* watcher) = 0; 342 virtual void RemovePointerWatcher(views::PointerWatcher* watcher) = 0;
369 343
370 // TODO: Move these back to LockStateController when that has been moved. 344 // TODO: Move these back to LockStateController when that has been moved.
371 void OnLockStateEvent(LockStateObserver::EventType event); 345 void OnLockStateEvent(LockStateObserver::EventType event);
372 void AddLockStateObserver(LockStateObserver* observer); 346 void AddLockStateObserver(LockStateObserver* observer);
373 void RemoveLockStateObserver(LockStateObserver* observer); 347 void RemoveLockStateObserver(LockStateObserver* observer);
374 348
375 void SetShelfDelegateForTesting(std::unique_ptr<ShelfDelegate> test_delegate); 349 void SetShelfDelegateForTesting(std::unique_ptr<ShelfDelegate> test_delegate);
376 void SetPaletteDelegateForTesting(
377 std::unique_ptr<PaletteDelegate> palette_delegate);
378 350
379 // True if any touch points are down. 351 // True if any touch points are down.
380 virtual bool IsTouchDown() = 0; 352 virtual bool IsTouchDown() = 0;
381 353
382 // TODO(jamescook): Remove this when VirtualKeyboardController has been moved. 354 // TODO(jamescook): Remove this when VirtualKeyboardController has been moved.
383 virtual void ToggleIgnoreExternalKeyboard() = 0; 355 virtual void ToggleIgnoreExternalKeyboard() = 0;
384 356
385 // Enable or disable the laser pointer. 357 // Enable or disable the laser pointer.
386 virtual void SetLaserPointerEnabled(bool enabled) = 0; 358 virtual void SetLaserPointerEnabled(bool enabled) = 0;
387 359
(...skipping 20 matching lines...) Expand all
408 void DeleteWindowCycleController(); 380 void DeleteWindowCycleController();
409 381
410 void DeleteWindowSelectorController(); 382 void DeleteWindowSelectorController();
411 383
412 void CreateMaximizeModeController(); 384 void CreateMaximizeModeController();
413 void DeleteMaximizeModeController(); 385 void DeleteMaximizeModeController();
414 386
415 void CreateMruWindowTracker(); 387 void CreateMruWindowTracker();
416 void DeleteMruWindowTracker(); 388 void DeleteMruWindowTracker();
417 389
418 void DeleteToastManager();
419
420 void SetAcceleratorController( 390 void SetAcceleratorController(
421 std::unique_ptr<AcceleratorController> accelerator_controller); 391 std::unique_ptr<AcceleratorController> accelerator_controller);
422 392
423 // SessionStateObserver: 393 // SessionStateObserver:
424 void SessionStateChanged(session_manager::SessionState state) override; 394 void SessionStateChanged(session_manager::SessionState state) override;
425 395
426 private: 396 private:
427 friend class AcceleratorControllerTest; 397 friend class AcceleratorControllerTest;
428 friend class Shell; 398 friend class Shell;
429 friend class WmShellTestApi; 399 friend class WmShellTestApi;
430 400
431 static WmShell* instance_; 401 static WmShell* instance_;
432 402
433 std::unique_ptr<ShellDelegate> delegate_; 403 std::unique_ptr<ShellDelegate> delegate_;
434 404
435 scoped_refptr<preferences::PrefClientStore> pref_store_; 405 scoped_refptr<preferences::PrefClientStore> pref_store_;
436 406
437 std::unique_ptr<AcceleratorController> accelerator_controller_; 407 std::unique_ptr<AcceleratorController> accelerator_controller_;
438 std::unique_ptr<AccessibilityDelegate> accessibility_delegate_;
439 std::unique_ptr<app_list::AppList> app_list_; 408 std::unique_ptr<app_list::AppList> app_list_;
440 std::unique_ptr<BrightnessControlDelegate> brightness_control_delegate_; 409 std::unique_ptr<BrightnessControlDelegate> brightness_control_delegate_;
441 std::unique_ptr<CastConfigController> cast_config_; 410 std::unique_ptr<CastConfigController> cast_config_;
442 std::unique_ptr<FocusCycler> focus_cycler_; 411 std::unique_ptr<FocusCycler> focus_cycler_;
443 std::unique_ptr<ImmersiveContextAsh> immersive_context_; 412 std::unique_ptr<ImmersiveContextAsh> immersive_context_;
444 std::unique_ptr<KeyboardBrightnessControlDelegate> 413 std::unique_ptr<KeyboardBrightnessControlDelegate>
445 keyboard_brightness_control_delegate_; 414 keyboard_brightness_control_delegate_;
446 std::unique_ptr<KeyboardUI> keyboard_ui_; 415 std::unique_ptr<KeyboardUI> keyboard_ui_;
447 std::unique_ptr<LocaleNotificationController> locale_notification_controller_; 416 std::unique_ptr<LocaleNotificationController> locale_notification_controller_;
448 std::unique_ptr<LogoutConfirmationController> logout_confirmation_controller_; 417 std::unique_ptr<LogoutConfirmationController> logout_confirmation_controller_;
449 std::unique_ptr<MaximizeModeController> maximize_mode_controller_; 418 std::unique_ptr<MaximizeModeController> maximize_mode_controller_;
450 std::unique_ptr<MediaController> media_controller_; 419 std::unique_ptr<MediaController> media_controller_;
451 std::unique_ptr<MruWindowTracker> mru_window_tracker_; 420 std::unique_ptr<MruWindowTracker> mru_window_tracker_;
452 std::unique_ptr<NewWindowController> new_window_controller_; 421 std::unique_ptr<NewWindowController> new_window_controller_;
453 std::unique_ptr<PaletteDelegate> palette_delegate_;
454 std::unique_ptr<SessionController> session_controller_; 422 std::unique_ptr<SessionController> session_controller_;
455 std::unique_ptr<ShelfController> shelf_controller_; 423 std::unique_ptr<ShelfController> shelf_controller_;
456 std::unique_ptr<ShelfDelegate> shelf_delegate_; 424 std::unique_ptr<ShelfDelegate> shelf_delegate_;
457 std::unique_ptr<ShelfWindowWatcher> shelf_window_watcher_; 425 std::unique_ptr<ShelfWindowWatcher> shelf_window_watcher_;
458 std::unique_ptr<ShutdownController> shutdown_controller_; 426 std::unique_ptr<ShutdownController> shutdown_controller_;
459 std::unique_ptr<SystemTrayController> system_tray_controller_; 427 std::unique_ptr<SystemTrayController> system_tray_controller_;
460 std::unique_ptr<SystemTrayNotifier> system_tray_notifier_; 428 std::unique_ptr<SystemTrayNotifier> system_tray_notifier_;
461 std::unique_ptr<SystemTrayDelegate> system_tray_delegate_; 429 std::unique_ptr<SystemTrayDelegate> system_tray_delegate_;
462 std::unique_ptr<ToastManager> toast_manager_;
463 std::unique_ptr<VpnList> vpn_list_; 430 std::unique_ptr<VpnList> vpn_list_;
464 std::unique_ptr<WallpaperController> wallpaper_controller_;
465 std::unique_ptr<WallpaperDelegate> wallpaper_delegate_; 431 std::unique_ptr<WallpaperDelegate> wallpaper_delegate_;
466 std::unique_ptr<WindowCycleController> window_cycle_controller_; 432 std::unique_ptr<WindowCycleController> window_cycle_controller_;
467 std::unique_ptr<WindowSelectorController> window_selector_controller_; 433 std::unique_ptr<WindowSelectorController> window_selector_controller_;
468 std::unique_ptr<ui::devtools::UiDevToolsServer> devtools_server_;
469 434
470 base::ObserverList<LockStateObserver> lock_state_observers_; 435 base::ObserverList<LockStateObserver> lock_state_observers_;
471 436
472 bool simulate_modal_window_open_for_testing_ = false; 437 bool simulate_modal_window_open_for_testing_ = false;
473
474 scoped_refptr<base::SequencedWorkerPool> blocking_pool_;
475 }; 438 };
476 439
477 } // namespace ash 440 } // namespace ash
478 441
479 #endif // ASH_COMMON_WM_SHELL_H_ 442 #endif // ASH_COMMON_WM_SHELL_H_
OLDNEW
« no previous file with comments | « ash/common/wm/overview/window_selector.cc ('k') | ash/common/wm_shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698