| 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 17 matching lines...) Expand all Loading... |
| 28 namespace display { | 28 namespace display { |
| 29 class Display; | 29 class Display; |
| 30 class ManagedDisplayInfo; | 30 class ManagedDisplayInfo; |
| 31 } | 31 } |
| 32 | 32 |
| 33 namespace gfx { | 33 namespace gfx { |
| 34 class Insets; | 34 class Insets; |
| 35 class Point; | 35 class Point; |
| 36 } | 36 } |
| 37 | 37 |
| 38 namespace preferences { | |
| 39 class PrefClientStore; | |
| 40 } | |
| 41 | |
| 42 namespace views { | 38 namespace views { |
| 43 class PointerWatcher; | 39 class PointerWatcher; |
| 44 enum class PointerWatcherEventTypes; | 40 enum class PointerWatcherEventTypes; |
| 45 } | 41 } |
| 46 | 42 |
| 47 namespace ash { | 43 namespace ash { |
| 48 class AcceleratorController; | 44 class AcceleratorController; |
| 49 class BrightnessControlDelegate; | 45 class BrightnessControlDelegate; |
| 50 class CastConfigController; | 46 class CastConfigController; |
| 51 class FocusCycler; | 47 class FocusCycler; |
| 52 class ImmersiveContextAsh; | 48 class ImmersiveContextAsh; |
| 53 class ImmersiveFullscreenController; | 49 class ImmersiveFullscreenController; |
| 54 class KeyEventWatcher; | 50 class KeyEventWatcher; |
| 55 class KeyboardBrightnessControlDelegate; | 51 class KeyboardBrightnessControlDelegate; |
| 56 class KeyboardUI; | 52 class KeyboardUI; |
| 57 class LocaleNotificationController; | 53 class LocaleNotificationController; |
| 58 class LogoutConfirmationController; | 54 class LogoutConfirmationController; |
| 59 class MaximizeModeController; | 55 class MaximizeModeController; |
| 60 class MediaController; | 56 class MediaController; |
| 61 class MruWindowTracker; | 57 class MruWindowTracker; |
| 62 class NewWindowController; | 58 class NewWindowController; |
| 63 class RootWindowController; | 59 class RootWindowController; |
| 64 class ScopedDisableInternalMouseAndKeyboard; | 60 class ScopedDisableInternalMouseAndKeyboard; |
| 65 class SessionController; | 61 class SessionController; |
| 66 class SessionStateDelegate; | 62 class SessionStateDelegate; |
| 67 class ShelfController; | 63 class ShelfController; |
| 68 class ShelfDelegate; | 64 class ShelfDelegate; |
| 69 class ShelfModel; | 65 class ShelfModel; |
| 70 class ShelfWindowWatcher; | 66 class ShelfWindowWatcher; |
| 71 class ShellDelegate; | |
| 72 struct ShellInitParams; | 67 struct ShellInitParams; |
| 73 class ShutdownController; | 68 class ShutdownController; |
| 74 class SystemTrayDelegate; | 69 class SystemTrayDelegate; |
| 75 class SystemTrayController; | 70 class SystemTrayController; |
| 76 class SystemTrayNotifier; | 71 class SystemTrayNotifier; |
| 77 class VpnList; | 72 class VpnList; |
| 78 class WallpaperDelegate; | |
| 79 class WindowCycleController; | 73 class WindowCycleController; |
| 80 class WindowCycleEventFilter; | 74 class WindowCycleEventFilter; |
| 81 class WindowResizer; | 75 class WindowResizer; |
| 82 class WindowSelectorController; | 76 class WindowSelectorController; |
| 83 class WmDisplayObserver; | 77 class WmDisplayObserver; |
| 84 class WmWindow; | 78 class WmWindow; |
| 85 class WorkspaceEventHandler; | 79 class WorkspaceEventHandler; |
| 86 | 80 |
| 87 enum class LoginStatus; | 81 enum class LoginStatus; |
| 88 enum class TaskSwitchSource; | 82 enum class TaskSwitchSource; |
| 89 | 83 |
| 90 namespace wm { | 84 namespace wm { |
| 91 class MaximizeModeEventHandler; | 85 class MaximizeModeEventHandler; |
| 92 class WindowState; | 86 class WindowState; |
| 93 } | 87 } |
| 94 | 88 |
| 95 // Similar to ash::Shell. Eventually the two will be merged. | 89 // Similar to ash::Shell. Eventually the two will be merged. |
| 96 class ASH_EXPORT WmShell : public SessionStateObserver { | 90 class ASH_EXPORT WmShell : public SessionStateObserver { |
| 97 public: | 91 public: |
| 98 ~WmShell() override; | 92 ~WmShell() override; |
| 99 | 93 |
| 100 // This is necessary for a handful of places that is difficult to plumb | |
| 101 // through context. | |
| 102 static void Set(WmShell* instance); | |
| 103 static WmShell* Get(); | 94 static WmShell* Get(); |
| 104 static bool HasInstance() { return instance_ != nullptr; } | 95 static bool HasInstance() { return instance_ != nullptr; } |
| 105 | 96 |
| 106 virtual void Shutdown(); | 97 virtual void Shutdown(); |
| 107 | 98 |
| 108 ShellDelegate* delegate() { return delegate_.get(); } | |
| 109 | |
| 110 AcceleratorController* accelerator_controller() { | 99 AcceleratorController* accelerator_controller() { |
| 111 return accelerator_controller_.get(); | 100 return accelerator_controller_.get(); |
| 112 } | 101 } |
| 113 | 102 |
| 114 app_list::AppList* app_list() { return app_list_.get(); } | 103 app_list::AppList* app_list() { return app_list_.get(); } |
| 115 | 104 |
| 116 BrightnessControlDelegate* brightness_control_delegate() { | 105 BrightnessControlDelegate* brightness_control_delegate() { |
| 117 return brightness_control_delegate_.get(); | 106 return brightness_control_delegate_.get(); |
| 118 } | 107 } |
| 119 | 108 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 140 } | 129 } |
| 141 | 130 |
| 142 MruWindowTracker* mru_window_tracker() { return mru_window_tracker_.get(); } | 131 MruWindowTracker* mru_window_tracker() { return mru_window_tracker_.get(); } |
| 143 | 132 |
| 144 MediaController* media_controller() { return media_controller_.get(); } | 133 MediaController* media_controller() { return media_controller_.get(); } |
| 145 | 134 |
| 146 NewWindowController* new_window_controller() { | 135 NewWindowController* new_window_controller() { |
| 147 return new_window_controller_.get(); | 136 return new_window_controller_.get(); |
| 148 } | 137 } |
| 149 | 138 |
| 150 preferences::PrefClientStore* pref_store() { return pref_store_.get(); } | |
| 151 | |
| 152 SessionController* session_controller() { return session_controller_.get(); } | 139 SessionController* session_controller() { return session_controller_.get(); } |
| 153 | 140 |
| 154 ShelfController* shelf_controller() { return shelf_controller_.get(); } | 141 ShelfController* shelf_controller() { return shelf_controller_.get(); } |
| 155 | 142 |
| 156 ShelfDelegate* shelf_delegate() { return shelf_delegate_.get(); } | 143 ShelfDelegate* shelf_delegate() { return shelf_delegate_.get(); } |
| 157 | 144 |
| 158 ShelfModel* shelf_model(); | 145 ShelfModel* shelf_model(); |
| 159 | 146 |
| 160 ShutdownController* shutdown_controller() { | 147 ShutdownController* shutdown_controller() { |
| 161 return shutdown_controller_.get(); | 148 return shutdown_controller_.get(); |
| 162 } | 149 } |
| 163 | 150 |
| 164 SystemTrayController* system_tray_controller() { | 151 SystemTrayController* system_tray_controller() { |
| 165 return system_tray_controller_.get(); | 152 return system_tray_controller_.get(); |
| 166 } | 153 } |
| 167 | 154 |
| 168 SystemTrayNotifier* system_tray_notifier() { | 155 SystemTrayNotifier* system_tray_notifier() { |
| 169 return system_tray_notifier_.get(); | 156 return system_tray_notifier_.get(); |
| 170 } | 157 } |
| 171 | 158 |
| 172 SystemTrayDelegate* system_tray_delegate() { | 159 SystemTrayDelegate* system_tray_delegate() { |
| 173 return system_tray_delegate_.get(); | 160 return system_tray_delegate_.get(); |
| 174 } | 161 } |
| 175 | 162 |
| 176 VpnList* vpn_list() { return vpn_list_.get(); } | 163 VpnList* vpn_list() { return vpn_list_.get(); } |
| 177 | 164 |
| 178 WallpaperDelegate* wallpaper_delegate() { return wallpaper_delegate_.get(); } | |
| 179 | |
| 180 WindowCycleController* window_cycle_controller() { | 165 WindowCycleController* window_cycle_controller() { |
| 181 return window_cycle_controller_.get(); | 166 return window_cycle_controller_.get(); |
| 182 } | 167 } |
| 183 | 168 |
| 184 WindowSelectorController* window_selector_controller() { | 169 WindowSelectorController* window_selector_controller() { |
| 185 return window_selector_controller_.get(); | 170 return window_selector_controller_.get(); |
| 186 } | 171 } |
| 187 | 172 |
| 188 // Returns true when ash is running as a service_manager::Service. | 173 // Returns true when ash is running as a service_manager::Service. |
| 189 virtual bool IsRunningInMash() const = 0; | 174 virtual bool IsRunningInMash() const = 0; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 | 341 |
| 357 // Enable or disable the laser pointer. | 342 // Enable or disable the laser pointer. |
| 358 virtual void SetLaserPointerEnabled(bool enabled) = 0; | 343 virtual void SetLaserPointerEnabled(bool enabled) = 0; |
| 359 | 344 |
| 360 // Enable or disable the partial magnifier. | 345 // Enable or disable the partial magnifier. |
| 361 virtual void SetPartialMagnifierEnabled(bool enabled) = 0; | 346 virtual void SetPartialMagnifierEnabled(bool enabled) = 0; |
| 362 | 347 |
| 363 virtual void CreatePointerWatcherAdapter() = 0; | 348 virtual void CreatePointerWatcherAdapter() = 0; |
| 364 | 349 |
| 365 protected: | 350 protected: |
| 366 explicit WmShell(std::unique_ptr<ShellDelegate> shell_delegate); | 351 WmShell(); |
| 367 | 352 |
| 368 // Called during startup to create the primary WindowTreeHost and | 353 // Called during startup to create the primary WindowTreeHost and |
| 369 // the corresponding RootWindowController. | 354 // the corresponding RootWindowController. |
| 370 virtual void CreatePrimaryHost() = 0; | 355 virtual void CreatePrimaryHost() = 0; |
| 371 virtual void InitHosts(const ShellInitParams& init_params) = 0; | 356 virtual void InitHosts(const ShellInitParams& init_params) = 0; |
| 372 | 357 |
| 373 void SetKeyboardUI(std::unique_ptr<KeyboardUI> keyboard_ui); | 358 void SetKeyboardUI(std::unique_ptr<KeyboardUI> keyboard_ui); |
| 374 | 359 |
| 375 // Helpers to set (and initialize) or destroy various delegates. | 360 // Helpers to set (and initialize) or destroy various delegates. |
| 376 // TODO(msw|jamescook): Remove these once ShellDelegate, etc. are ported. | 361 // TODO(msw|jamescook): Remove these once ShellDelegate, etc. are ported. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 393 // SessionStateObserver: | 378 // SessionStateObserver: |
| 394 void SessionStateChanged(session_manager::SessionState state) override; | 379 void SessionStateChanged(session_manager::SessionState state) override; |
| 395 | 380 |
| 396 private: | 381 private: |
| 397 friend class AcceleratorControllerTest; | 382 friend class AcceleratorControllerTest; |
| 398 friend class Shell; | 383 friend class Shell; |
| 399 friend class WmShellTestApi; | 384 friend class WmShellTestApi; |
| 400 | 385 |
| 401 static WmShell* instance_; | 386 static WmShell* instance_; |
| 402 | 387 |
| 403 std::unique_ptr<ShellDelegate> delegate_; | |
| 404 | |
| 405 scoped_refptr<preferences::PrefClientStore> pref_store_; | |
| 406 | |
| 407 std::unique_ptr<AcceleratorController> accelerator_controller_; | 388 std::unique_ptr<AcceleratorController> accelerator_controller_; |
| 408 std::unique_ptr<app_list::AppList> app_list_; | 389 std::unique_ptr<app_list::AppList> app_list_; |
| 409 std::unique_ptr<BrightnessControlDelegate> brightness_control_delegate_; | 390 std::unique_ptr<BrightnessControlDelegate> brightness_control_delegate_; |
| 410 std::unique_ptr<CastConfigController> cast_config_; | 391 std::unique_ptr<CastConfigController> cast_config_; |
| 411 std::unique_ptr<FocusCycler> focus_cycler_; | 392 std::unique_ptr<FocusCycler> focus_cycler_; |
| 412 std::unique_ptr<ImmersiveContextAsh> immersive_context_; | 393 std::unique_ptr<ImmersiveContextAsh> immersive_context_; |
| 413 std::unique_ptr<KeyboardBrightnessControlDelegate> | 394 std::unique_ptr<KeyboardBrightnessControlDelegate> |
| 414 keyboard_brightness_control_delegate_; | 395 keyboard_brightness_control_delegate_; |
| 415 std::unique_ptr<KeyboardUI> keyboard_ui_; | 396 std::unique_ptr<KeyboardUI> keyboard_ui_; |
| 416 std::unique_ptr<LocaleNotificationController> locale_notification_controller_; | 397 std::unique_ptr<LocaleNotificationController> locale_notification_controller_; |
| 417 std::unique_ptr<LogoutConfirmationController> logout_confirmation_controller_; | 398 std::unique_ptr<LogoutConfirmationController> logout_confirmation_controller_; |
| 418 std::unique_ptr<MaximizeModeController> maximize_mode_controller_; | 399 std::unique_ptr<MaximizeModeController> maximize_mode_controller_; |
| 419 std::unique_ptr<MediaController> media_controller_; | 400 std::unique_ptr<MediaController> media_controller_; |
| 420 std::unique_ptr<MruWindowTracker> mru_window_tracker_; | 401 std::unique_ptr<MruWindowTracker> mru_window_tracker_; |
| 421 std::unique_ptr<NewWindowController> new_window_controller_; | 402 std::unique_ptr<NewWindowController> new_window_controller_; |
| 422 std::unique_ptr<SessionController> session_controller_; | 403 std::unique_ptr<SessionController> session_controller_; |
| 423 std::unique_ptr<ShelfController> shelf_controller_; | 404 std::unique_ptr<ShelfController> shelf_controller_; |
| 424 std::unique_ptr<ShelfDelegate> shelf_delegate_; | 405 std::unique_ptr<ShelfDelegate> shelf_delegate_; |
| 425 std::unique_ptr<ShelfWindowWatcher> shelf_window_watcher_; | 406 std::unique_ptr<ShelfWindowWatcher> shelf_window_watcher_; |
| 426 std::unique_ptr<ShutdownController> shutdown_controller_; | 407 std::unique_ptr<ShutdownController> shutdown_controller_; |
| 427 std::unique_ptr<SystemTrayController> system_tray_controller_; | 408 std::unique_ptr<SystemTrayController> system_tray_controller_; |
| 428 std::unique_ptr<SystemTrayNotifier> system_tray_notifier_; | 409 std::unique_ptr<SystemTrayNotifier> system_tray_notifier_; |
| 429 std::unique_ptr<SystemTrayDelegate> system_tray_delegate_; | 410 std::unique_ptr<SystemTrayDelegate> system_tray_delegate_; |
| 430 std::unique_ptr<VpnList> vpn_list_; | 411 std::unique_ptr<VpnList> vpn_list_; |
| 431 std::unique_ptr<WallpaperDelegate> wallpaper_delegate_; | |
| 432 std::unique_ptr<WindowCycleController> window_cycle_controller_; | 412 std::unique_ptr<WindowCycleController> window_cycle_controller_; |
| 433 std::unique_ptr<WindowSelectorController> window_selector_controller_; | 413 std::unique_ptr<WindowSelectorController> window_selector_controller_; |
| 434 | 414 |
| 435 base::ObserverList<LockStateObserver> lock_state_observers_; | 415 base::ObserverList<LockStateObserver> lock_state_observers_; |
| 436 | 416 |
| 437 bool simulate_modal_window_open_for_testing_ = false; | 417 bool simulate_modal_window_open_for_testing_ = false; |
| 438 }; | 418 }; |
| 439 | 419 |
| 440 } // namespace ash | 420 } // namespace ash |
| 441 | 421 |
| 442 #endif // ASH_COMMON_WM_SHELL_H_ | 422 #endif // ASH_COMMON_WM_SHELL_H_ |
| OLD | NEW |