| 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> |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 class ShadowController; | 35 class ShadowController; |
| 36 class WindowManagerObserver; | 36 class WindowManagerObserver; |
| 37 class WmShellMus; | 37 class WmShellMus; |
| 38 class WmLookupMus; | 38 class WmLookupMus; |
| 39 class WmTestHelper; | 39 class WmTestHelper; |
| 40 | 40 |
| 41 // WindowManager serves as the WindowManagerDelegate and | 41 // WindowManager serves as the WindowManagerDelegate and |
| 42 // WindowTreeClientDelegate for mash. WindowManager creates (and owns) | 42 // WindowTreeClientDelegate for mash. WindowManager creates (and owns) |
| 43 // a RootWindowController per Display. WindowManager takes ownership of | 43 // a RootWindowController per Display. WindowManager takes ownership of |
| 44 // the WindowTreeClient. | 44 // the WindowTreeClient. |
| 45 class WindowManager : public ::ui::WindowManagerDelegate, | 45 class WindowManager : public ui::WindowManagerDelegate, |
| 46 public ::ui::WindowObserver, | 46 public ui::WindowObserver, |
| 47 public ::ui::WindowTreeClientDelegate { | 47 public ui::WindowTreeClientDelegate { |
| 48 public: | 48 public: |
| 49 explicit WindowManager(shell::Connector* connector); | 49 explicit WindowManager(shell::Connector* connector); |
| 50 ~WindowManager() override; | 50 ~WindowManager() override; |
| 51 | 51 |
| 52 void Init(::ui::WindowTreeClient* window_tree_client); | 52 void Init(ui::WindowTreeClient* window_tree_client); |
| 53 | 53 |
| 54 WmShellMus* shell() { return shell_.get(); } | 54 WmShellMus* shell() { return shell_.get(); } |
| 55 | 55 |
| 56 ::ui::WindowTreeClient* window_tree_client() { return window_tree_client_; } | 56 ui::WindowTreeClient* window_tree_client() { return window_tree_client_; } |
| 57 | 57 |
| 58 ::ui::WindowManagerClient* window_manager_client() { | 58 ui::WindowManagerClient* window_manager_client() { |
| 59 return window_manager_client_; | 59 return window_manager_client_; |
| 60 } | 60 } |
| 61 | 61 |
| 62 shell::Connector* connector() { return connector_; } | 62 shell::Connector* connector() { return connector_; } |
| 63 | 63 |
| 64 void SetScreenLocked(bool is_locked); | 64 void SetScreenLocked(bool is_locked); |
| 65 | 65 |
| 66 // Creates a new top level window. | 66 // Creates a new top level window. |
| 67 ::ui::Window* NewTopLevelWindow( | 67 ui::Window* NewTopLevelWindow( |
| 68 std::map<std::string, std::vector<uint8_t>>* properties); | 68 std::map<std::string, std::vector<uint8_t>>* properties); |
| 69 | 69 |
| 70 std::set<RootWindowController*> GetRootWindowControllers(); | 70 std::set<RootWindowController*> GetRootWindowControllers(); |
| 71 | 71 |
| 72 // Returns the next accelerator namespace id by value in |id|. Returns true | 72 // Returns the next accelerator namespace id by value in |id|. Returns true |
| 73 // if there is another slot available, false if all slots are taken up. | 73 // if there is another slot available, false if all slots are taken up. |
| 74 bool GetNextAcceleratorNamespaceId(uint16_t* id); | 74 bool GetNextAcceleratorNamespaceId(uint16_t* id); |
| 75 void AddAcceleratorHandler(uint16_t id_namespace, | 75 void AddAcceleratorHandler(uint16_t id_namespace, |
| 76 AcceleratorHandler* handler); | 76 AcceleratorHandler* handler); |
| 77 void RemoveAcceleratorHandler(uint16_t id_namespace); | 77 void RemoveAcceleratorHandler(uint16_t id_namespace); |
| 78 | 78 |
| 79 void AddObserver(WindowManagerObserver* observer); | 79 void AddObserver(WindowManagerObserver* observer); |
| 80 void RemoveObserver(WindowManagerObserver* observer); | 80 void RemoveObserver(WindowManagerObserver* observer); |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 friend class WmTestHelper; | 83 friend class WmTestHelper; |
| 84 | 84 |
| 85 RootWindowController* CreateRootWindowController( | 85 RootWindowController* CreateRootWindowController( |
| 86 ::ui::Window* window, | 86 ui::Window* window, |
| 87 const display::Display& display); | 87 const display::Display& display); |
| 88 | 88 |
| 89 // ::ui::WindowObserver: | 89 // ui::WindowObserver: |
| 90 void OnWindowDestroying(::ui::Window* window) override; | 90 void OnWindowDestroying(ui::Window* window) override; |
| 91 void OnWindowDestroyed(::ui::Window* window) override; | 91 void OnWindowDestroyed(ui::Window* window) override; |
| 92 | 92 |
| 93 // WindowTreeClientDelegate: | 93 // WindowTreeClientDelegate: |
| 94 void OnEmbed(::ui::Window* root) override; | 94 void OnEmbed(ui::Window* root) override; |
| 95 void OnDidDestroyClient(::ui::WindowTreeClient* client) override; | 95 void OnDidDestroyClient(ui::WindowTreeClient* client) override; |
| 96 void OnEventObserved(const ui::Event& event, ::ui::Window* target) override; | 96 void OnEventObserved(const ui::Event& event, ui::Window* target) override; |
| 97 | 97 |
| 98 // WindowManagerDelegate: | 98 // WindowManagerDelegate: |
| 99 void SetWindowManagerClient(::ui::WindowManagerClient* client) override; | 99 void SetWindowManagerClient(ui::WindowManagerClient* client) override; |
| 100 bool OnWmSetBounds(::ui::Window* window, gfx::Rect* bounds) override; | 100 bool OnWmSetBounds(ui::Window* window, gfx::Rect* bounds) override; |
| 101 bool OnWmSetProperty( | 101 bool OnWmSetProperty( |
| 102 ::ui::Window* window, | 102 ui::Window* window, |
| 103 const std::string& name, | 103 const std::string& name, |
| 104 std::unique_ptr<std::vector<uint8_t>>* new_data) override; | 104 std::unique_ptr<std::vector<uint8_t>>* new_data) override; |
| 105 ::ui::Window* OnWmCreateTopLevelWindow( | 105 ui::Window* OnWmCreateTopLevelWindow( |
| 106 std::map<std::string, std::vector<uint8_t>>* properties) override; | 106 std::map<std::string, std::vector<uint8_t>>* properties) override; |
| 107 void OnWmClientJankinessChanged(const std::set<::ui::Window*>& client_windows, | 107 void OnWmClientJankinessChanged(const std::set<ui::Window*>& client_windows, |
| 108 bool not_responding) override; | 108 bool not_responding) override; |
| 109 void OnWmNewDisplay(::ui::Window* window, | 109 void OnWmNewDisplay(ui::Window* window, |
| 110 const display::Display& display) override; | 110 const display::Display& display) override; |
| 111 void OnWmPerformMoveLoop(::ui::Window* window, | 111 void OnWmPerformMoveLoop(ui::Window* window, |
| 112 ::ui::mojom::MoveLoopSource source, | 112 ui::mojom::MoveLoopSource source, |
| 113 const gfx::Point& cursor_location, | 113 const gfx::Point& cursor_location, |
| 114 const base::Callback<void(bool)>& on_done) override; | 114 const base::Callback<void(bool)>& on_done) override; |
| 115 void OnWmCancelMoveLoop(::ui::Window* window) override; | 115 void OnWmCancelMoveLoop(ui::Window* window) override; |
| 116 ui::mojom::EventResult OnAccelerator(uint32_t id, | 116 ui::mojom::EventResult OnAccelerator(uint32_t id, |
| 117 const ui::Event& event) override; | 117 const ui::Event& event) override; |
| 118 | 118 |
| 119 shell::Connector* connector_; | 119 shell::Connector* connector_; |
| 120 | 120 |
| 121 ::ui::WindowTreeClient* window_tree_client_ = nullptr; | 121 ui::WindowTreeClient* window_tree_client_ = nullptr; |
| 122 | 122 |
| 123 ::ui::WindowManagerClient* window_manager_client_ = nullptr; | 123 ui::WindowManagerClient* window_manager_client_ = nullptr; |
| 124 | 124 |
| 125 std::unique_ptr<ShadowController> shadow_controller_; | 125 std::unique_ptr<ShadowController> shadow_controller_; |
| 126 | 126 |
| 127 std::set<std::unique_ptr<RootWindowController>> root_window_controllers_; | 127 std::set<std::unique_ptr<RootWindowController>> root_window_controllers_; |
| 128 | 128 |
| 129 base::ObserverList<WindowManagerObserver> observers_; | 129 base::ObserverList<WindowManagerObserver> observers_; |
| 130 | 130 |
| 131 std::unique_ptr<display::Screen> screen_; | 131 std::unique_ptr<display::Screen> screen_; |
| 132 | 132 |
| 133 std::unique_ptr<WmShellMus> shell_; | 133 std::unique_ptr<WmShellMus> shell_; |
| 134 | 134 |
| 135 std::unique_ptr<WmLookupMus> lookup_; | 135 std::unique_ptr<WmLookupMus> lookup_; |
| 136 | 136 |
| 137 std::map<uint16_t, AcceleratorHandler*> accelerator_handlers_; | 137 std::map<uint16_t, AcceleratorHandler*> accelerator_handlers_; |
| 138 uint16_t next_accelerator_namespace_id_ = 0u; | 138 uint16_t next_accelerator_namespace_id_ = 0u; |
| 139 | 139 |
| 140 DISALLOW_COPY_AND_ASSIGN(WindowManager); | 140 DISALLOW_COPY_AND_ASSIGN(WindowManager); |
| 141 }; | 141 }; |
| 142 | 142 |
| 143 } // namespace mus | 143 } // namespace mus |
| 144 } // namespace ash | 144 } // namespace ash |
| 145 | 145 |
| 146 #endif // ASH_MUS_WINDOW_MANAGER_H_ | 146 #endif // ASH_MUS_WINDOW_MANAGER_H_ |
| OLD | NEW |