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 #include "mash/wm/root_window_controller.h" | 5 #include "mash/wm/root_window_controller.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "components/mus/common/util.h" | 10 #include "components/mus/common/util.h" |
11 #include "components/mus/public/cpp/event_matcher_util.h" | 11 #include "components/mus/public/cpp/event_matcher_util.h" |
12 #include "components/mus/public/cpp/window.h" | 12 #include "components/mus/public/cpp/window.h" |
13 #include "components/mus/public/cpp/window_tree_connection.h" | 13 #include "components/mus/public/cpp/window_tree_connection.h" |
14 #include "components/mus/public/cpp/window_tree_host_factory.h" | 14 #include "components/mus/public/cpp/window_tree_host_factory.h" |
15 #include "mash/session/public/interfaces/session.mojom.h" | 15 #include "mash/session/public/interfaces/session.mojom.h" |
16 #include "mash/wm/background_layout.h" | 16 #include "mash/wm/background_layout.h" |
17 #include "mash/wm/fill_layout.h" | 17 #include "mash/wm/fill_layout.h" |
18 #include "mash/wm/screenlock_layout.h" | 18 #include "mash/wm/screenlock_layout.h" |
19 #include "mash/wm/shadow_controller.h" | 19 #include "mash/wm/shadow_controller.h" |
20 #include "mash/wm/shelf_layout.h" | 20 #include "mash/wm/shelf_layout_manager.h" |
| 21 #include "mash/wm/status_layout_manager.h" |
21 #include "mash/wm/window_layout.h" | 22 #include "mash/wm/window_layout.h" |
22 #include "mash/wm/window_manager.h" | 23 #include "mash/wm/window_manager.h" |
23 #include "mash/wm/window_manager_application.h" | 24 #include "mash/wm/window_manager_application.h" |
24 #include "services/shell/public/cpp/connector.h" | 25 #include "services/shell/public/cpp/connector.h" |
25 | 26 |
26 namespace mash { | 27 namespace mash { |
27 namespace wm { | 28 namespace wm { |
28 namespace { | 29 namespace { |
29 | 30 |
30 const uint32_t kWindowSwitchAccelerator = 1; | 31 const uint32_t kWindowSwitchAccelerator = 1; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 switch (id) { | 87 switch (id) { |
87 case kWindowSwitchAccelerator: | 88 case kWindowSwitchAccelerator: |
88 window_manager_client()->ActivateNextWindow(); | 89 window_manager_client()->ActivateNextWindow(); |
89 break; | 90 break; |
90 default: | 91 default: |
91 app_->OnAccelerator(id, event); | 92 app_->OnAccelerator(id, event); |
92 break; | 93 break; |
93 } | 94 } |
94 } | 95 } |
95 | 96 |
96 ShelfLayout* RootWindowController::GetShelfLayoutManager() { | 97 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { |
97 return static_cast<ShelfLayout*>( | 98 return static_cast<ShelfLayoutManager*>( |
98 layout_manager_[GetWindowForContainer(mojom::Container::USER_SHELF)] | 99 layout_manager_[GetWindowForContainer(mojom::Container::USER_SHELF)] |
99 .get()); | 100 .get()); |
100 } | 101 } |
101 | 102 |
| 103 StatusLayoutManager* RootWindowController::GetStatusLayoutManager() { |
| 104 return static_cast<StatusLayoutManager*>( |
| 105 layout_manager_[GetWindowForContainer(mojom::Container::STATUS)].get()); |
| 106 } |
| 107 |
102 RootWindowController::RootWindowController(WindowManagerApplication* app) | 108 RootWindowController::RootWindowController(WindowManagerApplication* app) |
103 : app_(app), root_(nullptr), window_count_(0) { | 109 : app_(app), root_(nullptr), window_count_(0) { |
104 window_manager_.reset(new WindowManager); | 110 window_manager_.reset(new WindowManager); |
105 } | 111 } |
106 | 112 |
107 RootWindowController::~RootWindowController() {} | 113 RootWindowController::~RootWindowController() {} |
108 | 114 |
109 void RootWindowController::AddAccelerators() { | 115 void RootWindowController::AddAccelerators() { |
110 window_manager_client()->AddAccelerator( | 116 window_manager_client()->AddAccelerator( |
111 kWindowSwitchAccelerator, | 117 kWindowSwitchAccelerator, |
(...skipping 12 matching lines...) Expand all Loading... |
124 | 130 |
125 CreateContainers(); | 131 CreateContainers(); |
126 | 132 |
127 // Override the default layout managers for certain containers. | 133 // Override the default layout managers for certain containers. |
128 mus::Window* user_background = | 134 mus::Window* user_background = |
129 GetWindowForContainer(mojom::Container::USER_BACKGROUND); | 135 GetWindowForContainer(mojom::Container::USER_BACKGROUND); |
130 layout_manager_[user_background].reset(new BackgroundLayout(user_background)); | 136 layout_manager_[user_background].reset(new BackgroundLayout(user_background)); |
131 mus::Window* login_app = GetWindowForContainer(mojom::Container::LOGIN_APP); | 137 mus::Window* login_app = GetWindowForContainer(mojom::Container::LOGIN_APP); |
132 layout_manager_[login_app].reset(new ScreenlockLayout(login_app)); | 138 layout_manager_[login_app].reset(new ScreenlockLayout(login_app)); |
133 mus::Window* user_shelf = GetWindowForContainer(mojom::Container::USER_SHELF); | 139 mus::Window* user_shelf = GetWindowForContainer(mojom::Container::USER_SHELF); |
134 layout_manager_[user_shelf].reset(new ShelfLayout(user_shelf)); | 140 layout_manager_[user_shelf].reset(new ShelfLayoutManager(user_shelf)); |
| 141 mus::Window* status = GetWindowForContainer(mojom::Container::STATUS); |
| 142 layout_manager_[status].reset(new StatusLayoutManager(status)); |
135 | 143 |
136 mus::Window* window = GetWindowForContainer(mojom::Container::USER_WINDOWS); | 144 mus::Window* window = GetWindowForContainer(mojom::Container::USER_WINDOWS); |
137 layout_manager_[window].reset(new WindowLayout(window)); | 145 layout_manager_[window].reset(new WindowLayout(window)); |
138 window_manager_client()->AddActivationParent(window); | 146 window_manager_client()->AddActivationParent(window); |
139 | 147 |
140 // Bubble windows must be allowed to activate because some of them rely on | 148 // Bubble windows must be allowed to activate because some of them rely on |
141 // deactivation to close. | 149 // deactivation to close. |
142 mus::Window* bubbles = GetWindowForContainer(mojom::Container::BUBBLES); | 150 mus::Window* bubbles = GetWindowForContainer(mojom::Container::BUBBLES); |
143 window_manager_client()->AddActivationParent(bubbles); | 151 window_manager_client()->AddActivationParent(bubbles); |
144 | 152 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 mojom::Container::USER_PRIVATE); | 205 mojom::Container::USER_PRIVATE); |
198 CreateContainer(mojom::Container::USER_STICKY_WINDOWS, | 206 CreateContainer(mojom::Container::USER_STICKY_WINDOWS, |
199 mojom::Container::USER_PRIVATE); | 207 mojom::Container::USER_PRIVATE); |
200 CreateContainer(mojom::Container::USER_PRESENTATION_WINDOWS, | 208 CreateContainer(mojom::Container::USER_PRESENTATION_WINDOWS, |
201 mojom::Container::USER_PRIVATE); | 209 mojom::Container::USER_PRIVATE); |
202 CreateContainer(mojom::Container::USER_SHELF, mojom::Container::USER_PRIVATE); | 210 CreateContainer(mojom::Container::USER_SHELF, mojom::Container::USER_PRIVATE); |
203 CreateContainer(mojom::Container::LOGIN_WINDOWS, mojom::Container::ROOT); | 211 CreateContainer(mojom::Container::LOGIN_WINDOWS, mojom::Container::ROOT); |
204 CreateContainer(mojom::Container::LOGIN_APP, mojom::Container::LOGIN_WINDOWS); | 212 CreateContainer(mojom::Container::LOGIN_APP, mojom::Container::LOGIN_WINDOWS); |
205 CreateContainer(mojom::Container::LOGIN_SHELF, | 213 CreateContainer(mojom::Container::LOGIN_SHELF, |
206 mojom::Container::LOGIN_WINDOWS); | 214 mojom::Container::LOGIN_WINDOWS); |
| 215 CreateContainer(mojom::Container::STATUS, mojom::Container::ROOT); |
207 CreateContainer(mojom::Container::BUBBLES, mojom::Container::ROOT); | 216 CreateContainer(mojom::Container::BUBBLES, mojom::Container::ROOT); |
208 CreateContainer(mojom::Container::SYSTEM_MODAL_WINDOWS, | 217 CreateContainer(mojom::Container::SYSTEM_MODAL_WINDOWS, |
209 mojom::Container::ROOT); | 218 mojom::Container::ROOT); |
210 CreateContainer(mojom::Container::KEYBOARD, mojom::Container::ROOT); | 219 CreateContainer(mojom::Container::KEYBOARD, mojom::Container::ROOT); |
211 CreateContainer(mojom::Container::MENUS, mojom::Container::ROOT); | 220 CreateContainer(mojom::Container::MENUS, mojom::Container::ROOT); |
212 CreateContainer(mojom::Container::TOOLTIPS, mojom::Container::ROOT); | 221 CreateContainer(mojom::Container::TOOLTIPS, mojom::Container::ROOT); |
213 } | 222 } |
214 | 223 |
215 } // namespace wm | 224 } // namespace wm |
216 } // namespace mash | 225 } // namespace mash |
OLD | NEW |