| 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" | 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" | 19 #include "components/ui_devtools/devtools_server.h" |
| 20 #include "ui/base/ui_base_types.h" | 20 #include "ui/base/ui_base_types.h" |
| 21 #include "ui/compositor/layer_type.h" | 21 #include "ui/compositor/layer_type.h" |
| 22 #include "ui/wm/public/activation_change_observer.h" |
| 22 #include "ui/wm/public/window_types.h" | 23 #include "ui/wm/public/window_types.h" |
| 23 | 24 |
| 24 namespace app_list { | 25 namespace app_list { |
| 25 class AppList; | 26 class AppList; |
| 26 } | 27 } |
| 27 | 28 |
| 28 namespace base { | 29 namespace base { |
| 29 class SequencedWorkerPool; | 30 class SequencedWorkerPool; |
| 30 } | 31 } |
| 31 | 32 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 class PaletteDelegate; | 69 class PaletteDelegate; |
| 69 class RootWindowController; | 70 class RootWindowController; |
| 70 class ScopedDisableInternalMouseAndKeyboard; | 71 class ScopedDisableInternalMouseAndKeyboard; |
| 71 class SessionController; | 72 class SessionController; |
| 72 class SessionStateDelegate; | 73 class SessionStateDelegate; |
| 73 class ShelfController; | 74 class ShelfController; |
| 74 class ShelfDelegate; | 75 class ShelfDelegate; |
| 75 class ShelfModel; | 76 class ShelfModel; |
| 76 class ShelfWindowWatcher; | 77 class ShelfWindowWatcher; |
| 77 class ShellDelegate; | 78 class ShellDelegate; |
| 79 struct ShellInitParams; |
| 78 class ShellObserver; | 80 class ShellObserver; |
| 79 class ShutdownController; | 81 class ShutdownController; |
| 80 class SystemTrayDelegate; | 82 class SystemTrayDelegate; |
| 81 class SystemTrayController; | 83 class SystemTrayController; |
| 82 class SystemTrayNotifier; | 84 class SystemTrayNotifier; |
| 83 class ToastManager; | 85 class ToastManager; |
| 84 class VpnList; | 86 class VpnList; |
| 85 class WallpaperController; | 87 class WallpaperController; |
| 86 class WallpaperDelegate; | 88 class WallpaperDelegate; |
| 87 class WindowCycleController; | 89 class WindowCycleController; |
| 88 class WindowCycleEventFilter; | 90 class WindowCycleEventFilter; |
| 89 class WindowResizer; | 91 class WindowResizer; |
| 90 class WindowSelectorController; | 92 class WindowSelectorController; |
| 91 class WmActivationObserver; | 93 class WmActivationObserver; |
| 92 class WmDisplayObserver; | 94 class WmDisplayObserver; |
| 93 class WmWindow; | 95 class WmWindow; |
| 94 class WorkspaceEventHandler; | 96 class WorkspaceEventHandler; |
| 95 | 97 |
| 96 enum class LoginStatus; | 98 enum class LoginStatus; |
| 97 enum class TaskSwitchSource; | 99 enum class TaskSwitchSource; |
| 98 | 100 |
| 99 namespace wm { | 101 namespace wm { |
| 100 class MaximizeModeEventHandler; | 102 class MaximizeModeEventHandler; |
| 101 class WindowState; | 103 class WindowState; |
| 102 } | 104 } |
| 103 | 105 |
| 104 // Similar to ash::Shell. Eventually the two will be merged. | 106 // Similar to ash::Shell. Eventually the two will be merged. |
| 105 class ASH_EXPORT WmShell : public SessionStateObserver { | 107 class ASH_EXPORT WmShell : public SessionStateObserver, |
| 108 public aura::client::ActivationChangeObserver { |
| 106 public: | 109 public: |
| 110 ~WmShell() override; |
| 111 |
| 107 // This is necessary for a handful of places that is difficult to plumb | 112 // This is necessary for a handful of places that is difficult to plumb |
| 108 // through context. | 113 // through context. |
| 109 static void Set(WmShell* instance); | 114 static void Set(WmShell* instance); |
| 110 static WmShell* Get(); | 115 static WmShell* Get(); |
| 111 static bool HasInstance() { return instance_ != nullptr; } | 116 static bool HasInstance() { return instance_ != nullptr; } |
| 112 | 117 |
| 113 void Initialize(const scoped_refptr<base::SequencedWorkerPool>& pool); | 118 virtual void Initialize(const scoped_refptr<base::SequencedWorkerPool>& pool); |
| 114 virtual void Shutdown(); | 119 virtual void Shutdown(); |
| 115 | 120 |
| 116 ShellDelegate* delegate() { return delegate_.get(); } | 121 ShellDelegate* delegate() { return delegate_.get(); } |
| 117 | 122 |
| 118 AcceleratorController* accelerator_controller() { | 123 AcceleratorController* accelerator_controller() { |
| 119 return accelerator_controller_.get(); | 124 return accelerator_controller_.get(); |
| 120 } | 125 } |
| 121 | 126 |
| 122 AccessibilityDelegate* accessibility_delegate() { | 127 AccessibilityDelegate* accessibility_delegate() { |
| 123 return accessibility_delegate_.get(); | 128 return accessibility_delegate_.get(); |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 // Notify observers that |root_window|'s shelf changed auto-hide alignment. | 399 // Notify observers that |root_window|'s shelf changed auto-hide alignment. |
| 395 // TODO(jamescook): Move to Shelf. | 400 // TODO(jamescook): Move to Shelf. |
| 396 void NotifyShelfAlignmentChanged(WmWindow* root_window); | 401 void NotifyShelfAlignmentChanged(WmWindow* root_window); |
| 397 | 402 |
| 398 // Notify observers that |root_window|'s shelf changed auto-hide behavior. | 403 // Notify observers that |root_window|'s shelf changed auto-hide behavior. |
| 399 // TODO(jamescook): Move to Shelf. | 404 // TODO(jamescook): Move to Shelf. |
| 400 void NotifyShelfAutoHideBehaviorChanged(WmWindow* root_window); | 405 void NotifyShelfAutoHideBehaviorChanged(WmWindow* root_window); |
| 401 | 406 |
| 402 virtual SessionStateDelegate* GetSessionStateDelegate() = 0; | 407 virtual SessionStateDelegate* GetSessionStateDelegate() = 0; |
| 403 | 408 |
| 404 virtual void AddActivationObserver(WmActivationObserver* observer) = 0; | 409 void AddActivationObserver(WmActivationObserver* observer); |
| 405 virtual void RemoveActivationObserver(WmActivationObserver* observer) = 0; | 410 void RemoveActivationObserver(WmActivationObserver* observer); |
| 406 | 411 |
| 407 virtual void AddDisplayObserver(WmDisplayObserver* observer) = 0; | 412 virtual void AddDisplayObserver(WmDisplayObserver* observer) = 0; |
| 408 virtual void RemoveDisplayObserver(WmDisplayObserver* observer) = 0; | 413 virtual void RemoveDisplayObserver(WmDisplayObserver* observer) = 0; |
| 409 | 414 |
| 410 void AddShellObserver(ShellObserver* observer); | 415 void AddShellObserver(ShellObserver* observer); |
| 411 void RemoveShellObserver(ShellObserver* observer); | 416 void RemoveShellObserver(ShellObserver* observer); |
| 412 | 417 |
| 413 // If |events| is PointerWatcherEventTypes::MOVES, | 418 // If |events| is PointerWatcherEventTypes::MOVES, |
| 414 // PointerWatcher::OnPointerEventObserved() is called for pointer move events. | 419 // PointerWatcher::OnPointerEventObserved() is called for pointer move events. |
| 415 // If |events| is PointerWatcherEventTypes::DRAGS, | 420 // If |events| is PointerWatcherEventTypes::DRAGS, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 437 | 442 |
| 438 // True if any touch points are down. | 443 // True if any touch points are down. |
| 439 virtual bool IsTouchDown() = 0; | 444 virtual bool IsTouchDown() = 0; |
| 440 | 445 |
| 441 // TODO(jamescook): Remove this when VirtualKeyboardController has been moved. | 446 // TODO(jamescook): Remove this when VirtualKeyboardController has been moved. |
| 442 virtual void ToggleIgnoreExternalKeyboard() = 0; | 447 virtual void ToggleIgnoreExternalKeyboard() = 0; |
| 443 | 448 |
| 444 // Enable or disable the laser pointer. | 449 // Enable or disable the laser pointer. |
| 445 virtual void SetLaserPointerEnabled(bool enabled) = 0; | 450 virtual void SetLaserPointerEnabled(bool enabled) = 0; |
| 446 | 451 |
| 452 virtual void CreatePointerWatcherAdapter() = 0; |
| 453 |
| 447 protected: | 454 protected: |
| 448 explicit WmShell(std::unique_ptr<ShellDelegate> shell_delegate); | 455 explicit WmShell(std::unique_ptr<ShellDelegate> shell_delegate); |
| 449 ~WmShell() override; | 456 |
| 457 // Called during startup to create the primary WindowTreeHost and |
| 458 // the corresponding RootWindowController. |
| 459 virtual void CreatePrimaryHost() = 0; |
| 460 virtual void InitHosts(const ShellInitParams& init_params) = 0; |
| 450 | 461 |
| 451 base::ObserverList<ShellObserver>* shell_observers() { | 462 base::ObserverList<ShellObserver>* shell_observers() { |
| 452 return &shell_observers_; | 463 return &shell_observers_; |
| 453 } | 464 } |
| 454 | 465 |
| 455 void SetKeyboardUI(std::unique_ptr<KeyboardUI> keyboard_ui); | 466 void SetKeyboardUI(std::unique_ptr<KeyboardUI> keyboard_ui); |
| 456 | 467 |
| 457 // Helpers to set (and initialize) or destroy various delegates. | 468 // Helpers to set (and initialize) or destroy various delegates. |
| 458 // TODO(msw|jamescook): Remove these once ShellDelegate, etc. are ported. | 469 // TODO(msw|jamescook): Remove these once ShellDelegate, etc. are ported. |
| 459 void SetSystemTrayDelegate(std::unique_ptr<SystemTrayDelegate> delegate); | 470 void SetSystemTrayDelegate(std::unique_ptr<SystemTrayDelegate> delegate); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 476 | 487 |
| 477 // SessionStateObserver: | 488 // SessionStateObserver: |
| 478 void SessionStateChanged(session_manager::SessionState state) override; | 489 void SessionStateChanged(session_manager::SessionState state) override; |
| 479 | 490 |
| 480 private: | 491 private: |
| 481 friend class AcceleratorControllerTest; | 492 friend class AcceleratorControllerTest; |
| 482 friend class ScopedRootWindowForNewWindows; | 493 friend class ScopedRootWindowForNewWindows; |
| 483 friend class Shell; | 494 friend class Shell; |
| 484 friend class WmShellTestApi; | 495 friend class WmShellTestApi; |
| 485 | 496 |
| 497 // aura::client::ActivationChangeObserver: |
| 498 void OnWindowActivated(ActivationReason reason, |
| 499 aura::Window* gained_active, |
| 500 aura::Window* lost_active) override; |
| 501 void OnAttemptToReactivateWindow(aura::Window* request_active, |
| 502 aura::Window* actual_active) override; |
| 503 |
| 486 static WmShell* instance_; | 504 static WmShell* instance_; |
| 487 | 505 |
| 488 base::ObserverList<ShellObserver> shell_observers_; | 506 base::ObserverList<ShellObserver> shell_observers_; |
| 489 std::unique_ptr<ShellDelegate> delegate_; | 507 std::unique_ptr<ShellDelegate> delegate_; |
| 490 | 508 |
| 491 scoped_refptr<preferences::PrefObserverStore> pref_store_; | 509 scoped_refptr<preferences::PrefObserverStore> pref_store_; |
| 492 | 510 |
| 493 std::unique_ptr<AcceleratorController> accelerator_controller_; | 511 std::unique_ptr<AcceleratorController> accelerator_controller_; |
| 494 std::unique_ptr<AccessibilityDelegate> accessibility_delegate_; | 512 std::unique_ptr<AccessibilityDelegate> accessibility_delegate_; |
| 495 std::unique_ptr<app_list::AppList> app_list_; | 513 std::unique_ptr<app_list::AppList> app_list_; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 524 std::unique_ptr<ui::devtools::UiDevToolsServer> devtools_server_; | 542 std::unique_ptr<ui::devtools::UiDevToolsServer> devtools_server_; |
| 525 | 543 |
| 526 base::ObserverList<LockStateObserver> lock_state_observers_; | 544 base::ObserverList<LockStateObserver> lock_state_observers_; |
| 527 | 545 |
| 528 // See comment for GetRootWindowForNewWindows(). | 546 // See comment for GetRootWindowForNewWindows(). |
| 529 WmWindow* root_window_for_new_windows_ = nullptr; | 547 WmWindow* root_window_for_new_windows_ = nullptr; |
| 530 WmWindow* scoped_root_window_for_new_windows_ = nullptr; | 548 WmWindow* scoped_root_window_for_new_windows_ = nullptr; |
| 531 | 549 |
| 532 bool simulate_modal_window_open_for_testing_ = false; | 550 bool simulate_modal_window_open_for_testing_ = false; |
| 533 | 551 |
| 552 bool added_activation_observer_ = false; |
| 553 base::ObserverList<WmActivationObserver> activation_observers_; |
| 554 |
| 534 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; | 555 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; |
| 535 }; | 556 }; |
| 536 | 557 |
| 537 } // namespace ash | 558 } // namespace ash |
| 538 | 559 |
| 539 #endif // ASH_COMMON_WM_SHELL_H_ | 560 #endif // ASH_COMMON_WM_SHELL_H_ |
| OLD | NEW |