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/aura/wm_window_aura.h" |
9 #include "ash/common/accelerators/accelerator_controller.h" | 10 #include "ash/common/accelerators/accelerator_controller.h" |
10 #include "ash/common/key_event_watcher.h" | 11 #include "ash/common/key_event_watcher.h" |
11 #include "ash/common/session/session_state_delegate.h" | 12 #include "ash/common/session/session_state_delegate.h" |
12 #include "ash/common/shell_delegate.h" | 13 #include "ash/common/shell_delegate.h" |
13 #include "ash/common/shell_observer.h" | 14 #include "ash/common/shell_observer.h" |
14 #include "ash/common/system/tray/system_tray_delegate.h" | 15 #include "ash/common/system/tray/system_tray_delegate.h" |
15 #include "ash/common/wallpaper/wallpaper_delegate.h" | 16 #include "ash/common/wallpaper/wallpaper_delegate.h" |
16 #include "ash/common/wm/maximize_mode/maximize_mode_event_handler.h" | 17 #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" | 18 #include "ash/common/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard
.h" |
18 #include "ash/common/wm/mru_window_tracker.h" | 19 #include "ash/common/wm/mru_window_tracker.h" |
19 #include "ash/common/wm/window_cycle_event_filter.h" | 20 #include "ash/common/wm/window_cycle_event_filter.h" |
20 #include "ash/common/wm/window_resizer.h" | 21 #include "ash/common/wm/window_resizer.h" |
21 #include "ash/common/wm_activation_observer.h" | 22 #include "ash/common/wm_activation_observer.h" |
22 #include "ash/mus/accelerators/accelerator_controller_delegate_mus.h" | 23 #include "ash/mus/accelerators/accelerator_controller_delegate_mus.h" |
23 #include "ash/mus/accelerators/accelerator_controller_registrar.h" | 24 #include "ash/mus/accelerators/accelerator_controller_registrar.h" |
24 #include "ash/mus/bridge/immersive_handler_factory_mus.h" | 25 #include "ash/mus/bridge/immersive_handler_factory_mus.h" |
25 #include "ash/mus/bridge/wm_window_mus.h" | |
26 #include "ash/mus/bridge/workspace_event_handler_mus.h" | 26 #include "ash/mus/bridge/workspace_event_handler_mus.h" |
27 #include "ash/mus/drag_window_resizer.h" | 27 #include "ash/mus/drag_window_resizer.h" |
28 #include "ash/mus/keyboard_ui_mus.h" | 28 #include "ash/mus/keyboard_ui_mus.h" |
29 #include "ash/mus/root_window_controller.h" | 29 #include "ash/mus/root_window_controller.h" |
30 #include "ash/mus/window_manager.h" | 30 #include "ash/mus/window_manager.h" |
31 #include "ash/shared/immersive_fullscreen_controller.h" | 31 #include "ash/shared/immersive_fullscreen_controller.h" |
32 #include "base/memory/ptr_util.h" | 32 #include "base/memory/ptr_util.h" |
33 #include "components/user_manager/user_info_impl.h" | 33 #include "components/user_manager/user_info_impl.h" |
34 #include "ui/aura/mus/window_tree_client.h" | 34 #include "ui/aura/mus/window_tree_client.h" |
35 #include "ui/aura/window.h" | 35 #include "ui/aura/window.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 161 |
162 // static | 162 // static |
163 WmShellMus* WmShellMus::Get() { | 163 WmShellMus* WmShellMus::Get() { |
164 return static_cast<WmShellMus*>(WmShell::Get()); | 164 return static_cast<WmShellMus*>(WmShell::Get()); |
165 } | 165 } |
166 | 166 |
167 void WmShellMus::AddRootWindowController(RootWindowController* controller) { | 167 void WmShellMus::AddRootWindowController(RootWindowController* controller) { |
168 root_window_controllers_.push_back(controller); | 168 root_window_controllers_.push_back(controller); |
169 // The first root window will be the initial root for new windows. | 169 // The first root window will be the initial root for new windows. |
170 if (!GetRootWindowForNewWindows()) | 170 if (!GetRootWindowForNewWindows()) |
171 set_root_window_for_new_windows(WmWindowMus::Get(controller->root())); | 171 set_root_window_for_new_windows(ash::WmWindowAura::Get(controller->root())); |
172 } | 172 } |
173 | 173 |
174 void WmShellMus::RemoveRootWindowController(RootWindowController* controller) { | 174 void WmShellMus::RemoveRootWindowController(RootWindowController* controller) { |
175 auto iter = std::find(root_window_controllers_.begin(), | 175 auto iter = std::find(root_window_controllers_.begin(), |
176 root_window_controllers_.end(), controller); | 176 root_window_controllers_.end(), controller); |
177 DCHECK(iter != root_window_controllers_.end()); | 177 DCHECK(iter != root_window_controllers_.end()); |
178 root_window_controllers_.erase(iter); | 178 root_window_controllers_.erase(iter); |
179 } | 179 } |
180 | 180 |
181 RootWindowController* WmShellMus::GetRootWindowControllerWithDisplayId( | 181 RootWindowController* WmShellMus::GetRootWindowControllerWithDisplayId( |
(...skipping 13 matching lines...) Expand all Loading... |
195 | 195 |
196 bool WmShellMus::IsRunningInMash() const { | 196 bool WmShellMus::IsRunningInMash() const { |
197 return true; | 197 return true; |
198 } | 198 } |
199 | 199 |
200 WmWindow* WmShellMus::NewWindow(ui::wm::WindowType window_type, | 200 WmWindow* WmShellMus::NewWindow(ui::wm::WindowType window_type, |
201 ui::LayerType layer_type) { | 201 ui::LayerType layer_type) { |
202 aura::Window* window = new aura::Window(nullptr); | 202 aura::Window* window = new aura::Window(nullptr); |
203 window->SetType(window_type); | 203 window->SetType(window_type); |
204 window->Init(layer_type); | 204 window->Init(layer_type); |
205 return WmWindowMus::Get(window); | 205 return ash::WmWindowAura::Get(window); |
206 } | 206 } |
207 | 207 |
208 WmWindow* WmShellMus::GetFocusedWindow() { | 208 WmWindow* WmShellMus::GetFocusedWindow() { |
209 // TODO: remove as both WmShells use same implementation. | 209 // TODO: remove as both WmShells use same implementation. |
210 return WmWindowMus::Get(static_cast<aura::client::FocusClient*>( | 210 return ash::WmWindowAura::Get(static_cast<aura::client::FocusClient*>( |
211 window_manager_->focus_controller()) | 211 window_manager_->focus_controller()) |
212 ->GetFocusedWindow()); | 212 ->GetFocusedWindow()); |
213 } | 213 } |
214 | 214 |
215 WmWindow* WmShellMus::GetActiveWindow() { | 215 WmWindow* WmShellMus::GetActiveWindow() { |
216 // TODO: remove as both WmShells use same implementation. | 216 // TODO: remove as both WmShells use same implementation. |
217 return WmWindowMus::Get(static_cast<aura::client::ActivationClient*>( | 217 return ash::WmWindowAura::Get(static_cast<aura::client::ActivationClient*>( |
218 window_manager_->focus_controller()) | 218 window_manager_->focus_controller()) |
219 ->GetActiveWindow()); | 219 ->GetActiveWindow()); |
220 } | 220 } |
221 | 221 |
222 WmWindow* WmShellMus::GetCaptureWindow() { | 222 WmWindow* WmShellMus::GetCaptureWindow() { |
223 // TODO: remove as both WmShells use same implementation. | 223 // TODO: remove as both WmShells use same implementation. |
224 return WmWindowMus::Get(::wm::CaptureController::Get()->GetCaptureWindow()); | 224 return ash::WmWindowAura::Get( |
| 225 ::wm::CaptureController::Get()->GetCaptureWindow()); |
225 } | 226 } |
226 | 227 |
227 WmWindow* WmShellMus::GetPrimaryRootWindow() { | 228 WmWindow* WmShellMus::GetPrimaryRootWindow() { |
228 return WmWindowMus::Get(root_window_controllers_[0]->root()); | 229 return ash::WmWindowAura::Get(root_window_controllers_[0]->root()); |
229 } | 230 } |
230 | 231 |
231 WmWindow* WmShellMus::GetRootWindowForDisplayId(int64_t display_id) { | 232 WmWindow* WmShellMus::GetRootWindowForDisplayId(int64_t display_id) { |
232 return WmWindowMus::Get( | 233 return ash::WmWindowAura::Get( |
233 GetRootWindowControllerWithDisplayId(display_id)->root()); | 234 GetRootWindowControllerWithDisplayId(display_id)->root()); |
234 } | 235 } |
235 | 236 |
236 const display::ManagedDisplayInfo& WmShellMus::GetDisplayInfo( | 237 const display::ManagedDisplayInfo& WmShellMus::GetDisplayInfo( |
237 int64_t display_id) const { | 238 int64_t display_id) const { |
238 // TODO(mash): implement http://crbug.com/622480. | 239 // TODO(mash): implement http://crbug.com/622480. |
239 NOTIMPLEMENTED(); | 240 NOTIMPLEMENTED(); |
240 static display::ManagedDisplayInfo fake_info; | 241 static display::ManagedDisplayInfo fake_info; |
241 return fake_info; | 242 return fake_info; |
242 } | 243 } |
(...skipping 24 matching lines...) Expand all Loading... |
267 | 268 |
268 bool WmShellMus::IsForceMaximizeOnFirstRun() { | 269 bool WmShellMus::IsForceMaximizeOnFirstRun() { |
269 NOTIMPLEMENTED(); | 270 NOTIMPLEMENTED(); |
270 return false; | 271 return false; |
271 } | 272 } |
272 | 273 |
273 void WmShellMus::SetDisplayWorkAreaInsets(WmWindow* window, | 274 void WmShellMus::SetDisplayWorkAreaInsets(WmWindow* window, |
274 const gfx::Insets& insets) { | 275 const gfx::Insets& insets) { |
275 RootWindowController* root_window_controller = | 276 RootWindowController* root_window_controller = |
276 RootWindowController::ForWindow( | 277 RootWindowController::ForWindow( |
277 static_cast<WmWindowMus*>(window)->aura_window()); | 278 static_cast<ash::WmWindowAura*>(window)->aura_window()); |
278 root_window_controller->SetWorkAreaInests(insets); | 279 root_window_controller->SetWorkAreaInests(insets); |
279 } | 280 } |
280 | 281 |
281 bool WmShellMus::IsPinned() { | 282 bool WmShellMus::IsPinned() { |
282 NOTIMPLEMENTED(); | 283 NOTIMPLEMENTED(); |
283 return false; | 284 return false; |
284 } | 285 } |
285 | 286 |
286 void WmShellMus::SetPinnedWindow(WmWindow* window) { | 287 void WmShellMus::SetPinnedWindow(WmWindow* window) { |
287 NOTIMPLEMENTED(); | 288 NOTIMPLEMENTED(); |
(...skipping 11 matching lines...) Expand all Loading... |
299 | 300 |
300 bool WmShellMus::IsMouseEventsEnabled() { | 301 bool WmShellMus::IsMouseEventsEnabled() { |
301 // TODO: http::/crbug.com/637853 | 302 // TODO: http::/crbug.com/637853 |
302 NOTIMPLEMENTED(); | 303 NOTIMPLEMENTED(); |
303 return true; | 304 return true; |
304 } | 305 } |
305 | 306 |
306 std::vector<WmWindow*> WmShellMus::GetAllRootWindows() { | 307 std::vector<WmWindow*> WmShellMus::GetAllRootWindows() { |
307 std::vector<WmWindow*> wm_windows(root_window_controllers_.size()); | 308 std::vector<WmWindow*> wm_windows(root_window_controllers_.size()); |
308 for (size_t i = 0; i < root_window_controllers_.size(); ++i) | 309 for (size_t i = 0; i < root_window_controllers_.size(); ++i) |
309 wm_windows[i] = WmWindowMus::Get(root_window_controllers_[i]->root()); | 310 wm_windows[i] = ash::WmWindowAura::Get(root_window_controllers_[i]->root()); |
310 return wm_windows; | 311 return wm_windows; |
311 } | 312 } |
312 | 313 |
313 void WmShellMus::RecordGestureAction(GestureActionType action) { | 314 void WmShellMus::RecordGestureAction(GestureActionType action) { |
314 // TODO: http://crbug.com/616581. | 315 // TODO: http://crbug.com/616581. |
315 NOTIMPLEMENTED(); | 316 NOTIMPLEMENTED(); |
316 } | 317 } |
317 | 318 |
318 void WmShellMus::RecordUserMetricsAction(UserMetricsAction action) { | 319 void WmShellMus::RecordUserMetricsAction(UserMetricsAction action) { |
319 // TODO: http://crbug.com/616581. | 320 // TODO: http://crbug.com/616581. |
(...skipping 29 matching lines...) Expand all Loading... |
349 std::unique_ptr<ScopedDisableInternalMouseAndKeyboard> | 350 std::unique_ptr<ScopedDisableInternalMouseAndKeyboard> |
350 WmShellMus::CreateScopedDisableInternalMouseAndKeyboard() { | 351 WmShellMus::CreateScopedDisableInternalMouseAndKeyboard() { |
351 // TODO: needs implementation for mus, http://crbug.com/624967. | 352 // TODO: needs implementation for mus, http://crbug.com/624967. |
352 NOTIMPLEMENTED(); | 353 NOTIMPLEMENTED(); |
353 return nullptr; | 354 return nullptr; |
354 } | 355 } |
355 | 356 |
356 std::unique_ptr<WorkspaceEventHandler> WmShellMus::CreateWorkspaceEventHandler( | 357 std::unique_ptr<WorkspaceEventHandler> WmShellMus::CreateWorkspaceEventHandler( |
357 WmWindow* workspace_window) { | 358 WmWindow* workspace_window) { |
358 return base::MakeUnique<WorkspaceEventHandlerMus>( | 359 return base::MakeUnique<WorkspaceEventHandlerMus>( |
359 WmWindowMus::GetAuraWindow(workspace_window)); | 360 ash::WmWindowAura::GetAuraWindow(workspace_window)); |
360 } | 361 } |
361 | 362 |
362 std::unique_ptr<ImmersiveFullscreenController> | 363 std::unique_ptr<ImmersiveFullscreenController> |
363 WmShellMus::CreateImmersiveFullscreenController() { | 364 WmShellMus::CreateImmersiveFullscreenController() { |
364 return base::MakeUnique<ImmersiveFullscreenController>(); | 365 return base::MakeUnique<ImmersiveFullscreenController>(); |
365 } | 366 } |
366 | 367 |
367 std::unique_ptr<KeyEventWatcher> WmShellMus::CreateKeyEventWatcher() { | 368 std::unique_ptr<KeyEventWatcher> WmShellMus::CreateKeyEventWatcher() { |
368 // TODO: needs implementation for mus, http://crbug.com/649600. | 369 // TODO: needs implementation for mus, http://crbug.com/649600. |
369 NOTIMPLEMENTED(); | 370 NOTIMPLEMENTED(); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 | 429 |
429 void WmShellMus::SetLaserPointerEnabled(bool enabled) { | 430 void WmShellMus::SetLaserPointerEnabled(bool enabled) { |
430 NOTIMPLEMENTED(); | 431 NOTIMPLEMENTED(); |
431 } | 432 } |
432 | 433 |
433 // TODO: support OnAttemptToReactivateWindow, http://crbug.com/615114. | 434 // TODO: support OnAttemptToReactivateWindow, http://crbug.com/615114. |
434 // TODO: Nuke and let client code use ActivationChangeObserver directly. | 435 // TODO: Nuke and let client code use ActivationChangeObserver directly. |
435 void WmShellMus::OnWindowActivated(ActivationReason reason, | 436 void WmShellMus::OnWindowActivated(ActivationReason reason, |
436 aura::Window* gained_active, | 437 aura::Window* gained_active, |
437 aura::Window* lost_active) { | 438 aura::Window* lost_active) { |
438 WmWindow* gained_active_wm = WmWindowMus::Get(gained_active); | 439 WmWindow* gained_active_wm = ash::WmWindowAura::Get(gained_active); |
439 if (gained_active_wm) | 440 if (gained_active_wm) |
440 set_root_window_for_new_windows(gained_active_wm->GetRootWindow()); | 441 set_root_window_for_new_windows(gained_active_wm->GetRootWindow()); |
441 WmWindow* lost_active_wm = WmWindowMus::Get(lost_active); | 442 WmWindow* lost_active_wm = ash::WmWindowAura::Get(lost_active); |
442 for (auto& observer : activation_observers_) | 443 for (auto& observer : activation_observers_) |
443 observer.OnWindowActivated(gained_active_wm, lost_active_wm); | 444 observer.OnWindowActivated(gained_active_wm, lost_active_wm); |
444 } | 445 } |
445 | 446 |
446 } // namespace mus | 447 } // namespace mus |
447 } // namespace ash | 448 } // namespace ash |
OLD | NEW |