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 "ash/mus/bridge/wm_shell_mus.h" | 5 #include "ash/mus/bridge/wm_shell_mus.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "ash/common/accelerators/accelerator_controller.h" | 9 #include "ash/common/accelerators/accelerator_controller.h" |
10 #include "ash/common/key_event_watcher.h" | 10 #include "ash/common/key_event_watcher.h" |
11 #include "ash/common/session/session_state_delegate.h" | 11 #include "ash/common/session/session_state_delegate.h" |
12 #include "ash/common/shell_delegate.h" | 12 #include "ash/common/shell_delegate.h" |
13 #include "ash/common/shell_observer.h" | 13 #include "ash/common/shell_observer.h" |
14 #include "ash/common/system/tray/system_tray_delegate.h" | 14 #include "ash/common/system/tray/system_tray_delegate.h" |
15 #include "ash/common/wallpaper/wallpaper_delegate.h" | 15 #include "ash/common/wallpaper/wallpaper_delegate.h" |
16 #include "ash/common/wm/maximize_mode/maximize_mode_event_handler.h" | 16 #include "ash/common/wm/maximize_mode/maximize_mode_event_handler.h" |
17 #include "ash/common/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard
.h" | 17 #include "ash/common/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard
.h" |
18 #include "ash/common/wm/mru_window_tracker.h" | 18 #include "ash/common/wm/mru_window_tracker.h" |
19 #include "ash/common/wm/window_cycle_event_filter.h" | 19 #include "ash/common/wm/window_cycle_event_filter.h" |
20 #include "ash/common/wm/window_resizer.h" | 20 #include "ash/common/wm/window_resizer.h" |
21 #include "ash/common/wm_activation_observer.h" | 21 #include "ash/common/wm_activation_observer.h" |
22 #include "ash/mus/accelerators/accelerator_controller_delegate_mus.h" | 22 #include "ash/mus/accelerators/accelerator_controller_delegate_mus.h" |
23 #include "ash/mus/accelerators/accelerator_controller_registrar.h" | 23 #include "ash/mus/accelerators/accelerator_controller_registrar.h" |
24 #include "ash/mus/bridge/immersive_handler_factory_mus.h" | 24 #include "ash/mus/bridge/immersive_handler_factory_mus.h" |
25 #include "ash/mus/bridge/wm_root_window_controller_mus.h" | |
26 #include "ash/mus/bridge/wm_window_mus.h" | 25 #include "ash/mus/bridge/wm_window_mus.h" |
27 #include "ash/mus/bridge/workspace_event_handler_mus.h" | 26 #include "ash/mus/bridge/workspace_event_handler_mus.h" |
28 #include "ash/mus/drag_window_resizer.h" | 27 #include "ash/mus/drag_window_resizer.h" |
29 #include "ash/mus/keyboard_ui_mus.h" | 28 #include "ash/mus/keyboard_ui_mus.h" |
30 #include "ash/mus/root_window_controller.h" | 29 #include "ash/mus/root_window_controller.h" |
31 #include "ash/mus/window_manager.h" | 30 #include "ash/mus/window_manager.h" |
32 #include "ash/shared/immersive_fullscreen_controller.h" | 31 #include "ash/shared/immersive_fullscreen_controller.h" |
33 #include "base/memory/ptr_util.h" | 32 #include "base/memory/ptr_util.h" |
34 #include "components/user_manager/user_info_impl.h" | 33 #include "components/user_manager/user_info_impl.h" |
35 #include "ui/aura/mus/window_tree_client.h" | 34 #include "ui/aura/mus/window_tree_client.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 DeleteWindowSelectorController(); | 160 DeleteWindowSelectorController(); |
162 DeleteMruWindowTracker(); | 161 DeleteMruWindowTracker(); |
163 WmShell::Set(nullptr); | 162 WmShell::Set(nullptr); |
164 } | 163 } |
165 | 164 |
166 // static | 165 // static |
167 WmShellMus* WmShellMus::Get() { | 166 WmShellMus* WmShellMus::Get() { |
168 return static_cast<WmShellMus*>(WmShell::Get()); | 167 return static_cast<WmShellMus*>(WmShell::Get()); |
169 } | 168 } |
170 | 169 |
171 void WmShellMus::AddRootWindowController( | 170 void WmShellMus::AddRootWindowController(RootWindowController* controller) { |
172 WmRootWindowControllerMus* controller) { | |
173 root_window_controllers_.push_back(controller); | 171 root_window_controllers_.push_back(controller); |
174 // The first root window will be the initial root for new windows. | 172 // The first root window will be the initial root for new windows. |
175 if (!GetRootWindowForNewWindows()) | 173 if (!GetRootWindowForNewWindows()) |
176 set_root_window_for_new_windows(controller->GetWindow()); | 174 set_root_window_for_new_windows(WmWindowMus::Get(controller->root())); |
177 } | 175 } |
178 | 176 |
179 void WmShellMus::RemoveRootWindowController( | 177 void WmShellMus::RemoveRootWindowController(RootWindowController* controller) { |
180 WmRootWindowControllerMus* controller) { | |
181 auto iter = std::find(root_window_controllers_.begin(), | 178 auto iter = std::find(root_window_controllers_.begin(), |
182 root_window_controllers_.end(), controller); | 179 root_window_controllers_.end(), controller); |
183 DCHECK(iter != root_window_controllers_.end()); | 180 DCHECK(iter != root_window_controllers_.end()); |
184 root_window_controllers_.erase(iter); | 181 root_window_controllers_.erase(iter); |
185 } | 182 } |
186 | 183 |
187 WmRootWindowControllerMus* WmShellMus::GetRootWindowControllerWithDisplayId( | 184 RootWindowController* WmShellMus::GetRootWindowControllerWithDisplayId( |
188 int64_t id) { | 185 int64_t id) { |
189 for (WmRootWindowControllerMus* root_window_controller : | 186 for (RootWindowController* root_window_controller : |
190 root_window_controllers_) { | 187 root_window_controllers_) { |
191 if (root_window_controller->GetDisplay().id() == id) | 188 if (root_window_controller->display().id() == id) |
192 return root_window_controller; | 189 return root_window_controller; |
193 } | 190 } |
194 NOTREACHED(); | 191 NOTREACHED(); |
195 return nullptr; | 192 return nullptr; |
196 } | 193 } |
197 | 194 |
198 aura::WindowTreeClient* WmShellMus::window_tree_client() { | 195 aura::WindowTreeClient* WmShellMus::window_tree_client() { |
199 return window_manager_->window_tree_client(); | 196 return window_manager_->window_tree_client(); |
200 } | 197 } |
201 | 198 |
(...skipping 22 matching lines...) Expand all Loading... |
224 window_manager_->focus_controller()) | 221 window_manager_->focus_controller()) |
225 ->GetActiveWindow()); | 222 ->GetActiveWindow()); |
226 } | 223 } |
227 | 224 |
228 WmWindow* WmShellMus::GetCaptureWindow() { | 225 WmWindow* WmShellMus::GetCaptureWindow() { |
229 // TODO: remove as both WmShells use same implementation. | 226 // TODO: remove as both WmShells use same implementation. |
230 return WmWindowMus::Get(::wm::CaptureController::Get()->GetCaptureWindow()); | 227 return WmWindowMus::Get(::wm::CaptureController::Get()->GetCaptureWindow()); |
231 } | 228 } |
232 | 229 |
233 WmWindow* WmShellMus::GetPrimaryRootWindow() { | 230 WmWindow* WmShellMus::GetPrimaryRootWindow() { |
234 return root_window_controllers_[0]->GetWindow(); | 231 return WmWindowMus::Get(root_window_controllers_[0]->root()); |
235 } | 232 } |
236 | 233 |
237 WmWindow* WmShellMus::GetRootWindowForDisplayId(int64_t display_id) { | 234 WmWindow* WmShellMus::GetRootWindowForDisplayId(int64_t display_id) { |
238 return GetRootWindowControllerWithDisplayId(display_id)->GetWindow(); | 235 return WmWindowMus::Get( |
| 236 GetRootWindowControllerWithDisplayId(display_id)->root()); |
239 } | 237 } |
240 | 238 |
241 const display::ManagedDisplayInfo& WmShellMus::GetDisplayInfo( | 239 const display::ManagedDisplayInfo& WmShellMus::GetDisplayInfo( |
242 int64_t display_id) const { | 240 int64_t display_id) const { |
243 // TODO(mash): implement http://crbug.com/622480. | 241 // TODO(mash): implement http://crbug.com/622480. |
244 NOTIMPLEMENTED(); | 242 NOTIMPLEMENTED(); |
245 static display::ManagedDisplayInfo fake_info; | 243 static display::ManagedDisplayInfo fake_info; |
246 return fake_info; | 244 return fake_info; |
247 } | 245 } |
248 | 246 |
(...skipping 21 matching lines...) Expand all Loading... |
270 return false; | 268 return false; |
271 } | 269 } |
272 | 270 |
273 bool WmShellMus::IsForceMaximizeOnFirstRun() { | 271 bool WmShellMus::IsForceMaximizeOnFirstRun() { |
274 NOTIMPLEMENTED(); | 272 NOTIMPLEMENTED(); |
275 return false; | 273 return false; |
276 } | 274 } |
277 | 275 |
278 void WmShellMus::SetDisplayWorkAreaInsets(WmWindow* window, | 276 void WmShellMus::SetDisplayWorkAreaInsets(WmWindow* window, |
279 const gfx::Insets& insets) { | 277 const gfx::Insets& insets) { |
280 WmRootWindowControllerMus* root_window_controller_mus = | 278 RootWindowController* root_window_controller = |
281 static_cast<WmWindowMus*>(window)->GetRootWindowControllerMus(); | 279 RootWindowController::ForWindow( |
282 root_window_controller_mus->root_window_controller()->SetWorkAreaInests( | 280 static_cast<WmWindowMus*>(window)->aura_window()); |
283 insets); | 281 root_window_controller->SetWorkAreaInests(insets); |
284 } | 282 } |
285 | 283 |
286 bool WmShellMus::IsPinned() { | 284 bool WmShellMus::IsPinned() { |
287 NOTIMPLEMENTED(); | 285 NOTIMPLEMENTED(); |
288 return false; | 286 return false; |
289 } | 287 } |
290 | 288 |
291 void WmShellMus::SetPinnedWindow(WmWindow* window) { | 289 void WmShellMus::SetPinnedWindow(WmWindow* window) { |
292 NOTIMPLEMENTED(); | 290 NOTIMPLEMENTED(); |
293 } | 291 } |
(...skipping 10 matching lines...) Expand all Loading... |
304 | 302 |
305 bool WmShellMus::IsMouseEventsEnabled() { | 303 bool WmShellMus::IsMouseEventsEnabled() { |
306 // TODO: http::/crbug.com/637853 | 304 // TODO: http::/crbug.com/637853 |
307 NOTIMPLEMENTED(); | 305 NOTIMPLEMENTED(); |
308 return true; | 306 return true; |
309 } | 307 } |
310 | 308 |
311 std::vector<WmWindow*> WmShellMus::GetAllRootWindows() { | 309 std::vector<WmWindow*> WmShellMus::GetAllRootWindows() { |
312 std::vector<WmWindow*> wm_windows(root_window_controllers_.size()); | 310 std::vector<WmWindow*> wm_windows(root_window_controllers_.size()); |
313 for (size_t i = 0; i < root_window_controllers_.size(); ++i) | 311 for (size_t i = 0; i < root_window_controllers_.size(); ++i) |
314 wm_windows[i] = root_window_controllers_[i]->GetWindow(); | 312 wm_windows[i] = WmWindowMus::Get(root_window_controllers_[i]->root()); |
315 return wm_windows; | 313 return wm_windows; |
316 } | 314 } |
317 | 315 |
318 void WmShellMus::RecordGestureAction(GestureActionType action) { | 316 void WmShellMus::RecordGestureAction(GestureActionType action) { |
319 // TODO: http://crbug.com/616581. | 317 // TODO: http://crbug.com/616581. |
320 NOTIMPLEMENTED(); | 318 NOTIMPLEMENTED(); |
321 } | 319 } |
322 | 320 |
323 void WmShellMus::RecordUserMetricsAction(UserMetricsAction action) { | 321 void WmShellMus::RecordUserMetricsAction(UserMetricsAction action) { |
324 // TODO: http://crbug.com/616581. | 322 // TODO: http://crbug.com/616581. |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 WmWindow* gained_active_wm = WmWindowMus::Get(gained_active); | 441 WmWindow* gained_active_wm = WmWindowMus::Get(gained_active); |
444 if (gained_active_wm) | 442 if (gained_active_wm) |
445 set_root_window_for_new_windows(gained_active_wm->GetRootWindow()); | 443 set_root_window_for_new_windows(gained_active_wm->GetRootWindow()); |
446 WmWindow* lost_active_wm = WmWindowMus::Get(lost_active); | 444 WmWindow* lost_active_wm = WmWindowMus::Get(lost_active); |
447 for (auto& observer : activation_observers_) | 445 for (auto& observer : activation_observers_) |
448 observer.OnWindowActivated(gained_active_wm, lost_active_wm); | 446 observer.OnWindowActivated(gained_active_wm, lost_active_wm); |
449 } | 447 } |
450 | 448 |
451 } // namespace mus | 449 } // namespace mus |
452 } // namespace ash | 450 } // namespace ash |
OLD | NEW |