| 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" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 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" | 25 #include "ash/mus/bridge/wm_root_window_controller_mus.h" |
| 26 #include "ash/mus/bridge/wm_window_mus.h" | 26 #include "ash/mus/bridge/wm_window_mus.h" |
| 27 #include "ash/mus/bridge/workspace_event_handler_mus.h" | 27 #include "ash/mus/bridge/workspace_event_handler_mus.h" |
| 28 #include "ash/mus/drag_window_resizer.h" | 28 #include "ash/mus/drag_window_resizer.h" |
| 29 #include "ash/mus/keyboard_ui_mus.h" | 29 #include "ash/mus/keyboard_ui_mus.h" |
| 30 #include "ash/mus/root_window_controller.h" | 30 #include "ash/mus/root_window_controller.h" |
| 31 #include "ash/mus/window_manager.h" | 31 #include "ash/mus/window_manager.h" |
| 32 #include "ash/public/cpp/shell_window_ids.h" | |
| 33 #include "ash/shared/immersive_fullscreen_controller.h" | 32 #include "ash/shared/immersive_fullscreen_controller.h" |
| 34 #include "base/memory/ptr_util.h" | 33 #include "base/memory/ptr_util.h" |
| 35 #include "components/user_manager/user_info_impl.h" | 34 #include "components/user_manager/user_info_impl.h" |
| 36 #include "ui/aura/mus/window_tree_client.h" | 35 #include "ui/aura/mus/window_tree_client.h" |
| 37 #include "ui/aura/window.h" | 36 #include "ui/aura/window.h" |
| 38 #include "ui/display/manager/managed_display_info.h" | 37 #include "ui/display/manager/managed_display_info.h" |
| 39 #include "ui/display/screen.h" | 38 #include "ui/display/screen.h" |
| 40 #include "ui/views/mus/pointer_watcher_event_router.h" | 39 #include "ui/views/mus/pointer_watcher_event_router.h" |
| 41 #include "ui/wm/core/capture_controller.h" | 40 #include "ui/wm/core/capture_controller.h" |
| 42 #include "ui/wm/core/focus_controller.h" | 41 #include "ui/wm/core/focus_controller.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 } | 173 } |
| 175 | 174 |
| 176 void WmShellMus::RemoveRootWindowController( | 175 void WmShellMus::RemoveRootWindowController( |
| 177 WmRootWindowControllerMus* controller) { | 176 WmRootWindowControllerMus* controller) { |
| 178 auto iter = std::find(root_window_controllers_.begin(), | 177 auto iter = std::find(root_window_controllers_.begin(), |
| 179 root_window_controllers_.end(), controller); | 178 root_window_controllers_.end(), controller); |
| 180 DCHECK(iter != root_window_controllers_.end()); | 179 DCHECK(iter != root_window_controllers_.end()); |
| 181 root_window_controllers_.erase(iter); | 180 root_window_controllers_.erase(iter); |
| 182 } | 181 } |
| 183 | 182 |
| 184 // static | |
| 185 WmWindowMus* WmShellMus::GetToplevelAncestor(aura::Window* window) { | |
| 186 while (window) { | |
| 187 if (IsActivationParent(window->parent())) | |
| 188 return WmWindowMus::Get(window); | |
| 189 window = window->parent(); | |
| 190 } | |
| 191 return nullptr; | |
| 192 } | |
| 193 | |
| 194 WmRootWindowControllerMus* WmShellMus::GetRootWindowControllerWithDisplayId( | 183 WmRootWindowControllerMus* WmShellMus::GetRootWindowControllerWithDisplayId( |
| 195 int64_t id) { | 184 int64_t id) { |
| 196 for (WmRootWindowControllerMus* root_window_controller : | 185 for (WmRootWindowControllerMus* root_window_controller : |
| 197 root_window_controllers_) { | 186 root_window_controllers_) { |
| 198 if (root_window_controller->GetDisplay().id() == id) | 187 if (root_window_controller->GetDisplay().id() == id) |
| 199 return root_window_controller; | 188 return root_window_controller; |
| 200 } | 189 } |
| 201 NOTREACHED(); | 190 NOTREACHED(); |
| 202 return nullptr; | 191 return nullptr; |
| 203 } | 192 } |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 #if defined(OS_CHROMEOS) | 426 #if defined(OS_CHROMEOS) |
| 438 void WmShellMus::ToggleIgnoreExternalKeyboard() { | 427 void WmShellMus::ToggleIgnoreExternalKeyboard() { |
| 439 NOTIMPLEMENTED(); | 428 NOTIMPLEMENTED(); |
| 440 } | 429 } |
| 441 | 430 |
| 442 void WmShellMus::SetLaserPointerEnabled(bool enabled) { | 431 void WmShellMus::SetLaserPointerEnabled(bool enabled) { |
| 443 NOTIMPLEMENTED(); | 432 NOTIMPLEMENTED(); |
| 444 } | 433 } |
| 445 #endif // defined(OS_CHROMEOS) | 434 #endif // defined(OS_CHROMEOS) |
| 446 | 435 |
| 447 // static | |
| 448 bool WmShellMus::IsActivationParent(aura::Window* window) { | |
| 449 return window && IsActivatableShellWindowId( | |
| 450 WmWindowMus::Get(window)->GetShellWindowId()); | |
| 451 } | |
| 452 | |
| 453 // TODO: support OnAttemptToReactivateWindow, http://crbug.com/615114. | 436 // TODO: support OnAttemptToReactivateWindow, http://crbug.com/615114. |
| 454 // TODO: Nuke and let client code use ActivationChangeObserver directly. | 437 // TODO: Nuke and let client code use ActivationChangeObserver directly. |
| 455 void WmShellMus::OnWindowActivated(ActivationReason reason, | 438 void WmShellMus::OnWindowActivated(ActivationReason reason, |
| 456 aura::Window* gained_active, | 439 aura::Window* gained_active, |
| 457 aura::Window* lost_active) { | 440 aura::Window* lost_active) { |
| 458 WmWindow* gained_active_wm = WmWindowMus::Get(gained_active); | 441 WmWindow* gained_active_wm = WmWindowMus::Get(gained_active); |
| 459 if (gained_active_wm) | 442 if (gained_active_wm) |
| 460 set_root_window_for_new_windows(gained_active_wm->GetRootWindow()); | 443 set_root_window_for_new_windows(gained_active_wm->GetRootWindow()); |
| 461 WmWindow* lost_active_wm = WmWindowMus::Get(lost_active); | 444 WmWindow* lost_active_wm = WmWindowMus::Get(lost_active); |
| 462 for (auto& observer : activation_observers_) | 445 for (auto& observer : activation_observers_) |
| 463 observer.OnWindowActivated(gained_active_wm, lost_active_wm); | 446 observer.OnWindowActivated(gained_active_wm, lost_active_wm); |
| 464 } | 447 } |
| 465 | 448 |
| 466 } // namespace mus | 449 } // namespace mus |
| 467 } // namespace ash | 450 } // namespace ash |
| OLD | NEW |