| 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 "ash/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
| 8 #include "ash/common/session/session_state_delegate.h" | 8 #include "ash/common/session/session_state_delegate.h" |
| 9 #include "ash/common/shell_observer.h" | 9 #include "ash/common/shell_observer.h" |
| 10 #include "ash/common/wm/mru_window_tracker.h" | 10 #include "ash/common/wm/mru_window_tracker.h" |
| 11 #include "ash/common/wm/overview/window_selector_controller.h" | 11 #include "ash/common/wm/overview/window_selector_controller.h" |
| 12 #include "ash/common/wm_activation_observer.h" | 12 #include "ash/common/wm_activation_observer.h" |
| 13 #include "ash/common/wm_display_observer.h" | 13 #include "ash/common/wm_display_observer.h" |
| 14 #include "ash/common/wm_shell_common.h" | |
| 15 #include "ash/display/display_manager.h" | 14 #include "ash/display/display_manager.h" |
| 16 #include "ash/display/window_tree_host_manager.h" | 15 #include "ash/display/window_tree_host_manager.h" |
| 17 #include "ash/shell.h" | 16 #include "ash/shell.h" |
| 18 #include "ash/shell_delegate.h" | 17 #include "ash/shell_delegate.h" |
| 19 #include "ash/wm/drag_window_resizer.h" | 18 #include "ash/wm/drag_window_resizer.h" |
| 20 #include "ash/wm/maximize_mode/maximize_mode_event_handler_aura.h" | 19 #include "ash/wm/maximize_mode/maximize_mode_event_handler_aura.h" |
| 21 #include "ash/wm/screen_pinning_controller.h" | 20 #include "ash/wm/screen_pinning_controller.h" |
| 22 #include "ash/wm/window_util.h" | 21 #include "ash/wm/window_util.h" |
| 23 #include "base/memory/ptr_util.h" | 22 #include "base/memory/ptr_util.h" |
| 24 #include "ui/aura/client/focus_client.h" | 23 #include "ui/aura/client/focus_client.h" |
| 25 #include "ui/wm/public/activation_client.h" | 24 #include "ui/wm/public/activation_client.h" |
| 26 | 25 |
| 27 #if defined(OS_CHROMEOS) | 26 #if defined(OS_CHROMEOS) |
| 28 #include "ash/virtual_keyboard_controller.h" | 27 #include "ash/virtual_keyboard_controller.h" |
| 29 #endif | 28 #endif |
| 30 | 29 |
| 31 namespace ash { | 30 namespace ash { |
| 32 | 31 |
| 33 WmShellAura::WmShellAura(WmShellCommon* wm_shell_common) | 32 WmShellAura::WmShellAura() { |
| 34 : wm_shell_common_(wm_shell_common) { | |
| 35 WmShell::Set(this); | 33 WmShell::Set(this); |
| 36 } | 34 } |
| 37 | 35 |
| 38 WmShellAura::~WmShellAura() { | 36 WmShellAura::~WmShellAura() { |
| 39 WmShell::Set(nullptr); | 37 WmShell::Set(nullptr); |
| 40 } | 38 } |
| 41 | 39 |
| 42 void WmShellAura::PrepareForShutdown() { | 40 void WmShellAura::PrepareForShutdown() { |
| 43 if (added_activation_observer_) | 41 if (added_activation_observer_) |
| 44 Shell::GetInstance()->activation_client()->RemoveObserver(this); | 42 Shell::GetInstance()->activation_client()->RemoveObserver(this); |
| 45 | 43 |
| 46 if (added_display_observer_) | 44 if (added_display_observer_) |
| 47 Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); | 45 Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); |
| 48 } | 46 } |
| 49 | 47 |
| 50 MruWindowTracker* WmShellAura::GetMruWindowTracker() { | |
| 51 return wm_shell_common_->mru_window_tracker(); | |
| 52 } | |
| 53 | |
| 54 WmWindow* WmShellAura::NewContainerWindow() { | 48 WmWindow* WmShellAura::NewContainerWindow() { |
| 55 aura::Window* aura_window = new aura::Window(nullptr); | 49 aura::Window* aura_window = new aura::Window(nullptr); |
| 56 aura_window->Init(ui::LAYER_NOT_DRAWN); | 50 aura_window->Init(ui::LAYER_NOT_DRAWN); |
| 57 return WmWindowAura::Get(aura_window); | 51 return WmWindowAura::Get(aura_window); |
| 58 } | 52 } |
| 59 | 53 |
| 60 WmWindow* WmShellAura::GetFocusedWindow() { | 54 WmWindow* WmShellAura::GetFocusedWindow() { |
| 61 return WmWindowAura::Get( | 55 return WmWindowAura::Get( |
| 62 aura::client::GetFocusClient(Shell::GetPrimaryRootWindow()) | 56 aura::client::GetFocusClient(Shell::GetPrimaryRootWindow()) |
| 63 ->GetFocusedWindow()); | 57 ->GetFocusedWindow()); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 return base::WrapUnique( | 122 return base::WrapUnique( |
| 129 DragWindowResizer::Create(next_window_resizer.release(), window_state)); | 123 DragWindowResizer::Create(next_window_resizer.release(), window_state)); |
| 130 } | 124 } |
| 131 | 125 |
| 132 std::unique_ptr<wm::MaximizeModeEventHandler> | 126 std::unique_ptr<wm::MaximizeModeEventHandler> |
| 133 WmShellAura::CreateMaximizeModeEventHandler() { | 127 WmShellAura::CreateMaximizeModeEventHandler() { |
| 134 return base::WrapUnique(new wm::MaximizeModeEventHandlerAura); | 128 return base::WrapUnique(new wm::MaximizeModeEventHandlerAura); |
| 135 } | 129 } |
| 136 | 130 |
| 137 void WmShellAura::OnOverviewModeStarting() { | 131 void WmShellAura::OnOverviewModeStarting() { |
| 138 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_common_->shell_observers(), | 132 FOR_EACH_OBSERVER(ShellObserver, *shell_observers(), |
| 139 OnOverviewModeStarting()); | 133 OnOverviewModeStarting()); |
| 140 } | 134 } |
| 141 | 135 |
| 142 void WmShellAura::OnOverviewModeEnded() { | 136 void WmShellAura::OnOverviewModeEnded() { |
| 143 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_common_->shell_observers(), | 137 FOR_EACH_OBSERVER(ShellObserver, *shell_observers(), OnOverviewModeEnded()); |
| 144 OnOverviewModeEnded()); | |
| 145 } | 138 } |
| 146 | 139 |
| 147 AccessibilityDelegate* WmShellAura::GetAccessibilityDelegate() { | 140 AccessibilityDelegate* WmShellAura::GetAccessibilityDelegate() { |
| 148 return Shell::GetInstance()->accessibility_delegate(); | 141 return Shell::GetInstance()->accessibility_delegate(); |
| 149 } | 142 } |
| 150 | 143 |
| 151 SessionStateDelegate* WmShellAura::GetSessionStateDelegate() { | 144 SessionStateDelegate* WmShellAura::GetSessionStateDelegate() { |
| 152 return Shell::GetInstance()->session_state_delegate(); | 145 return Shell::GetInstance()->session_state_delegate(); |
| 153 } | 146 } |
| 154 | 147 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 169 added_display_observer_ = true; | 162 added_display_observer_ = true; |
| 170 Shell::GetInstance()->window_tree_host_manager()->AddObserver(this); | 163 Shell::GetInstance()->window_tree_host_manager()->AddObserver(this); |
| 171 } | 164 } |
| 172 display_observers_.AddObserver(observer); | 165 display_observers_.AddObserver(observer); |
| 173 } | 166 } |
| 174 | 167 |
| 175 void WmShellAura::RemoveDisplayObserver(WmDisplayObserver* observer) { | 168 void WmShellAura::RemoveDisplayObserver(WmDisplayObserver* observer) { |
| 176 display_observers_.RemoveObserver(observer); | 169 display_observers_.RemoveObserver(observer); |
| 177 } | 170 } |
| 178 | 171 |
| 179 void WmShellAura::AddShellObserver(ShellObserver* observer) { | |
| 180 wm_shell_common_->AddShellObserver(observer); | |
| 181 } | |
| 182 | |
| 183 void WmShellAura::RemoveShellObserver(ShellObserver* observer) { | |
| 184 wm_shell_common_->RemoveShellObserver(observer); | |
| 185 } | |
| 186 | |
| 187 void WmShellAura::AddPointerWatcher(views::PointerWatcher* watcher) { | 172 void WmShellAura::AddPointerWatcher(views::PointerWatcher* watcher) { |
| 188 Shell::GetInstance()->AddPointerWatcher(watcher); | 173 Shell::GetInstance()->AddPointerWatcher(watcher); |
| 189 } | 174 } |
| 190 | 175 |
| 191 void WmShellAura::RemovePointerWatcher(views::PointerWatcher* watcher) { | 176 void WmShellAura::RemovePointerWatcher(views::PointerWatcher* watcher) { |
| 192 Shell::GetInstance()->RemovePointerWatcher(watcher); | 177 Shell::GetInstance()->RemovePointerWatcher(watcher); |
| 193 } | 178 } |
| 194 | 179 |
| 195 #if defined(OS_CHROMEOS) | 180 #if defined(OS_CHROMEOS) |
| 196 void WmShellAura::ToggleIgnoreExternalKeyboard() { | 181 void WmShellAura::ToggleIgnoreExternalKeyboard() { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 221 FOR_EACH_OBSERVER(WmDisplayObserver, display_observers_, | 206 FOR_EACH_OBSERVER(WmDisplayObserver, display_observers_, |
| 222 OnDisplayConfigurationChanging()); | 207 OnDisplayConfigurationChanging()); |
| 223 } | 208 } |
| 224 | 209 |
| 225 void WmShellAura::OnDisplayConfigurationChanged() { | 210 void WmShellAura::OnDisplayConfigurationChanged() { |
| 226 FOR_EACH_OBSERVER(WmDisplayObserver, display_observers_, | 211 FOR_EACH_OBSERVER(WmDisplayObserver, display_observers_, |
| 227 OnDisplayConfigurationChanged()); | 212 OnDisplayConfigurationChanged()); |
| 228 } | 213 } |
| 229 | 214 |
| 230 } // namespace ash | 215 } // namespace ash |
| OLD | NEW |