| 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_MUS_BRIDGE_WM_SHELL_MUS_H_ | 5 #ifndef ASH_MUS_BRIDGE_WM_SHELL_MUS_H_ |
| 6 #define ASH_MUS_BRIDGE_WM_SHELL_MUS_H_ | 6 #define ASH_MUS_BRIDGE_WM_SHELL_MUS_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/common/wm_shell.h" | 13 #include "ash/common/wm_shell.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 #include "services/ui/public/cpp/window_tree_client_observer.h" | 16 #include "ui/wm/public/activation_change_observer.h" |
| 17 | 17 |
| 18 namespace ui { | 18 namespace aura { |
| 19 class WindowTreeClient; | 19 class WindowTreeClient; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace views { | 22 namespace views { |
| 23 class PointerWatcherEventRouter; | 23 class PointerWatcherEventRouter2; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace ash { | 26 namespace ash { |
| 27 namespace mus { | 27 namespace mus { |
| 28 | 28 |
| 29 class AcceleratorControllerDelegateMus; | 29 class AcceleratorControllerDelegateMus; |
| 30 class AcceleratorControllerRegistrar; | 30 class AcceleratorControllerRegistrar; |
| 31 class ImmersiveHandlerFactoryMus; | 31 class ImmersiveHandlerFactoryMus; |
| 32 class WindowManager; | 32 class WindowManager; |
| 33 class WmRootWindowControllerMus; | 33 class WmRootWindowControllerMus; |
| 34 class WmShellMusTestApi; | 34 class WmShellMusTestApi; |
| 35 class WmWindowMus; | 35 class WmWindowMus; |
| 36 | 36 |
| 37 // WmShell implementation for mus. | 37 // WmShell implementation for mus. |
| 38 class WmShellMus : public WmShell, public ui::WindowTreeClientObserver { | 38 class WmShellMus : public WmShell, |
| 39 public aura::client::ActivationChangeObserver { |
| 39 public: | 40 public: |
| 40 WmShellMus(std::unique_ptr<ShellDelegate> shell_delegate, | 41 WmShellMus(std::unique_ptr<ShellDelegate> shell_delegate, |
| 41 WindowManager* window_manager, | 42 WindowManager* window_manager, |
| 42 views::PointerWatcherEventRouter* pointer_watcher_event_router); | 43 views::PointerWatcherEventRouter2* pointer_watcher_event_router); |
| 43 ~WmShellMus() override; | 44 ~WmShellMus() override; |
| 44 | 45 |
| 45 static WmShellMus* Get(); | 46 static WmShellMus* Get(); |
| 46 | 47 |
| 47 void AddRootWindowController(WmRootWindowControllerMus* controller); | 48 void AddRootWindowController(WmRootWindowControllerMus* controller); |
| 48 void RemoveRootWindowController(WmRootWindowControllerMus* controller); | 49 void RemoveRootWindowController(WmRootWindowControllerMus* controller); |
| 49 | 50 |
| 50 // Returns the ancestor of |window| (including |window|) that is considered | 51 // Returns the ancestor of |window| (including |window|) that is considered |
| 51 // toplevel. |window| may be null. | 52 // toplevel. |window| may be null. |
| 52 static WmWindowMus* GetToplevelAncestor(ui::Window* window); | 53 static WmWindowMus* GetToplevelAncestor(aura::Window* window); |
| 53 | 54 |
| 54 WmRootWindowControllerMus* GetRootWindowControllerWithDisplayId(int64_t id); | 55 WmRootWindowControllerMus* GetRootWindowControllerWithDisplayId(int64_t id); |
| 55 | 56 |
| 56 AcceleratorControllerDelegateMus* accelerator_controller_delegate() { | 57 AcceleratorControllerDelegateMus* accelerator_controller_delegate() { |
| 57 return accelerator_controller_delegate_.get(); | 58 return accelerator_controller_delegate_.get(); |
| 58 } | 59 } |
| 59 | 60 |
| 61 aura::WindowTreeClient* window_tree_client(); |
| 62 |
| 63 WindowManager* window_manager() { return window_manager_; } |
| 64 |
| 60 // WmShell: | 65 // WmShell: |
| 61 bool IsRunningInMash() const override; | 66 bool IsRunningInMash() const override; |
| 62 WmWindow* NewWindow(ui::wm::WindowType window_type, | 67 WmWindow* NewWindow(ui::wm::WindowType window_type, |
| 63 ui::LayerType layer_type) override; | 68 ui::LayerType layer_type) override; |
| 64 WmWindow* GetFocusedWindow() override; | 69 WmWindow* GetFocusedWindow() override; |
| 65 WmWindow* GetActiveWindow() override; | 70 WmWindow* GetActiveWindow() override; |
| 66 WmWindow* GetCaptureWindow() override; | 71 WmWindow* GetCaptureWindow() override; |
| 67 WmWindow* GetPrimaryRootWindow() override; | 72 WmWindow* GetPrimaryRootWindow() override; |
| 68 WmWindow* GetRootWindowForDisplayId(int64_t display_id) override; | 73 WmWindow* GetRootWindowForDisplayId(int64_t display_id) override; |
| 69 const display::ManagedDisplayInfo& GetDisplayInfo( | 74 const display::ManagedDisplayInfo& GetDisplayInfo( |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 void RequestShutdown() override; | 116 void RequestShutdown() override; |
| 112 bool IsTouchDown() override; | 117 bool IsTouchDown() override; |
| 113 #if defined(OS_CHROMEOS) | 118 #if defined(OS_CHROMEOS) |
| 114 void ToggleIgnoreExternalKeyboard() override; | 119 void ToggleIgnoreExternalKeyboard() override; |
| 115 void SetLaserPointerEnabled(bool enabled) override; | 120 void SetLaserPointerEnabled(bool enabled) override; |
| 116 #endif | 121 #endif |
| 117 | 122 |
| 118 private: | 123 private: |
| 119 friend class WmShellMusTestApi; | 124 friend class WmShellMusTestApi; |
| 120 | 125 |
| 121 ui::WindowTreeClient* window_tree_client(); | 126 // Returns true if |window| is a window that can have active children. |
| 127 static bool IsActivationParent(aura::Window* window); |
| 122 | 128 |
| 123 // Returns true if |window| is a window that can have active children. | 129 // aura::client::ActivationChangeObserver: |
| 124 static bool IsActivationParent(ui::Window* window); | 130 void OnWindowActivated(ActivationReason reason, |
| 125 | 131 aura::Window* gained_active, |
| 126 // ui::WindowTreeClientObserver: | 132 aura::Window* lost_active) override; |
| 127 void OnWindowTreeFocusChanged(ui::Window* gained_focus, | |
| 128 ui::Window* lost_focus) override; | |
| 129 void OnDidDestroyClient(ui::WindowTreeClient* client) override; | |
| 130 | 133 |
| 131 WindowManager* window_manager_; | 134 WindowManager* window_manager_; |
| 132 | 135 |
| 133 views::PointerWatcherEventRouter* pointer_watcher_event_router_; | 136 views::PointerWatcherEventRouter2* pointer_watcher_event_router_; |
| 134 | 137 |
| 135 std::vector<WmRootWindowControllerMus*> root_window_controllers_; | 138 std::vector<WmRootWindowControllerMus*> root_window_controllers_; |
| 136 | 139 |
| 137 std::unique_ptr<AcceleratorControllerDelegateMus> | 140 std::unique_ptr<AcceleratorControllerDelegateMus> |
| 138 accelerator_controller_delegate_; | 141 accelerator_controller_delegate_; |
| 139 std::unique_ptr<AcceleratorControllerRegistrar> | 142 std::unique_ptr<AcceleratorControllerRegistrar> |
| 140 accelerator_controller_registrar_; | 143 accelerator_controller_registrar_; |
| 141 std::unique_ptr<ImmersiveHandlerFactoryMus> immersive_handler_factory_; | 144 std::unique_ptr<ImmersiveHandlerFactoryMus> immersive_handler_factory_; |
| 142 std::unique_ptr<SessionStateDelegate> session_state_delegate_; | 145 std::unique_ptr<SessionStateDelegate> session_state_delegate_; |
| 143 | 146 |
| 144 base::ObserverList<WmActivationObserver> activation_observers_; | 147 base::ObserverList<WmActivationObserver> activation_observers_; |
| 145 | 148 |
| 146 DISALLOW_COPY_AND_ASSIGN(WmShellMus); | 149 DISALLOW_COPY_AND_ASSIGN(WmShellMus); |
| 147 }; | 150 }; |
| 148 | 151 |
| 149 } // namespace mus | 152 } // namespace mus |
| 150 } // namespace ash | 153 } // namespace ash |
| 151 | 154 |
| 152 #endif // ASH_MUS_BRIDGE_WM_SHELL_MUS_H_ | 155 #endif // ASH_MUS_BRIDGE_WM_SHELL_MUS_H_ |
| OLD | NEW |