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 MASH_WM_WINDOW_MANAGER_APPLICATION_H_ | 5 #ifndef ASH_MUS_WINDOW_MANAGER_APPLICATION_H_ |
6 #define MASH_WM_WINDOW_MANAGER_APPLICATION_H_ | 6 #define ASH_MUS_WINDOW_MANAGER_APPLICATION_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/public/interfaces/shelf_layout.mojom.h" | 13 #include "ash/public/interfaces/shelf_layout.mojom.h" |
14 #include "ash/public/interfaces/user_window_controller.mojom.h" | 14 #include "ash/public/interfaces/user_window_controller.mojom.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
(...skipping 13 matching lines...) Expand all Loading... |
30 } | 30 } |
31 | 31 |
32 namespace views { | 32 namespace views { |
33 class AuraInit; | 33 class AuraInit; |
34 } | 34 } |
35 | 35 |
36 namespace ui { | 36 namespace ui { |
37 class Event; | 37 class Event; |
38 } | 38 } |
39 | 39 |
40 namespace mash { | 40 namespace ash { |
41 namespace wm { | 41 namespace mus { |
42 | 42 |
43 class AcceleratorRegistrarImpl; | 43 class AcceleratorRegistrarImpl; |
44 class RootWindowController; | 44 class RootWindowController; |
45 class RootWindowsObserver; | 45 class RootWindowsObserver; |
46 class ShelfLayoutImpl; | 46 class ShelfLayoutImpl; |
47 class UserWindowControllerImpl; | 47 class UserWindowControllerImpl; |
48 class WmGlobalsMus; | 48 class WmGlobalsMus; |
49 class WmLookupMus; | 49 class WmLookupMus; |
50 class WmScreen; | 50 class WmScreen; |
51 | 51 |
52 class WindowManagerApplication | 52 class WindowManagerApplication |
53 : public shell::ShellClient, | 53 : public shell::ShellClient, |
54 public mus::mojom::WindowManagerFactory, | 54 public ::mus::mojom::WindowManagerFactory, |
55 public shell::InterfaceFactory<ash::mojom::ShelfLayout>, | 55 public shell::InterfaceFactory<mojom::ShelfLayout>, |
56 public shell::InterfaceFactory<ash::mojom::UserWindowController>, | 56 public shell::InterfaceFactory<mojom::UserWindowController>, |
57 public shell::InterfaceFactory<mus::mojom::AcceleratorRegistrar> { | 57 public shell::InterfaceFactory<::mus::mojom::AcceleratorRegistrar> { |
58 public: | 58 public: |
59 WindowManagerApplication(); | 59 WindowManagerApplication(); |
60 ~WindowManagerApplication() override; | 60 ~WindowManagerApplication() override; |
61 | 61 |
62 shell::Connector* connector() { return connector_; } | 62 shell::Connector* connector() { return connector_; } |
63 | 63 |
64 // Returns the RootWindowControllers that have valid roots. | 64 // Returns the RootWindowControllers that have valid roots. |
65 // | 65 // |
66 // NOTE: this does not return |controllers_| as most clients want a | 66 // NOTE: this does not return |controllers_| as most clients want a |
67 // RootWindowController that has a valid root window. | 67 // RootWindowController that has a valid root window. |
(...skipping 10 matching lines...) Expand all Loading... |
78 // Called when the root mus::Window of RootWindowController is destroyed. | 78 // Called when the root mus::Window of RootWindowController is destroyed. |
79 // |root_controller| is destroyed after this call. | 79 // |root_controller| is destroyed after this call. |
80 void OnRootWindowDestroyed(RootWindowController* root_controller); | 80 void OnRootWindowDestroyed(RootWindowController* root_controller); |
81 | 81 |
82 // TODO(sky): figure out right place for this code. | 82 // TODO(sky): figure out right place for this code. |
83 void OnAccelerator(uint32_t id, const ui::Event& event); | 83 void OnAccelerator(uint32_t id, const ui::Event& event); |
84 | 84 |
85 void AddRootWindowsObserver(RootWindowsObserver* observer); | 85 void AddRootWindowsObserver(RootWindowsObserver* observer); |
86 void RemoveRootWindowsObserver(RootWindowsObserver* observer); | 86 void RemoveRootWindowsObserver(RootWindowsObserver* observer); |
87 | 87 |
88 session::mojom::Session* session() { | 88 mash::session::mojom::Session* session() { return session_.get(); } |
89 return session_.get(); | |
90 } | |
91 | 89 |
92 private: | 90 private: |
93 friend class WmTestBase; | 91 friend class WmTestBase; |
94 friend class WmTestHelper; | 92 friend class WmTestHelper; |
95 | 93 |
96 void OnAcceleratorRegistrarDestroyed(AcceleratorRegistrarImpl* registrar); | 94 void OnAcceleratorRegistrarDestroyed(AcceleratorRegistrarImpl* registrar); |
97 | 95 |
98 // Adds |root_window_controller| to the set of known roots. | 96 // Adds |root_window_controller| to the set of known roots. |
99 void AddRootWindowController(RootWindowController* root_window_controller); | 97 void AddRootWindowController(RootWindowController* root_window_controller); |
100 | 98 |
101 // shell::ShellClient: | 99 // shell::ShellClient: |
102 void Initialize(shell::Connector* connector, | 100 void Initialize(shell::Connector* connector, |
103 const shell::Identity& identity, | 101 const shell::Identity& identity, |
104 uint32_t id) override; | 102 uint32_t id) override; |
105 bool AcceptConnection(shell::Connection* connection) override; | 103 bool AcceptConnection(shell::Connection* connection) override; |
106 | 104 |
107 // shell::InterfaceFactory<ash::mojom::ShelfLayout>: | 105 // shell::InterfaceFactory<mojom::ShelfLayout>: |
108 void Create(shell::Connection* connection, | 106 void Create(shell::Connection* connection, |
109 mojo::InterfaceRequest<ash::mojom::ShelfLayout> request) override; | 107 mojo::InterfaceRequest<mojom::ShelfLayout> request) override; |
110 | 108 |
111 // shell::InterfaceFactory<ash::mojom::UserWindowController>: | 109 // shell::InterfaceFactory<mojom::UserWindowController>: |
112 void Create(shell::Connection* connection, | 110 void Create( |
113 mojo::InterfaceRequest<ash::mojom::UserWindowController> request) | 111 shell::Connection* connection, |
114 override; | 112 mojo::InterfaceRequest<mojom::UserWindowController> request) override; |
115 | 113 |
116 // shell::InterfaceFactory<mus::mojom::AcceleratorRegistrar>: | 114 // shell::InterfaceFactory<mus::mojom::AcceleratorRegistrar>: |
117 void Create(shell::Connection* connection, | 115 void Create(shell::Connection* connection, |
118 mojo::InterfaceRequest<mus::mojom::AcceleratorRegistrar> request) | 116 mojo::InterfaceRequest<::mus::mojom::AcceleratorRegistrar> |
119 override; | 117 request) override; |
120 | 118 |
121 // mus::mojom::WindowManagerFactory: | 119 // mus::mojom::WindowManagerFactory: |
122 void CreateWindowManager(mus::mojom::DisplayPtr display, | 120 void CreateWindowManager( |
123 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> | 121 ::mus::mojom::DisplayPtr display, |
124 client_request) override; | 122 mojo::InterfaceRequest<::mus::mojom::WindowTreeClient> client_request) |
| 123 override; |
125 | 124 |
126 shell::Connector* connector_; | 125 shell::Connector* connector_; |
127 | 126 |
128 mojo::TracingImpl tracing_; | 127 mojo::TracingImpl tracing_; |
129 | 128 |
130 std::unique_ptr<display::Screen> screen_; | 129 std::unique_ptr<display::Screen> screen_; |
131 std::unique_ptr<views::AuraInit> aura_init_; | 130 std::unique_ptr<views::AuraInit> aura_init_; |
132 | 131 |
133 std::unique_ptr<WmGlobalsMus> globals_; | 132 std::unique_ptr<WmGlobalsMus> globals_; |
134 std::unique_ptr<WmLookupMus> lookup_; | 133 std::unique_ptr<WmLookupMus> lookup_; |
135 | 134 |
136 // The |shelf_layout_| object is created once OnEmbed() is called. Until that | 135 // The |shelf_layout_| object is created once OnEmbed() is called. Until that |
137 // time |shelf_layout_requests_| stores pending interface requests. | 136 // time |shelf_layout_requests_| stores pending interface requests. |
138 std::unique_ptr<ShelfLayoutImpl> shelf_layout_; | 137 std::unique_ptr<ShelfLayoutImpl> shelf_layout_; |
139 mojo::BindingSet<ash::mojom::ShelfLayout> shelf_layout_bindings_; | 138 mojo::BindingSet<mojom::ShelfLayout> shelf_layout_bindings_; |
140 std::vector<std::unique_ptr<mojo::InterfaceRequest<ash::mojom::ShelfLayout>>> | 139 std::vector<std::unique_ptr<mojo::InterfaceRequest<mojom::ShelfLayout>>> |
141 shelf_layout_requests_; | 140 shelf_layout_requests_; |
142 | 141 |
143 // |user_window_controller_| is created once OnEmbed() is called. Until that | 142 // |user_window_controller_| is created once OnEmbed() is called. Until that |
144 // time |user_window_controller_requests_| stores pending interface requests. | 143 // time |user_window_controller_requests_| stores pending interface requests. |
145 std::unique_ptr<UserWindowControllerImpl> user_window_controller_; | 144 std::unique_ptr<UserWindowControllerImpl> user_window_controller_; |
146 mojo::BindingSet<ash::mojom::UserWindowController> | 145 mojo::BindingSet<mojom::UserWindowController> |
147 user_window_controller_bindings_; | 146 user_window_controller_bindings_; |
148 std::vector< | 147 std::vector< |
149 std::unique_ptr<mojo::InterfaceRequest<ash::mojom::UserWindowController>>> | 148 std::unique_ptr<mojo::InterfaceRequest<mojom::UserWindowController>>> |
150 user_window_controller_requests_; | 149 user_window_controller_requests_; |
151 | 150 |
152 std::set<AcceleratorRegistrarImpl*> accelerator_registrars_; | 151 std::set<AcceleratorRegistrarImpl*> accelerator_registrars_; |
153 std::set<RootWindowController*> root_controllers_; | 152 std::set<RootWindowController*> root_controllers_; |
154 | 153 |
155 mojo::Binding<mus::mojom::WindowManagerFactory> | 154 mojo::Binding<::mus::mojom::WindowManagerFactory> |
156 window_manager_factory_binding_; | 155 window_manager_factory_binding_; |
157 | 156 |
158 mash::session::mojom::SessionPtr session_; | 157 mash::session::mojom::SessionPtr session_; |
159 | 158 |
160 base::ObserverList<RootWindowsObserver> root_windows_observers_; | 159 base::ObserverList<RootWindowsObserver> root_windows_observers_; |
161 | 160 |
162 DISALLOW_COPY_AND_ASSIGN(WindowManagerApplication); | 161 DISALLOW_COPY_AND_ASSIGN(WindowManagerApplication); |
163 }; | 162 }; |
164 | 163 |
165 } // namespace wm | 164 } // namespace mus |
166 } // namespace mash | 165 } // namespace ash |
167 | 166 |
168 #endif // MASH_WM_WINDOW_MANAGER_APPLICATION_H_ | 167 #endif // ASH_MUS_WINDOW_MANAGER_APPLICATION_H_ |
OLD | NEW |