| 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/pointer_watcher_adapter.h" |
| 9 #include "ash/aura/wm_window_aura.h" | 10 #include "ash/aura/wm_window_aura.h" |
| 10 #include "ash/common/session/session_state_delegate.h" | 11 #include "ash/common/session/session_state_delegate.h" |
| 11 #include "ash/common/shell_delegate.h" | 12 #include "ash/common/shell_delegate.h" |
| 12 #include "ash/common/shell_observer.h" | 13 #include "ash/common/shell_observer.h" |
| 13 #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" |
| 14 #include "ash/common/wm/mru_window_tracker.h" | 15 #include "ash/common/wm/mru_window_tracker.h" |
| 15 #include "ash/common/wm/overview/window_selector_controller.h" | 16 #include "ash/common/wm/overview/window_selector_controller.h" |
| 16 #include "ash/common/wm_activation_observer.h" | 17 #include "ash/common/wm_activation_observer.h" |
| 17 #include "ash/common/wm_display_observer.h" | 18 #include "ash/common/wm_display_observer.h" |
| 18 #include "ash/display/display_manager.h" | 19 #include "ash/display/display_manager.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 48 | 49 |
| 49 WmShellAura::WmShellAura(std::unique_ptr<ShellDelegate> shell_delegate) | 50 WmShellAura::WmShellAura(std::unique_ptr<ShellDelegate> shell_delegate) |
| 50 : WmShell(std::move(shell_delegate)) { | 51 : WmShell(std::move(shell_delegate)) { |
| 51 WmShell::Set(this); | 52 WmShell::Set(this); |
| 52 } | 53 } |
| 53 | 54 |
| 54 WmShellAura::~WmShellAura() { | 55 WmShellAura::~WmShellAura() { |
| 55 WmShell::Set(nullptr); | 56 WmShell::Set(nullptr); |
| 56 } | 57 } |
| 57 | 58 |
| 59 void WmShellAura::CreatePointerWatcherAdapter() { |
| 60 // Must occur after Shell has installed its early pre-target handlers (for |
| 61 // example, WindowModalityController). |
| 62 pointer_watcher_adapter_.reset(new PointerWatcherAdapter); |
| 63 } |
| 64 |
| 58 void WmShellAura::Shutdown() { | 65 void WmShellAura::Shutdown() { |
| 59 if (added_activation_observer_) | 66 if (added_activation_observer_) |
| 60 Shell::GetInstance()->activation_client()->RemoveObserver(this); | 67 Shell::GetInstance()->activation_client()->RemoveObserver(this); |
| 61 | 68 |
| 62 if (added_display_observer_) | 69 if (added_display_observer_) |
| 63 Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); | 70 Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); |
| 64 | 71 |
| 72 pointer_watcher_adapter_.reset(); |
| 73 |
| 65 WmShell::Shutdown(); | 74 WmShell::Shutdown(); |
| 66 } | 75 } |
| 67 | 76 |
| 68 WmWindow* WmShellAura::NewContainerWindow() { | 77 WmWindow* WmShellAura::NewContainerWindow() { |
| 69 aura::Window* aura_window = new aura::Window(nullptr); | 78 aura::Window* aura_window = new aura::Window(nullptr); |
| 70 aura_window->Init(ui::LAYER_NOT_DRAWN); | 79 aura_window->Init(ui::LAYER_NOT_DRAWN); |
| 71 return WmWindowAura::Get(aura_window); | 80 return WmWindowAura::Get(aura_window); |
| 72 } | 81 } |
| 73 | 82 |
| 74 WmWindow* WmShellAura::GetFocusedWindow() { | 83 WmWindow* WmShellAura::GetFocusedWindow() { |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 } | 250 } |
| 242 display_observers_.AddObserver(observer); | 251 display_observers_.AddObserver(observer); |
| 243 } | 252 } |
| 244 | 253 |
| 245 void WmShellAura::RemoveDisplayObserver(WmDisplayObserver* observer) { | 254 void WmShellAura::RemoveDisplayObserver(WmDisplayObserver* observer) { |
| 246 display_observers_.RemoveObserver(observer); | 255 display_observers_.RemoveObserver(observer); |
| 247 } | 256 } |
| 248 | 257 |
| 249 void WmShellAura::AddPointerWatcher(views::PointerWatcher* watcher, | 258 void WmShellAura::AddPointerWatcher(views::PointerWatcher* watcher, |
| 250 bool wants_moves) { | 259 bool wants_moves) { |
| 251 Shell::GetInstance()->AddPointerWatcher(watcher, wants_moves); | 260 pointer_watcher_adapter_->AddPointerWatcher(watcher, wants_moves); |
| 252 } | 261 } |
| 253 | 262 |
| 254 void WmShellAura::RemovePointerWatcher(views::PointerWatcher* watcher) { | 263 void WmShellAura::RemovePointerWatcher(views::PointerWatcher* watcher) { |
| 255 Shell::GetInstance()->RemovePointerWatcher(watcher); | 264 pointer_watcher_adapter_->RemovePointerWatcher(watcher); |
| 256 } | 265 } |
| 257 | 266 |
| 258 bool WmShellAura::IsTouchDown() { | 267 bool WmShellAura::IsTouchDown() { |
| 259 return aura::Env::GetInstance()->is_touch_down(); | 268 return aura::Env::GetInstance()->is_touch_down(); |
| 260 } | 269 } |
| 261 | 270 |
| 262 #if defined(OS_CHROMEOS) | 271 #if defined(OS_CHROMEOS) |
| 263 void WmShellAura::ToggleIgnoreExternalKeyboard() { | 272 void WmShellAura::ToggleIgnoreExternalKeyboard() { |
| 264 Shell::GetInstance() | 273 Shell::GetInstance() |
| 265 ->virtual_keyboard_controller() | 274 ->virtual_keyboard_controller() |
| (...skipping 25 matching lines...) Expand all Loading... |
| 291 FOR_EACH_OBSERVER(WmDisplayObserver, display_observers_, | 300 FOR_EACH_OBSERVER(WmDisplayObserver, display_observers_, |
| 292 OnDisplayConfigurationChanging()); | 301 OnDisplayConfigurationChanging()); |
| 293 } | 302 } |
| 294 | 303 |
| 295 void WmShellAura::OnDisplayConfigurationChanged() { | 304 void WmShellAura::OnDisplayConfigurationChanged() { |
| 296 FOR_EACH_OBSERVER(WmDisplayObserver, display_observers_, | 305 FOR_EACH_OBSERVER(WmDisplayObserver, display_observers_, |
| 297 OnDisplayConfigurationChanged()); | 306 OnDisplayConfigurationChanged()); |
| 298 } | 307 } |
| 299 | 308 |
| 300 } // namespace ash | 309 } // namespace ash |
| OLD | NEW |