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