| 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> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 class Point; | 31 class Point; |
| 32 } | 32 } |
| 33 | 33 |
| 34 namespace views { | 34 namespace views { |
| 35 class PointerWatcher; | 35 class PointerWatcher; |
| 36 enum class PointerWatcherEventTypes; | 36 enum class PointerWatcherEventTypes; |
| 37 } | 37 } |
| 38 | 38 |
| 39 namespace ash { | 39 namespace ash { |
| 40 class AcceleratorController; | 40 class AcceleratorController; |
| 41 class BrightnessControlDelegate; | |
| 42 class CastConfigController; | |
| 43 class FocusCycler; | |
| 44 class ImmersiveContextAsh; | 41 class ImmersiveContextAsh; |
| 45 class ImmersiveFullscreenController; | 42 class ImmersiveFullscreenController; |
| 46 class KeyEventWatcher; | 43 class KeyEventWatcher; |
| 47 class KeyboardBrightnessControlDelegate; | |
| 48 class KeyboardUI; | 44 class KeyboardUI; |
| 49 class LocaleNotificationController; | |
| 50 class LogoutConfirmationController; | |
| 51 class MaximizeModeController; | 45 class MaximizeModeController; |
| 52 class MediaController; | 46 class MediaController; |
| 53 class MruWindowTracker; | 47 class MruWindowTracker; |
| 54 class NewWindowController; | 48 class NewWindowController; |
| 55 class RootWindowController; | 49 class RootWindowController; |
| 56 class ScopedDisableInternalMouseAndKeyboard; | 50 class ScopedDisableInternalMouseAndKeyboard; |
| 57 class SessionController; | 51 class SessionController; |
| 58 class SessionStateDelegate; | 52 class SessionStateDelegate; |
| 59 class ShelfController; | 53 class ShelfController; |
| 60 class ShelfDelegate; | 54 class ShelfDelegate; |
| 61 class ShelfModel; | 55 class ShelfModel; |
| 62 class ShelfWindowWatcher; | 56 class ShelfWindowWatcher; |
| 63 struct ShellInitParams; | 57 struct ShellInitParams; |
| 64 class ShutdownController; | 58 class ShutdownController; |
| 65 class SystemTrayDelegate; | |
| 66 class SystemTrayController; | |
| 67 class SystemTrayNotifier; | 59 class SystemTrayNotifier; |
| 68 class VpnList; | 60 class VpnList; |
| 69 class WindowCycleController; | 61 class WindowCycleController; |
| 70 class WindowCycleEventFilter; | 62 class WindowCycleEventFilter; |
| 71 class WindowResizer; | 63 class WindowResizer; |
| 72 class WindowSelectorController; | 64 class WindowSelectorController; |
| 73 class WmDisplayObserver; | 65 class WmDisplayObserver; |
| 74 class WmWindow; | 66 class WmWindow; |
| 75 class WorkspaceEventHandler; | 67 class WorkspaceEventHandler; |
| 76 | 68 |
| 77 enum class LoginStatus; | 69 enum class LoginStatus; |
| 78 enum class TaskSwitchSource; | 70 enum class TaskSwitchSource; |
| 79 | 71 |
| 80 namespace wm { | 72 namespace wm { |
| 81 class MaximizeModeEventHandler; | 73 class MaximizeModeEventHandler; |
| 82 class WindowState; | 74 class WindowState; |
| 83 } | 75 } |
| 84 | 76 |
| 85 // Similar to ash::Shell. Eventually the two will be merged. | 77 // Similar to ash::Shell. Eventually the two will be merged. |
| 86 class ASH_EXPORT WmShell : public SessionStateObserver { | 78 class ASH_EXPORT WmShell : public SessionStateObserver { |
| 87 public: | 79 public: |
| 88 ~WmShell() override; | 80 ~WmShell() override; |
| 89 | 81 |
| 90 static WmShell* Get(); | 82 static WmShell* Get(); |
| 91 static bool HasInstance() { return instance_ != nullptr; } | 83 static bool HasInstance() { return instance_ != nullptr; } |
| 92 | 84 |
| 93 virtual void Shutdown(); | 85 virtual void Shutdown(); |
| 94 | 86 |
| 95 BrightnessControlDelegate* brightness_control_delegate() { | |
| 96 return brightness_control_delegate_.get(); | |
| 97 } | |
| 98 | |
| 99 CastConfigController* cast_config() { return cast_config_.get(); } | |
| 100 | |
| 101 FocusCycler* focus_cycler() { return focus_cycler_.get(); } | |
| 102 | |
| 103 KeyboardBrightnessControlDelegate* keyboard_brightness_control_delegate() { | |
| 104 return keyboard_brightness_control_delegate_.get(); | |
| 105 } | |
| 106 | |
| 107 KeyboardUI* keyboard_ui() { return keyboard_ui_.get(); } | |
| 108 | |
| 109 LocaleNotificationController* locale_notification_controller() { | |
| 110 return locale_notification_controller_.get(); | |
| 111 } | |
| 112 | |
| 113 LogoutConfirmationController* logout_confirmation_controller() { | |
| 114 return logout_confirmation_controller_.get(); | |
| 115 } | |
| 116 | |
| 117 MaximizeModeController* maximize_mode_controller() { | 87 MaximizeModeController* maximize_mode_controller() { |
| 118 return maximize_mode_controller_.get(); | 88 return maximize_mode_controller_.get(); |
| 119 } | 89 } |
| 120 | 90 |
| 121 MruWindowTracker* mru_window_tracker() { return mru_window_tracker_.get(); } | 91 MruWindowTracker* mru_window_tracker() { return mru_window_tracker_.get(); } |
| 122 | 92 |
| 123 MediaController* media_controller() { return media_controller_.get(); } | 93 MediaController* media_controller() { return media_controller_.get(); } |
| 124 | 94 |
| 125 NewWindowController* new_window_controller() { | 95 NewWindowController* new_window_controller() { |
| 126 return new_window_controller_.get(); | 96 return new_window_controller_.get(); |
| 127 } | 97 } |
| 128 | 98 |
| 129 SessionController* session_controller() { return session_controller_.get(); } | 99 SessionController* session_controller() { return session_controller_.get(); } |
| 130 | 100 |
| 131 ShelfController* shelf_controller() { return shelf_controller_.get(); } | 101 ShelfController* shelf_controller() { return shelf_controller_.get(); } |
| 132 | 102 |
| 133 ShelfDelegate* shelf_delegate() { return shelf_delegate_.get(); } | 103 ShelfDelegate* shelf_delegate() { return shelf_delegate_.get(); } |
| 134 | 104 |
| 135 ShelfModel* shelf_model(); | 105 ShelfModel* shelf_model(); |
| 136 | 106 |
| 137 ShutdownController* shutdown_controller() { | 107 ShutdownController* shutdown_controller() { |
| 138 return shutdown_controller_.get(); | 108 return shutdown_controller_.get(); |
| 139 } | 109 } |
| 140 | 110 |
| 141 SystemTrayController* system_tray_controller() { | |
| 142 return system_tray_controller_.get(); | |
| 143 } | |
| 144 | |
| 145 SystemTrayNotifier* system_tray_notifier() { | 111 SystemTrayNotifier* system_tray_notifier() { |
| 146 return system_tray_notifier_.get(); | 112 return system_tray_notifier_.get(); |
| 147 } | 113 } |
| 148 | 114 |
| 149 SystemTrayDelegate* system_tray_delegate() { | |
| 150 return system_tray_delegate_.get(); | |
| 151 } | |
| 152 | |
| 153 VpnList* vpn_list() { return vpn_list_.get(); } | 115 VpnList* vpn_list() { return vpn_list_.get(); } |
| 154 | 116 |
| 155 WindowCycleController* window_cycle_controller() { | 117 WindowCycleController* window_cycle_controller() { |
| 156 return window_cycle_controller_.get(); | 118 return window_cycle_controller_.get(); |
| 157 } | 119 } |
| 158 | 120 |
| 159 WindowSelectorController* window_selector_controller() { | 121 WindowSelectorController* window_selector_controller() { |
| 160 return window_selector_controller_.get(); | 122 return window_selector_controller_.get(); |
| 161 } | 123 } |
| 162 | 124 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 228 |
| 267 virtual std::unique_ptr<WorkspaceEventHandler> CreateWorkspaceEventHandler( | 229 virtual std::unique_ptr<WorkspaceEventHandler> CreateWorkspaceEventHandler( |
| 268 WmWindow* workspace_window) = 0; | 230 WmWindow* workspace_window) = 0; |
| 269 | 231 |
| 270 virtual std::unique_ptr<ScopedDisableInternalMouseAndKeyboard> | 232 virtual std::unique_ptr<ScopedDisableInternalMouseAndKeyboard> |
| 271 CreateScopedDisableInternalMouseAndKeyboard() = 0; | 233 CreateScopedDisableInternalMouseAndKeyboard() = 0; |
| 272 | 234 |
| 273 virtual std::unique_ptr<ImmersiveFullscreenController> | 235 virtual std::unique_ptr<ImmersiveFullscreenController> |
| 274 CreateImmersiveFullscreenController() = 0; | 236 CreateImmersiveFullscreenController() = 0; |
| 275 | 237 |
| 238 // Creates the KeyboardUI. This is called early on. |
| 239 virtual std::unique_ptr<KeyboardUI> CreateKeyboardUI() = 0; |
| 240 |
| 276 virtual std::unique_ptr<KeyEventWatcher> CreateKeyEventWatcher() = 0; | 241 virtual std::unique_ptr<KeyEventWatcher> CreateKeyEventWatcher() = 0; |
| 277 | 242 |
| 278 // Creates the ShelfView for each display and populates it with items. | 243 // Creates the ShelfView for each display and populates it with items. |
| 279 // Called after the user session is active and profile is available. | 244 // Called after the user session is active and profile is available. |
| 280 void CreateShelfView(); | 245 void CreateShelfView(); |
| 281 | 246 |
| 282 void CreateShelfDelegate(); | 247 void CreateShelfDelegate(); |
| 283 | 248 |
| 284 // Called when the login status changes. | 249 // Called when the login status changes. |
| 285 // TODO(oshima): Investigate if we can merge this and |OnLoginStateChanged|. | 250 // TODO(oshima): Investigate if we can merge this and |OnLoginStateChanged|. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 | 291 |
| 327 // Called during startup to create the primary WindowTreeHost and | 292 // Called during startup to create the primary WindowTreeHost and |
| 328 // the corresponding RootWindowController. | 293 // the corresponding RootWindowController. |
| 329 virtual void CreatePrimaryHost() = 0; | 294 virtual void CreatePrimaryHost() = 0; |
| 330 virtual void InitHosts(const ShellInitParams& init_params) = 0; | 295 virtual void InitHosts(const ShellInitParams& init_params) = 0; |
| 331 | 296 |
| 332 // Called during startup to create the AcceleratorController. | 297 // Called during startup to create the AcceleratorController. |
| 333 virtual std::unique_ptr<AcceleratorController> | 298 virtual std::unique_ptr<AcceleratorController> |
| 334 CreateAcceleratorController() = 0; | 299 CreateAcceleratorController() = 0; |
| 335 | 300 |
| 336 void SetKeyboardUI(std::unique_ptr<KeyboardUI> keyboard_ui); | |
| 337 | |
| 338 // Helpers to set (and initialize) or destroy various delegates. | |
| 339 // TODO(msw|jamescook): Remove these once ShellDelegate, etc. are ported. | |
| 340 void SetSystemTrayDelegate(std::unique_ptr<SystemTrayDelegate> delegate); | |
| 341 void DeleteSystemTrayDelegate(); | |
| 342 | |
| 343 void DeleteWindowCycleController(); | 301 void DeleteWindowCycleController(); |
| 344 | 302 |
| 345 void DeleteWindowSelectorController(); | 303 void DeleteWindowSelectorController(); |
| 346 | 304 |
| 347 void CreateMaximizeModeController(); | 305 void CreateMaximizeModeController(); |
| 348 void DeleteMaximizeModeController(); | 306 void DeleteMaximizeModeController(); |
| 349 | 307 |
| 350 void CreateMruWindowTracker(); | 308 void CreateMruWindowTracker(); |
| 351 void DeleteMruWindowTracker(); | 309 void DeleteMruWindowTracker(); |
| 352 | 310 |
| 353 // SessionStateObserver: | 311 // SessionStateObserver: |
| 354 void SessionStateChanged(session_manager::SessionState state) override; | 312 void SessionStateChanged(session_manager::SessionState state) override; |
| 355 | 313 |
| 356 private: | 314 private: |
| 357 friend class AcceleratorControllerTest; | 315 friend class AcceleratorControllerTest; |
| 358 friend class Shell; | 316 friend class Shell; |
| 359 friend class WmShellTestApi; | |
| 360 | 317 |
| 361 static WmShell* instance_; | 318 static WmShell* instance_; |
| 362 | 319 |
| 363 std::unique_ptr<BrightnessControlDelegate> brightness_control_delegate_; | |
| 364 std::unique_ptr<CastConfigController> cast_config_; | |
| 365 std::unique_ptr<FocusCycler> focus_cycler_; | |
| 366 std::unique_ptr<ImmersiveContextAsh> immersive_context_; | 320 std::unique_ptr<ImmersiveContextAsh> immersive_context_; |
| 367 std::unique_ptr<KeyboardBrightnessControlDelegate> | |
| 368 keyboard_brightness_control_delegate_; | |
| 369 std::unique_ptr<KeyboardUI> keyboard_ui_; | |
| 370 std::unique_ptr<LocaleNotificationController> locale_notification_controller_; | |
| 371 std::unique_ptr<LogoutConfirmationController> logout_confirmation_controller_; | |
| 372 std::unique_ptr<MaximizeModeController> maximize_mode_controller_; | 321 std::unique_ptr<MaximizeModeController> maximize_mode_controller_; |
| 373 std::unique_ptr<MediaController> media_controller_; | 322 std::unique_ptr<MediaController> media_controller_; |
| 374 std::unique_ptr<MruWindowTracker> mru_window_tracker_; | 323 std::unique_ptr<MruWindowTracker> mru_window_tracker_; |
| 375 std::unique_ptr<NewWindowController> new_window_controller_; | 324 std::unique_ptr<NewWindowController> new_window_controller_; |
| 376 std::unique_ptr<SessionController> session_controller_; | 325 std::unique_ptr<SessionController> session_controller_; |
| 377 std::unique_ptr<ShelfController> shelf_controller_; | 326 std::unique_ptr<ShelfController> shelf_controller_; |
| 378 std::unique_ptr<ShelfDelegate> shelf_delegate_; | 327 std::unique_ptr<ShelfDelegate> shelf_delegate_; |
| 379 std::unique_ptr<ShelfWindowWatcher> shelf_window_watcher_; | 328 std::unique_ptr<ShelfWindowWatcher> shelf_window_watcher_; |
| 380 std::unique_ptr<ShutdownController> shutdown_controller_; | 329 std::unique_ptr<ShutdownController> shutdown_controller_; |
| 381 std::unique_ptr<SystemTrayController> system_tray_controller_; | |
| 382 std::unique_ptr<SystemTrayNotifier> system_tray_notifier_; | 330 std::unique_ptr<SystemTrayNotifier> system_tray_notifier_; |
| 383 std::unique_ptr<SystemTrayDelegate> system_tray_delegate_; | |
| 384 std::unique_ptr<VpnList> vpn_list_; | 331 std::unique_ptr<VpnList> vpn_list_; |
| 385 std::unique_ptr<WindowCycleController> window_cycle_controller_; | 332 std::unique_ptr<WindowCycleController> window_cycle_controller_; |
| 386 std::unique_ptr<WindowSelectorController> window_selector_controller_; | 333 std::unique_ptr<WindowSelectorController> window_selector_controller_; |
| 387 | 334 |
| 388 base::ObserverList<LockStateObserver> lock_state_observers_; | 335 base::ObserverList<LockStateObserver> lock_state_observers_; |
| 389 | 336 |
| 390 bool simulate_modal_window_open_for_testing_ = false; | 337 bool simulate_modal_window_open_for_testing_ = false; |
| 391 }; | 338 }; |
| 392 | 339 |
| 393 } // namespace ash | 340 } // namespace ash |
| 394 | 341 |
| 395 #endif // ASH_COMMON_WM_SHELL_H_ | 342 #endif // ASH_COMMON_WM_SHELL_H_ |
| OLD | NEW |