| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_WINDOW_MANAGER_H_ | 5 #ifndef ASH_MUS_WINDOW_MANAGER_H_ |
| 6 #define ASH_MUS_WINDOW_MANAGER_H_ | 6 #define ASH_MUS_WINDOW_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <set> | 11 #include <set> |
| 12 | 12 |
| 13 #include "ash/common/shell_delegate.h" |
| 13 #include "ash/root_window_controller.h" | 14 #include "ash/root_window_controller.h" |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 16 #include "services/ui/common/types.h" | 17 #include "services/ui/common/types.h" |
| 17 #include "services/ui/public/interfaces/display/display_controller.mojom.h" | 18 #include "services/ui/public/interfaces/display/display_controller.mojom.h" |
| 18 #include "services/ui/public/interfaces/window_manager.mojom.h" | 19 #include "services/ui/public/interfaces/window_manager.mojom.h" |
| 19 #include "ui/aura/mus/window_manager_delegate.h" | 20 #include "ui/aura/mus/window_manager_delegate.h" |
| 20 #include "ui/aura/mus/window_tree_client_delegate.h" | 21 #include "ui/aura/mus/window_tree_client_delegate.h" |
| 21 | 22 |
| 22 namespace base { | 23 namespace base { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 36 } | 37 } |
| 37 | 38 |
| 38 namespace wm { | 39 namespace wm { |
| 39 class WMState; | 40 class WMState; |
| 40 } | 41 } |
| 41 | 42 |
| 42 namespace ash { | 43 namespace ash { |
| 43 | 44 |
| 44 class RootWindowController; | 45 class RootWindowController; |
| 45 class ScreenMus; | 46 class ScreenMus; |
| 46 class ShellDelegate; | 47 |
| 48 enum class Config; |
| 47 | 49 |
| 48 namespace test { | 50 namespace test { |
| 49 class AshTestHelper; | 51 class AshTestHelper; |
| 50 } | 52 } |
| 51 | 53 |
| 52 namespace mus { | 54 namespace mus { |
| 53 | 55 |
| 54 class AcceleratorHandler; | 56 class AcceleratorHandler; |
| 55 class WmTestHelper; | 57 class WmTestHelper; |
| 56 | 58 |
| 57 // WindowManager serves as the WindowManagerDelegate and | 59 // WindowManager serves as the WindowManagerDelegate and |
| 58 // WindowTreeClientDelegate for mash. WindowManager creates (and owns) | 60 // WindowTreeClientDelegate for mash. WindowManager creates (and owns) |
| 59 // a RootWindowController per Display. WindowManager takes ownership of | 61 // a RootWindowController per Display. WindowManager takes ownership of |
| 60 // the WindowTreeClient. | 62 // the WindowTreeClient. |
| 61 class WindowManager : public aura::WindowManagerDelegate, | 63 class WindowManager : public aura::WindowManagerDelegate, |
| 62 public aura::WindowTreeClientDelegate { | 64 public aura::WindowTreeClientDelegate { |
| 63 public: | 65 public: |
| 64 explicit WindowManager(service_manager::Connector* connector); | 66 WindowManager(service_manager::Connector* connector, Config config); |
| 65 ~WindowManager() override; | 67 ~WindowManager() override; |
| 66 | 68 |
| 67 void Init(std::unique_ptr<aura::WindowTreeClient> window_tree_client, | 69 void Init(std::unique_ptr<aura::WindowTreeClient> window_tree_client, |
| 68 const scoped_refptr<base::SequencedWorkerPool>& blocking_pool); | 70 const scoped_refptr<base::SequencedWorkerPool>& blocking_pool, |
| 71 std::unique_ptr<ash::ShellDelegate> shell_delegate = nullptr); |
| 72 |
| 73 // Blocks waiting for the initial set of displays. |
| 74 bool WaitForInitialDisplays(); |
| 69 | 75 |
| 70 // Called during shutdown to delete all the RootWindowControllers. | 76 // Called during shutdown to delete all the RootWindowControllers. |
| 71 void DeleteAllRootWindowControllers(); | 77 void DeleteAllRootWindowControllers(); |
| 72 | 78 |
| 79 Config config() const { return config_; } |
| 80 |
| 73 ScreenMus* screen() { return screen_.get(); } | 81 ScreenMus* screen() { return screen_.get(); } |
| 74 | 82 |
| 75 aura::WindowTreeClient* window_tree_client() { | 83 aura::WindowTreeClient* window_tree_client() { |
| 76 return window_tree_client_.get(); | 84 return window_tree_client_.get(); |
| 77 } | 85 } |
| 78 | 86 |
| 79 aura::WindowManagerClient* window_manager_client() { | 87 aura::WindowManagerClient* window_manager_client() { |
| 80 return window_manager_client_; | 88 return window_manager_client_; |
| 81 } | 89 } |
| 82 | 90 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 void OnWmSetClientArea( | 183 void OnWmSetClientArea( |
| 176 aura::Window* window, | 184 aura::Window* window, |
| 177 const gfx::Insets& insets, | 185 const gfx::Insets& insets, |
| 178 const std::vector<gfx::Rect>& additional_client_areas) override; | 186 const std::vector<gfx::Rect>& additional_client_areas) override; |
| 179 bool IsWindowActive(aura::Window* window) override; | 187 bool IsWindowActive(aura::Window* window) override; |
| 180 void OnWmDeactivateWindow(aura::Window* window) override; | 188 void OnWmDeactivateWindow(aura::Window* window) override; |
| 181 | 189 |
| 182 service_manager::Connector* connector_; | 190 service_manager::Connector* connector_; |
| 183 display::mojom::DisplayControllerPtr display_controller_; | 191 display::mojom::DisplayControllerPtr display_controller_; |
| 184 | 192 |
| 193 const Config config_; |
| 194 |
| 185 std::unique_ptr<::wm::WMState> wm_state_; | 195 std::unique_ptr<::wm::WMState> wm_state_; |
| 186 std::unique_ptr<aura::PropertyConverter> property_converter_; | 196 std::unique_ptr<aura::PropertyConverter> property_converter_; |
| 187 | 197 |
| 188 std::unique_ptr<aura::WindowTreeClient> window_tree_client_; | 198 std::unique_ptr<aura::WindowTreeClient> window_tree_client_; |
| 189 | 199 |
| 190 aura::WindowManagerClient* window_manager_client_ = nullptr; | 200 aura::WindowManagerClient* window_manager_client_ = nullptr; |
| 191 | 201 |
| 192 std::unique_ptr<views::PointerWatcherEventRouter> | 202 std::unique_ptr<views::PointerWatcherEventRouter> |
| 193 pointer_watcher_event_router_; | 203 pointer_watcher_event_router_; |
| 194 | 204 |
| 195 RootWindowControllers root_window_controllers_; | 205 RootWindowControllers root_window_controllers_; |
| 196 | 206 |
| 197 std::unique_ptr<ScreenMus> screen_; | 207 std::unique_ptr<ScreenMus> screen_; |
| 198 | 208 |
| 199 bool created_shell_ = false; | 209 bool created_shell_ = false; |
| 200 | 210 |
| 201 std::map<uint16_t, AcceleratorHandler*> accelerator_handlers_; | 211 std::map<uint16_t, AcceleratorHandler*> accelerator_handlers_; |
| 202 uint16_t next_accelerator_namespace_id_ = 0u; | 212 uint16_t next_accelerator_namespace_id_ = 0u; |
| 203 | 213 |
| 204 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; | 214 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; |
| 205 | 215 |
| 206 // Only set in tests. If non-null this is used as the shell delegate. | 216 // The ShellDelegate to install. This may be null, in which case |
| 207 std::unique_ptr<ShellDelegate> shell_delegate_for_test_; | 217 // ShellDelegateMus is used. |
| 218 std::unique_ptr<ShellDelegate> shell_delegate_; |
| 208 | 219 |
| 209 // See WmShellMus's constructor for details. Tests may set to false. | 220 // See WmShellMus's constructor for details. Tests may set to false. |
| 210 bool create_session_state_delegate_stub_for_test_ = true; | 221 bool create_session_state_delegate_stub_for_test_ = true; |
| 211 | 222 |
| 212 // State that is only valid during a drag. | 223 // State that is only valid during a drag. |
| 213 struct DragState; | 224 struct DragState; |
| 214 std::unique_ptr<DragState> drag_state_; | 225 std::unique_ptr<DragState> drag_state_; |
| 215 | 226 |
| 216 DISALLOW_COPY_AND_ASSIGN(WindowManager); | 227 DISALLOW_COPY_AND_ASSIGN(WindowManager); |
| 217 }; | 228 }; |
| 218 | 229 |
| 219 } // namespace mus | 230 } // namespace mus |
| 220 } // namespace ash | 231 } // namespace ash |
| 221 | 232 |
| 222 #endif // ASH_MUS_WINDOW_MANAGER_H_ | 233 #endif // ASH_MUS_WINDOW_MANAGER_H_ |
| OLD | NEW |