| 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 MASH_WM_ROOT_WINDOW_CONTROLLER_H_ | 5 #ifndef MASH_WM_ROOT_WINDOW_CONTROLLER_H_ |
| 6 #define MASH_WM_ROOT_WINDOW_CONTROLLER_H_ | 6 #define MASH_WM_ROOT_WINDOW_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "components/mus/public/cpp/window_observer.h" | 10 #include "components/mus/public/cpp/window_observer.h" |
| 11 #include "components/mus/public/cpp/window_tree_delegate.h" | 11 #include "components/mus/public/cpp/window_tree_delegate.h" |
| 12 #include "components/mus/public/interfaces/window_manager_constants.mojom.h" | 12 #include "components/mus/public/interfaces/window_manager_constants.mojom.h" |
| 13 #include "components/mus/public/interfaces/window_tree_host.mojom.h" | 13 #include "components/mus/public/interfaces/window_tree_host.mojom.h" |
| 14 #include "mash/wm/public/interfaces/container.mojom.h" | 14 #include "mash/wm/public/interfaces/container.mojom.h" |
| 15 #include "mojo/public/cpp/bindings/binding.h" | 15 #include "mojo/public/cpp/bindings/binding.h" |
| 16 #include "ui/display/display.h" | 16 #include "ui/display/display.h" |
| 17 | 17 |
| 18 namespace ash { |
| 19 class AlwaysOnTopController; |
| 20 } |
| 21 |
| 18 namespace mus { | 22 namespace mus { |
| 19 class WindowManagerClient; | 23 class WindowManagerClient; |
| 20 } | 24 } |
| 21 | 25 |
| 22 namespace shell { | 26 namespace shell { |
| 23 class Connector; | 27 class Connector; |
| 24 } | 28 } |
| 25 | 29 |
| 26 namespace ui { | 30 namespace ui { |
| 27 class Event; | 31 class Event; |
| 28 } | 32 } |
| 29 | 33 |
| 30 namespace mash { | 34 namespace mash { |
| 31 namespace wm { | 35 namespace wm { |
| 32 | 36 |
| 33 class LayoutManager; | 37 class LayoutManager; |
| 34 class ShadowController; | 38 class ShadowController; |
| 35 class ShelfLayoutManager; | 39 class ShelfLayoutManager; |
| 36 class StatusLayoutManager; | 40 class StatusLayoutManager; |
| 37 class WindowManager; | 41 class WindowManager; |
| 38 class WindowManagerApplication; | 42 class WindowManagerApplication; |
| 43 class WmRootWindowControllerMus; |
| 44 class WmShelfMus; |
| 45 class WmTestBase; |
| 46 class WmTestHelper; |
| 39 | 47 |
| 40 // RootWindowController manages the windows and state for a single display. | 48 // RootWindowController manages the windows and state for a single display. |
| 41 // | 49 // |
| 42 // RootWindowController deletes itself when the root mus::Window is destroyed. | 50 // RootWindowController deletes itself when the root mus::Window is destroyed. |
| 43 // You can trigger deletion explicitly by way of Destroy(). | 51 // You can trigger deletion explicitly by way of Destroy(). |
| 44 class RootWindowController : public mus::WindowObserver, | 52 class RootWindowController : public mus::WindowObserver, |
| 45 public mus::WindowTreeDelegate { | 53 public mus::WindowTreeDelegate { |
| 46 public: | 54 public: |
| 47 static RootWindowController* CreateFromDisplay( | 55 static RootWindowController* CreateFromDisplay( |
| 48 WindowManagerApplication* app, | 56 WindowManagerApplication* app, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 66 | 74 |
| 67 mus::WindowManagerClient* window_manager_client(); | 75 mus::WindowManagerClient* window_manager_client(); |
| 68 | 76 |
| 69 void OnAccelerator(uint32_t id, const ui::Event& event); | 77 void OnAccelerator(uint32_t id, const ui::Event& event); |
| 70 | 78 |
| 71 const display::Display& display() const { return display_; } | 79 const display::Display& display() const { return display_; } |
| 72 | 80 |
| 73 ShelfLayoutManager* GetShelfLayoutManager(); | 81 ShelfLayoutManager* GetShelfLayoutManager(); |
| 74 StatusLayoutManager* GetStatusLayoutManager(); | 82 StatusLayoutManager* GetStatusLayoutManager(); |
| 75 | 83 |
| 84 ash::AlwaysOnTopController* always_on_top_controller() { |
| 85 return always_on_top_controller_.get(); |
| 86 } |
| 87 |
| 88 WmShelfMus* wm_shelf() { return wm_shelf_.get(); } |
| 89 |
| 76 private: | 90 private: |
| 91 friend class WmTestBase; |
| 92 friend class WmTestHelper; |
| 93 |
| 77 explicit RootWindowController(WindowManagerApplication* app); | 94 explicit RootWindowController(WindowManagerApplication* app); |
| 78 ~RootWindowController() override; | 95 ~RootWindowController() override; |
| 79 | 96 |
| 80 void AddAccelerators(); | 97 void AddAccelerators(); |
| 81 | 98 |
| 82 // WindowTreeDelegate: | 99 // WindowTreeDelegate: |
| 83 void OnEmbed(mus::Window* root) override; | 100 void OnEmbed(mus::Window* root) override; |
| 84 void OnConnectionLost(mus::WindowTreeConnection* connection) override; | 101 void OnConnectionLost(mus::WindowTreeConnection* connection) override; |
| 85 void OnEventObserved(const ui::Event& event, mus::Window* target) override; | 102 void OnEventObserved(const ui::Event& event, mus::Window* target) override; |
| 86 | 103 |
| 87 // mus::WindowObserver: | 104 // mus::WindowObserver: |
| 88 void OnWindowDestroyed(mus::Window* window) override; | 105 void OnWindowDestroyed(mus::Window* window) override; |
| 89 | 106 |
| 90 // Sets up the window containers used for z-space management. | 107 // Sets up the window containers used for z-space management. |
| 91 void CreateContainer(mash::wm::mojom::Container container, | 108 void CreateContainer(mash::wm::mojom::Container container, |
| 92 mash::wm::mojom::Container parent_container); | 109 mash::wm::mojom::Container parent_container); |
| 93 void CreateContainers(); | 110 void CreateContainers(); |
| 94 | 111 |
| 95 WindowManagerApplication* app_; | 112 WindowManagerApplication* app_; |
| 96 mus::Window* root_; | 113 mus::Window* root_; |
| 97 int window_count_; | 114 int window_count_; |
| 98 | 115 |
| 116 std::unique_ptr<WmRootWindowControllerMus> wm_root_window_controller_; |
| 117 std::unique_ptr<WmShelfMus> wm_shelf_; |
| 118 |
| 99 std::unique_ptr<WindowManager> window_manager_; | 119 std::unique_ptr<WindowManager> window_manager_; |
| 100 | 120 |
| 101 std::map<mus::Window*, std::unique_ptr<LayoutManager>> layout_managers_; | 121 std::map<mus::Window*, std::unique_ptr<LayoutManager>> layout_managers_; |
| 102 | 122 |
| 103 std::unique_ptr<ShadowController> shadow_controller_; | 123 std::unique_ptr<ShadowController> shadow_controller_; |
| 104 | 124 |
| 105 display::Display display_; | 125 display::Display display_; |
| 106 | 126 |
| 127 std::unique_ptr<ash::AlwaysOnTopController> always_on_top_controller_; |
| 128 |
| 107 DISALLOW_COPY_AND_ASSIGN(RootWindowController); | 129 DISALLOW_COPY_AND_ASSIGN(RootWindowController); |
| 108 }; | 130 }; |
| 109 | 131 |
| 110 } // namespace wm | 132 } // namespace wm |
| 111 } // namespace mash | 133 } // namespace mash |
| 112 | 134 |
| 113 #endif // MASH_WM_ROOT_WINDOW_CONTROLLER_H_ | 135 #endif // MASH_WM_ROOT_WINDOW_CONTROLLER_H_ |
| OLD | NEW |