| 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/accelerators/accelerator_controller_delegate_aura.h" |
| 9 #include "ash/aura/key_event_watcher_aura.h" | 10 #include "ash/aura/key_event_watcher_aura.h" |
| 10 #include "ash/aura/pointer_watcher_adapter.h" | 11 #include "ash/aura/pointer_watcher_adapter.h" |
| 12 #include "ash/common/accelerators/accelerator_controller.h" |
| 11 #include "ash/common/session/session_state_delegate.h" | 13 #include "ash/common/session/session_state_delegate.h" |
| 12 #include "ash/common/shell_delegate.h" | 14 #include "ash/common/shell_delegate.h" |
| 13 #include "ash/common/shell_observer.h" | 15 #include "ash/common/shell_observer.h" |
| 14 #include "ash/common/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard
.h" | 16 #include "ash/common/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard
.h" |
| 15 #include "ash/common/wm/mru_window_tracker.h" | 17 #include "ash/common/wm/mru_window_tracker.h" |
| 16 #include "ash/common/wm/overview/window_selector_controller.h" | 18 #include "ash/common/wm/overview/window_selector_controller.h" |
| 17 #include "ash/common/wm_display_observer.h" | 19 #include "ash/common/wm_display_observer.h" |
| 18 #include "ash/common/wm_window.h" | 20 #include "ash/common/wm_window.h" |
| 19 #include "ash/display/window_tree_host_manager.h" | 21 #include "ash/display/window_tree_host_manager.h" |
| 20 #include "ash/host/ash_window_tree_host_init_params.h" | 22 #include "ash/host/ash_window_tree_host_init_params.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 44 #if defined(USE_OZONE) | 46 #if defined(USE_OZONE) |
| 45 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.
h" | 47 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.
h" |
| 46 #endif | 48 #endif |
| 47 | 49 |
| 48 namespace ash { | 50 namespace ash { |
| 49 | 51 |
| 50 WmShellAura::WmShellAura() {} | 52 WmShellAura::WmShellAura() {} |
| 51 | 53 |
| 52 WmShellAura::~WmShellAura() {} | 54 WmShellAura::~WmShellAura() {} |
| 53 | 55 |
| 56 // static |
| 57 WmShellAura* WmShellAura::Get() { |
| 58 CHECK(!WmShell::Get()->IsRunningInMash()); |
| 59 return static_cast<WmShellAura*>(WmShell::Get()); |
| 60 } |
| 61 |
| 54 void WmShellAura::Shutdown() { | 62 void WmShellAura::Shutdown() { |
| 55 if (added_display_observer_) | 63 if (added_display_observer_) |
| 56 Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); | 64 Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); |
| 57 | 65 |
| 58 pointer_watcher_adapter_.reset(); | 66 pointer_watcher_adapter_.reset(); |
| 59 | 67 |
| 60 WmShell::Shutdown(); | 68 WmShell::Shutdown(); |
| 61 | 69 |
| 62 Shell::GetInstance()->window_tree_host_manager()->Shutdown(); | 70 Shell::GetInstance()->window_tree_host_manager()->Shutdown(); |
| 63 } | 71 } |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 Shell::GetInstance()->window_tree_host_manager()->Start(); | 270 Shell::GetInstance()->window_tree_host_manager()->Start(); |
| 263 AshWindowTreeHostInitParams ash_init_params; | 271 AshWindowTreeHostInitParams ash_init_params; |
| 264 Shell::GetInstance()->window_tree_host_manager()->CreatePrimaryHost( | 272 Shell::GetInstance()->window_tree_host_manager()->CreatePrimaryHost( |
| 265 ash_init_params); | 273 ash_init_params); |
| 266 } | 274 } |
| 267 | 275 |
| 268 void WmShellAura::InitHosts(const ShellInitParams& init_params) { | 276 void WmShellAura::InitHosts(const ShellInitParams& init_params) { |
| 269 Shell::GetInstance()->window_tree_host_manager()->InitHosts(); | 277 Shell::GetInstance()->window_tree_host_manager()->InitHosts(); |
| 270 } | 278 } |
| 271 | 279 |
| 280 std::unique_ptr<AcceleratorController> |
| 281 WmShellAura::CreateAcceleratorController() { |
| 282 DCHECK(!accelerator_controller_delegate_); |
| 283 accelerator_controller_delegate_ = |
| 284 base::MakeUnique<AcceleratorControllerDelegateAura>(); |
| 285 return base::MakeUnique<AcceleratorController>( |
| 286 accelerator_controller_delegate_.get(), nullptr); |
| 287 } |
| 288 |
| 272 void WmShellAura::SessionStateChanged(session_manager::SessionState state) { | 289 void WmShellAura::SessionStateChanged(session_manager::SessionState state) { |
| 273 // Create the shelf if necessary. | 290 // Create the shelf if necessary. |
| 274 WmShell::SessionStateChanged(state); | 291 WmShell::SessionStateChanged(state); |
| 275 | 292 |
| 276 // Recreate the keyboard after initial login and after multiprofile login. | 293 // Recreate the keyboard after initial login and after multiprofile login. |
| 277 if (state == session_manager::SessionState::ACTIVE) | 294 if (state == session_manager::SessionState::ACTIVE) |
| 278 Shell::GetInstance()->CreateKeyboard(); | 295 Shell::GetInstance()->CreateKeyboard(); |
| 279 } | 296 } |
| 280 | 297 |
| 281 void WmShellAura::OnDisplayConfigurationChanging() { | 298 void WmShellAura::OnDisplayConfigurationChanging() { |
| 282 for (auto& observer : display_observers_) | 299 for (auto& observer : display_observers_) |
| 283 observer.OnDisplayConfigurationChanging(); | 300 observer.OnDisplayConfigurationChanging(); |
| 284 } | 301 } |
| 285 | 302 |
| 286 void WmShellAura::OnDisplayConfigurationChanged() { | 303 void WmShellAura::OnDisplayConfigurationChanged() { |
| 287 for (auto& observer : display_observers_) | 304 for (auto& observer : display_observers_) |
| 288 observer.OnDisplayConfigurationChanged(); | 305 observer.OnDisplayConfigurationChanged(); |
| 289 } | 306 } |
| 290 | 307 |
| 291 } // namespace ash | 308 } // namespace ash |
| OLD | NEW |