OLD | NEW |
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" | |
17 #include "ash/common/wm/lock_state_observer.h" | 16 #include "ash/common/wm/lock_state_observer.h" |
18 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
19 #include "ui/base/ui_base_types.h" | 18 #include "ui/base/ui_base_types.h" |
20 #include "ui/compositor/layer_type.h" | 19 #include "ui/compositor/layer_type.h" |
21 #include "ui/wm/public/activation_change_observer.h" | 20 #include "ui/wm/public/activation_change_observer.h" |
22 #include "ui/wm/public/window_types.h" | 21 #include "ui/wm/public/window_types.h" |
23 | 22 |
24 namespace display { | 23 namespace display { |
25 class Display; | 24 class Display; |
26 class ManagedDisplayInfo; | 25 class ManagedDisplayInfo; |
27 } | 26 } |
28 | 27 |
29 namespace gfx { | 28 namespace gfx { |
30 class Insets; | 29 class Insets; |
31 class Point; | 30 class Point; |
32 } | 31 } |
33 | 32 |
34 namespace views { | 33 namespace views { |
35 class PointerWatcher; | 34 class PointerWatcher; |
36 enum class PointerWatcherEventTypes; | 35 enum class PointerWatcherEventTypes; |
37 } | 36 } |
38 | 37 |
39 namespace ash { | 38 namespace ash { |
40 class AcceleratorController; | 39 class AcceleratorController; |
41 class ImmersiveFullscreenController; | 40 class ImmersiveFullscreenController; |
42 class KeyEventWatcher; | 41 class KeyEventWatcher; |
43 class KeyboardUI; | 42 class KeyboardUI; |
44 class RootWindowController; | 43 class RootWindowController; |
45 class ScopedDisableInternalMouseAndKeyboard; | 44 class ScopedDisableInternalMouseAndKeyboard; |
46 class SessionController; | |
47 class SessionStateDelegate; | 45 class SessionStateDelegate; |
48 class ShelfController; | |
49 class ShelfDelegate; | |
50 class ShelfModel; | |
51 class ShelfWindowWatcher; | |
52 struct ShellInitParams; | 46 struct ShellInitParams; |
53 class ShutdownController; | 47 class ShutdownController; |
54 class SystemTrayNotifier; | 48 class SystemTrayNotifier; |
55 class VpnList; | 49 class VpnList; |
56 class WindowCycleController; | 50 class WindowCycleController; |
57 class WindowCycleEventFilter; | 51 class WindowCycleEventFilter; |
58 class WindowResizer; | 52 class WindowResizer; |
59 class WindowSelectorController; | 53 class WindowSelectorController; |
60 class WmDisplayObserver; | 54 class WmDisplayObserver; |
61 class WmWindow; | 55 class WmWindow; |
62 class WorkspaceEventHandler; | 56 class WorkspaceEventHandler; |
63 | 57 |
64 enum class LoginStatus; | 58 enum class LoginStatus; |
65 enum class TaskSwitchSource; | 59 enum class TaskSwitchSource; |
66 | 60 |
67 namespace wm { | 61 namespace wm { |
68 class MaximizeModeEventHandler; | 62 class MaximizeModeEventHandler; |
69 class WindowState; | 63 class WindowState; |
70 } | 64 } |
71 | 65 |
72 // Similar to ash::Shell. Eventually the two will be merged. | 66 // Similar to ash::Shell. Eventually the two will be merged. |
73 class ASH_EXPORT WmShell : public SessionStateObserver { | 67 class ASH_EXPORT WmShell { |
74 public: | 68 public: |
75 ~WmShell() override; | 69 virtual ~WmShell(); |
76 | 70 |
77 static WmShell* Get(); | 71 static WmShell* Get(); |
78 static bool HasInstance() { return instance_ != nullptr; } | 72 static bool HasInstance() { return instance_ != nullptr; } |
79 | 73 |
80 virtual void Shutdown(); | 74 virtual void Shutdown(); |
81 | 75 |
82 SessionController* session_controller() { return session_controller_.get(); } | |
83 | |
84 ShelfController* shelf_controller() { return shelf_controller_.get(); } | |
85 | |
86 ShelfDelegate* shelf_delegate() { return shelf_delegate_.get(); } | |
87 | |
88 ShelfModel* shelf_model(); | |
89 | |
90 ShutdownController* shutdown_controller() { | 76 ShutdownController* shutdown_controller() { |
91 return shutdown_controller_.get(); | 77 return shutdown_controller_.get(); |
92 } | 78 } |
93 | 79 |
94 SystemTrayNotifier* system_tray_notifier() { | 80 SystemTrayNotifier* system_tray_notifier() { |
95 return system_tray_notifier_.get(); | 81 return system_tray_notifier_.get(); |
96 } | 82 } |
97 | 83 |
98 VpnList* vpn_list() { return vpn_list_.get(); } | 84 VpnList* vpn_list() { return vpn_list_.get(); } |
99 | 85 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 CreateScopedDisableInternalMouseAndKeyboard() = 0; | 202 CreateScopedDisableInternalMouseAndKeyboard() = 0; |
217 | 203 |
218 virtual std::unique_ptr<ImmersiveFullscreenController> | 204 virtual std::unique_ptr<ImmersiveFullscreenController> |
219 CreateImmersiveFullscreenController() = 0; | 205 CreateImmersiveFullscreenController() = 0; |
220 | 206 |
221 // Creates the KeyboardUI. This is called early on. | 207 // Creates the KeyboardUI. This is called early on. |
222 virtual std::unique_ptr<KeyboardUI> CreateKeyboardUI() = 0; | 208 virtual std::unique_ptr<KeyboardUI> CreateKeyboardUI() = 0; |
223 | 209 |
224 virtual std::unique_ptr<KeyEventWatcher> CreateKeyEventWatcher() = 0; | 210 virtual std::unique_ptr<KeyEventWatcher> CreateKeyEventWatcher() = 0; |
225 | 211 |
226 // Creates the ShelfView for each display and populates it with items. | |
227 // Called after the user session is active and profile is available. | |
228 void CreateShelfView(); | |
229 | |
230 void CreateShelfDelegate(); | |
231 | |
232 // Called when the login status changes. | |
233 // TODO(oshima): Investigate if we can merge this and |OnLoginStateChanged|. | |
234 void UpdateAfterLoginStatusChange(LoginStatus status); | |
235 | |
236 virtual SessionStateDelegate* GetSessionStateDelegate() = 0; | 212 virtual SessionStateDelegate* GetSessionStateDelegate() = 0; |
237 | 213 |
238 virtual void AddDisplayObserver(WmDisplayObserver* observer) = 0; | 214 virtual void AddDisplayObserver(WmDisplayObserver* observer) = 0; |
239 virtual void RemoveDisplayObserver(WmDisplayObserver* observer) = 0; | 215 virtual void RemoveDisplayObserver(WmDisplayObserver* observer) = 0; |
240 | 216 |
241 // If |events| is PointerWatcherEventTypes::MOVES, | 217 // If |events| is PointerWatcherEventTypes::MOVES, |
242 // PointerWatcher::OnPointerEventObserved() is called for pointer move events. | 218 // PointerWatcher::OnPointerEventObserved() is called for pointer move events. |
243 // If |events| is PointerWatcherEventTypes::DRAGS, | 219 // If |events| is PointerWatcherEventTypes::DRAGS, |
244 // PointerWatcher::OnPointerEventObserved() is called for pointer drag events. | 220 // PointerWatcher::OnPointerEventObserved() is called for pointer drag events. |
245 // Requesting pointer moves or drags may incur a performance hit and should be | 221 // Requesting pointer moves or drags may incur a performance hit and should be |
246 // avoided if possible. | 222 // avoided if possible. |
247 virtual void AddPointerWatcher(views::PointerWatcher* watcher, | 223 virtual void AddPointerWatcher(views::PointerWatcher* watcher, |
248 views::PointerWatcherEventTypes events) = 0; | 224 views::PointerWatcherEventTypes events) = 0; |
249 virtual void RemovePointerWatcher(views::PointerWatcher* watcher) = 0; | 225 virtual void RemovePointerWatcher(views::PointerWatcher* watcher) = 0; |
250 | 226 |
251 // TODO: Move these back to LockStateController when that has been moved. | 227 // TODO: Move these back to LockStateController when that has been moved. |
252 void OnLockStateEvent(LockStateObserver::EventType event); | 228 void OnLockStateEvent(LockStateObserver::EventType event); |
253 void AddLockStateObserver(LockStateObserver* observer); | 229 void AddLockStateObserver(LockStateObserver* observer); |
254 void RemoveLockStateObserver(LockStateObserver* observer); | 230 void RemoveLockStateObserver(LockStateObserver* observer); |
255 | 231 |
256 void SetShelfDelegateForTesting(std::unique_ptr<ShelfDelegate> test_delegate); | |
257 | |
258 // True if any touch points are down. | 232 // True if any touch points are down. |
259 virtual bool IsTouchDown() = 0; | 233 virtual bool IsTouchDown() = 0; |
260 | 234 |
261 // TODO(jamescook): Remove this when VirtualKeyboardController has been moved. | 235 // TODO(jamescook): Remove this when VirtualKeyboardController has been moved. |
262 virtual void ToggleIgnoreExternalKeyboard() = 0; | 236 virtual void ToggleIgnoreExternalKeyboard() = 0; |
263 | 237 |
264 // Enable or disable the laser pointer. | 238 // Enable or disable the laser pointer. |
265 virtual void SetLaserPointerEnabled(bool enabled) = 0; | 239 virtual void SetLaserPointerEnabled(bool enabled) = 0; |
266 | 240 |
267 // Enable or disable the partial magnifier. | 241 // Enable or disable the partial magnifier. |
(...skipping 10 matching lines...) Expand all Loading... |
278 virtual void InitHosts(const ShellInitParams& init_params) = 0; | 252 virtual void InitHosts(const ShellInitParams& init_params) = 0; |
279 | 253 |
280 // Called during startup to create the AcceleratorController. | 254 // Called during startup to create the AcceleratorController. |
281 virtual std::unique_ptr<AcceleratorController> | 255 virtual std::unique_ptr<AcceleratorController> |
282 CreateAcceleratorController() = 0; | 256 CreateAcceleratorController() = 0; |
283 | 257 |
284 void DeleteWindowCycleController(); | 258 void DeleteWindowCycleController(); |
285 | 259 |
286 void DeleteWindowSelectorController(); | 260 void DeleteWindowSelectorController(); |
287 | 261 |
288 // SessionStateObserver: | |
289 void SessionStateChanged(session_manager::SessionState state) override; | |
290 | |
291 private: | 262 private: |
292 friend class AcceleratorControllerTest; | 263 friend class AcceleratorControllerTest; |
293 friend class Shell; | 264 friend class Shell; |
294 | 265 |
295 static WmShell* instance_; | 266 static WmShell* instance_; |
296 | 267 |
297 std::unique_ptr<SessionController> session_controller_; | |
298 std::unique_ptr<ShelfController> shelf_controller_; | |
299 std::unique_ptr<ShelfDelegate> shelf_delegate_; | |
300 std::unique_ptr<ShelfWindowWatcher> shelf_window_watcher_; | |
301 std::unique_ptr<ShutdownController> shutdown_controller_; | 268 std::unique_ptr<ShutdownController> shutdown_controller_; |
302 std::unique_ptr<SystemTrayNotifier> system_tray_notifier_; | 269 std::unique_ptr<SystemTrayNotifier> system_tray_notifier_; |
303 std::unique_ptr<VpnList> vpn_list_; | 270 std::unique_ptr<VpnList> vpn_list_; |
304 std::unique_ptr<WindowCycleController> window_cycle_controller_; | 271 std::unique_ptr<WindowCycleController> window_cycle_controller_; |
305 std::unique_ptr<WindowSelectorController> window_selector_controller_; | 272 std::unique_ptr<WindowSelectorController> window_selector_controller_; |
306 | 273 |
307 base::ObserverList<LockStateObserver> lock_state_observers_; | 274 base::ObserverList<LockStateObserver> lock_state_observers_; |
308 | 275 |
309 bool simulate_modal_window_open_for_testing_ = false; | 276 bool simulate_modal_window_open_for_testing_ = false; |
310 }; | 277 }; |
311 | 278 |
312 } // namespace ash | 279 } // namespace ash |
313 | 280 |
314 #endif // ASH_COMMON_WM_SHELL_H_ | 281 #endif // ASH_COMMON_WM_SHELL_H_ |
OLD | NEW |