| 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/aura/wm_shell_aura.h" | 5 #include "ash/aura/wm_shell_aura.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/aura/key_event_watcher_aura.h" | 9 #include "ash/aura/key_event_watcher_aura.h" |
| 10 #include "ash/aura/pointer_watcher_adapter.h" | 10 #include "ash/aura/pointer_watcher_adapter.h" |
| 11 #include "ash/aura/wm_window_aura.h" | |
| 12 #include "ash/common/session/session_state_delegate.h" | 11 #include "ash/common/session/session_state_delegate.h" |
| 13 #include "ash/common/shell_delegate.h" | 12 #include "ash/common/shell_delegate.h" |
| 14 #include "ash/common/shell_observer.h" | 13 #include "ash/common/shell_observer.h" |
| 15 #include "ash/common/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard
.h" | 14 #include "ash/common/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard
.h" |
| 16 #include "ash/common/wm/mru_window_tracker.h" | 15 #include "ash/common/wm/mru_window_tracker.h" |
| 17 #include "ash/common/wm/overview/window_selector_controller.h" | 16 #include "ash/common/wm/overview/window_selector_controller.h" |
| 18 #include "ash/common/wm_activation_observer.h" | 17 #include "ash/common/wm_activation_observer.h" |
| 19 #include "ash/common/wm_display_observer.h" | 18 #include "ash/common/wm_display_observer.h" |
| 19 #include "ash/common/wm_window.h" |
| 20 #include "ash/display/window_tree_host_manager.h" | 20 #include "ash/display/window_tree_host_manager.h" |
| 21 #include "ash/laser/laser_pointer_controller.h" | 21 #include "ash/laser/laser_pointer_controller.h" |
| 22 #include "ash/metrics/task_switch_metrics_recorder.h" | 22 #include "ash/metrics/task_switch_metrics_recorder.h" |
| 23 #include "ash/shared/immersive_fullscreen_controller.h" | 23 #include "ash/shared/immersive_fullscreen_controller.h" |
| 24 #include "ash/shell.h" | 24 #include "ash/shell.h" |
| 25 #include "ash/touch/touch_uma.h" | 25 #include "ash/touch/touch_uma.h" |
| 26 #include "ash/virtual_keyboard_controller.h" | 26 #include "ash/virtual_keyboard_controller.h" |
| 27 #include "ash/wm/drag_window_resizer.h" | 27 #include "ash/wm/drag_window_resizer.h" |
| 28 #include "ash/wm/lock_state_controller.h" | 28 #include "ash/wm/lock_state_controller.h" |
| 29 #include "ash/wm/maximize_mode/maximize_mode_event_handler_aura.h" | 29 #include "ash/wm/maximize_mode/maximize_mode_event_handler_aura.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 bool WmShellAura::IsRunningInMash() const { | 78 bool WmShellAura::IsRunningInMash() const { |
| 79 return false; | 79 return false; |
| 80 } | 80 } |
| 81 | 81 |
| 82 WmWindow* WmShellAura::NewWindow(ui::wm::WindowType window_type, | 82 WmWindow* WmShellAura::NewWindow(ui::wm::WindowType window_type, |
| 83 ui::LayerType layer_type) { | 83 ui::LayerType layer_type) { |
| 84 aura::Window* aura_window = new aura::Window(nullptr); | 84 aura::Window* aura_window = new aura::Window(nullptr); |
| 85 aura_window->SetType(window_type); | 85 aura_window->SetType(window_type); |
| 86 aura_window->Init(layer_type); | 86 aura_window->Init(layer_type); |
| 87 return WmWindowAura::Get(aura_window); | 87 return WmWindow::Get(aura_window); |
| 88 } | 88 } |
| 89 | 89 |
| 90 WmWindow* WmShellAura::GetFocusedWindow() { | 90 WmWindow* WmShellAura::GetFocusedWindow() { |
| 91 return WmWindowAura::Get( | 91 return WmWindow::Get( |
| 92 aura::client::GetFocusClient(Shell::GetPrimaryRootWindow()) | 92 aura::client::GetFocusClient(Shell::GetPrimaryRootWindow()) |
| 93 ->GetFocusedWindow()); | 93 ->GetFocusedWindow()); |
| 94 } | 94 } |
| 95 | 95 |
| 96 WmWindow* WmShellAura::GetActiveWindow() { | 96 WmWindow* WmShellAura::GetActiveWindow() { |
| 97 return WmWindowAura::Get(wm::GetActiveWindow()); | 97 return WmWindow::Get(wm::GetActiveWindow()); |
| 98 } | 98 } |
| 99 | 99 |
| 100 WmWindow* WmShellAura::GetCaptureWindow() { | 100 WmWindow* WmShellAura::GetCaptureWindow() { |
| 101 // Ash shares capture client among all RootWindowControllers, so we need only | 101 // Ash shares capture client among all RootWindowControllers, so we need only |
| 102 // check the primary root. | 102 // check the primary root. |
| 103 return WmWindowAura::Get( | 103 return WmWindow::Get( |
| 104 aura::client::GetCaptureWindow(Shell::GetPrimaryRootWindow())); | 104 aura::client::GetCaptureWindow(Shell::GetPrimaryRootWindow())); |
| 105 } | 105 } |
| 106 | 106 |
| 107 WmWindow* WmShellAura::GetPrimaryRootWindow() { | 107 WmWindow* WmShellAura::GetPrimaryRootWindow() { |
| 108 return WmWindowAura::Get(Shell::GetPrimaryRootWindow()); | 108 return WmWindow::Get(Shell::GetPrimaryRootWindow()); |
| 109 } | 109 } |
| 110 | 110 |
| 111 WmWindow* WmShellAura::GetRootWindowForDisplayId(int64_t display_id) { | 111 WmWindow* WmShellAura::GetRootWindowForDisplayId(int64_t display_id) { |
| 112 return WmWindowAura::Get(Shell::GetInstance() | 112 return WmWindow::Get(Shell::GetInstance() |
| 113 ->window_tree_host_manager() | 113 ->window_tree_host_manager() |
| 114 ->GetRootWindowForDisplayId(display_id)); | 114 ->GetRootWindowForDisplayId(display_id)); |
| 115 } | 115 } |
| 116 | 116 |
| 117 const display::ManagedDisplayInfo& WmShellAura::GetDisplayInfo( | 117 const display::ManagedDisplayInfo& WmShellAura::GetDisplayInfo( |
| 118 int64_t display_id) const { | 118 int64_t display_id) const { |
| 119 return Shell::GetInstance()->display_manager()->GetDisplayInfo(display_id); | 119 return Shell::GetInstance()->display_manager()->GetDisplayInfo(display_id); |
| 120 } | 120 } |
| 121 | 121 |
| 122 bool WmShellAura::IsActiveDisplayId(int64_t display_id) const { | 122 bool WmShellAura::IsActiveDisplayId(int64_t display_id) const { |
| 123 return Shell::GetInstance()->display_manager()->IsActiveDisplayId(display_id); | 123 return Shell::GetInstance()->display_manager()->IsActiveDisplayId(display_id); |
| 124 } | 124 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 139 ->current_default_multi_display_mode() == | 139 ->current_default_multi_display_mode() == |
| 140 display::DisplayManager::UNIFIED; | 140 display::DisplayManager::UNIFIED; |
| 141 } | 141 } |
| 142 | 142 |
| 143 bool WmShellAura::IsForceMaximizeOnFirstRun() { | 143 bool WmShellAura::IsForceMaximizeOnFirstRun() { |
| 144 return delegate()->IsForceMaximizeOnFirstRun(); | 144 return delegate()->IsForceMaximizeOnFirstRun(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void WmShellAura::SetDisplayWorkAreaInsets(WmWindow* window, | 147 void WmShellAura::SetDisplayWorkAreaInsets(WmWindow* window, |
| 148 const gfx::Insets& insets) { | 148 const gfx::Insets& insets) { |
| 149 aura::Window* aura_window = WmWindowAura::GetAuraWindow(window); | 149 aura::Window* aura_window = WmWindow::GetAuraWindow(window); |
| 150 Shell::GetInstance()->SetDisplayWorkAreaInsets(aura_window, insets); | 150 Shell::GetInstance()->SetDisplayWorkAreaInsets(aura_window, insets); |
| 151 } | 151 } |
| 152 | 152 |
| 153 bool WmShellAura::IsPinned() { | 153 bool WmShellAura::IsPinned() { |
| 154 return Shell::GetInstance()->screen_pinning_controller()->IsPinned(); | 154 return Shell::GetInstance()->screen_pinning_controller()->IsPinned(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void WmShellAura::SetPinnedWindow(WmWindow* window) { | 157 void WmShellAura::SetPinnedWindow(WmWindow* window) { |
| 158 return Shell::GetInstance()->screen_pinning_controller()->SetPinnedWindow( | 158 return Shell::GetInstance()->screen_pinning_controller()->SetPinnedWindow( |
| 159 window); | 159 window); |
| 160 } | 160 } |
| 161 | 161 |
| 162 void WmShellAura::LockCursor() { | 162 void WmShellAura::LockCursor() { |
| 163 Shell::GetInstance()->cursor_manager()->LockCursor(); | 163 Shell::GetInstance()->cursor_manager()->LockCursor(); |
| 164 } | 164 } |
| 165 | 165 |
| 166 void WmShellAura::UnlockCursor() { | 166 void WmShellAura::UnlockCursor() { |
| 167 Shell::GetInstance()->cursor_manager()->UnlockCursor(); | 167 Shell::GetInstance()->cursor_manager()->UnlockCursor(); |
| 168 } | 168 } |
| 169 | 169 |
| 170 bool WmShellAura::IsMouseEventsEnabled() { | 170 bool WmShellAura::IsMouseEventsEnabled() { |
| 171 return Shell::GetInstance()->cursor_manager()->IsMouseEventsEnabled(); | 171 return Shell::GetInstance()->cursor_manager()->IsMouseEventsEnabled(); |
| 172 } | 172 } |
| 173 | 173 |
| 174 std::vector<WmWindow*> WmShellAura::GetAllRootWindows() { | 174 std::vector<WmWindow*> WmShellAura::GetAllRootWindows() { |
| 175 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 175 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 176 std::vector<WmWindow*> wm_windows(root_windows.size()); | 176 std::vector<WmWindow*> wm_windows(root_windows.size()); |
| 177 for (size_t i = 0; i < root_windows.size(); ++i) | 177 for (size_t i = 0; i < root_windows.size(); ++i) |
| 178 wm_windows[i] = WmWindowAura::Get(root_windows[i]); | 178 wm_windows[i] = WmWindow::Get(root_windows[i]); |
| 179 return wm_windows; | 179 return wm_windows; |
| 180 } | 180 } |
| 181 | 181 |
| 182 void WmShellAura::RecordUserMetricsAction(UserMetricsAction action) { | 182 void WmShellAura::RecordUserMetricsAction(UserMetricsAction action) { |
| 183 Shell::GetInstance()->metrics()->RecordUserMetricsAction(action); | 183 Shell::GetInstance()->metrics()->RecordUserMetricsAction(action); |
| 184 } | 184 } |
| 185 | 185 |
| 186 void WmShellAura::RecordGestureAction(GestureActionType action) { | 186 void WmShellAura::RecordGestureAction(GestureActionType action) { |
| 187 TouchUMA::GetInstance()->RecordGestureAction(action); | 187 TouchUMA::GetInstance()->RecordGestureAction(action); |
| 188 } | 188 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 } | 295 } |
| 296 | 296 |
| 297 void WmShellAura::SetLaserPointerEnabled(bool enabled) { | 297 void WmShellAura::SetLaserPointerEnabled(bool enabled) { |
| 298 Shell::GetInstance()->laser_pointer_controller()->SetEnabled(enabled); | 298 Shell::GetInstance()->laser_pointer_controller()->SetEnabled(enabled); |
| 299 } | 299 } |
| 300 | 300 |
| 301 void WmShellAura::OnWindowActivated( | 301 void WmShellAura::OnWindowActivated( |
| 302 aura::client::ActivationChangeObserver::ActivationReason reason, | 302 aura::client::ActivationChangeObserver::ActivationReason reason, |
| 303 aura::Window* gained_active, | 303 aura::Window* gained_active, |
| 304 aura::Window* lost_active) { | 304 aura::Window* lost_active) { |
| 305 WmWindow* gained_active_wm = WmWindowAura::Get(gained_active); | 305 WmWindow* gained_active_wm = WmWindow::Get(gained_active); |
| 306 WmWindow* lost_active_wm = WmWindowAura::Get(lost_active); | 306 WmWindow* lost_active_wm = WmWindow::Get(lost_active); |
| 307 if (gained_active_wm) | 307 if (gained_active_wm) |
| 308 set_root_window_for_new_windows(gained_active_wm->GetRootWindow()); | 308 set_root_window_for_new_windows(gained_active_wm->GetRootWindow()); |
| 309 for (auto& observer : activation_observers_) | 309 for (auto& observer : activation_observers_) |
| 310 observer.OnWindowActivated(gained_active_wm, lost_active_wm); | 310 observer.OnWindowActivated(gained_active_wm, lost_active_wm); |
| 311 } | 311 } |
| 312 | 312 |
| 313 void WmShellAura::OnAttemptToReactivateWindow(aura::Window* request_active, | 313 void WmShellAura::OnAttemptToReactivateWindow(aura::Window* request_active, |
| 314 aura::Window* actual_active) { | 314 aura::Window* actual_active) { |
| 315 for (auto& observer : activation_observers_) { | 315 for (auto& observer : activation_observers_) { |
| 316 observer.OnAttemptToReactivateWindow(WmWindowAura::Get(request_active), | 316 observer.OnAttemptToReactivateWindow(WmWindow::Get(request_active), |
| 317 WmWindowAura::Get(actual_active)); | 317 WmWindow::Get(actual_active)); |
| 318 } | 318 } |
| 319 } | 319 } |
| 320 | 320 |
| 321 void WmShellAura::SessionStateChanged(session_manager::SessionState state) { | 321 void WmShellAura::SessionStateChanged(session_manager::SessionState state) { |
| 322 // Create the shelf if necessary. | 322 // Create the shelf if necessary. |
| 323 WmShell::SessionStateChanged(state); | 323 WmShell::SessionStateChanged(state); |
| 324 | 324 |
| 325 // Recreate the keyboard after initial login and after multiprofile login. | 325 // Recreate the keyboard after initial login and after multiprofile login. |
| 326 if (state == session_manager::SessionState::ACTIVE) | 326 if (state == session_manager::SessionState::ACTIVE) |
| 327 Shell::GetInstance()->CreateKeyboard(); | 327 Shell::GetInstance()->CreateKeyboard(); |
| 328 } | 328 } |
| 329 | 329 |
| 330 void WmShellAura::OnDisplayConfigurationChanging() { | 330 void WmShellAura::OnDisplayConfigurationChanging() { |
| 331 for (auto& observer : display_observers_) | 331 for (auto& observer : display_observers_) |
| 332 observer.OnDisplayConfigurationChanging(); | 332 observer.OnDisplayConfigurationChanging(); |
| 333 } | 333 } |
| 334 | 334 |
| 335 void WmShellAura::OnDisplayConfigurationChanged() { | 335 void WmShellAura::OnDisplayConfigurationChanged() { |
| 336 for (auto& observer : display_observers_) | 336 for (auto& observer : display_observers_) |
| 337 observer.OnDisplayConfigurationChanged(); | 337 observer.OnDisplayConfigurationChanged(); |
| 338 } | 338 } |
| 339 | 339 |
| 340 } // namespace ash | 340 } // namespace ash |
| OLD | NEW |