| 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/wm_activation_observer.h" | 8 #include "ash/common/wm_activation_observer.h" |
| 9 #include "ash/common/wm_display_observer.h" | 9 #include "ash/common/wm_display_observer.h" |
| 10 #include "ash/common/wm_overview_mode_observer.h" | 10 #include "ash/common/wm_overview_mode_observer.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 namespace ash { | 23 namespace ash { |
| 24 | 24 |
| 25 WmShellAura::WmShellAura() { | 25 WmShellAura::WmShellAura() { |
| 26 WmShell::Set(this); | 26 WmShell::Set(this); |
| 27 Shell::GetInstance()->AddShellObserver(this); | 27 Shell::GetInstance()->AddShellObserver(this); |
| 28 } | 28 } |
| 29 | 29 |
| 30 WmShellAura::~WmShellAura() { | 30 WmShellAura::~WmShellAura() { |
| 31 WmShell::Set(nullptr); | 31 WmShell::Set(nullptr); |
| 32 if (added_activation_observer_) { | 32 |
| 33 aura::client::GetActivationClient(Shell::GetPrimaryRootWindow()) | 33 if (added_activation_observer_) |
| 34 ->RemoveObserver(this); | 34 Shell::GetInstance()->activation_client()->RemoveObserver(this); |
| 35 } | 35 |
| 36 if (added_display_observer_) | 36 if (added_display_observer_) |
| 37 Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); | 37 Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); |
| 38 | 38 |
| 39 Shell::GetInstance()->RemoveShellObserver(this); | 39 Shell::GetInstance()->RemoveShellObserver(this); |
| 40 } | 40 } |
| 41 | 41 |
| 42 WmWindow* WmShellAura::NewContainerWindow() { | 42 WmWindow* WmShellAura::NewContainerWindow() { |
| 43 aura::Window* aura_window = new aura::Window(nullptr); | 43 aura::Window* aura_window = new aura::Window(nullptr); |
| 44 aura_window->Init(ui::LAYER_NOT_DRAWN); | 44 aura_window->Init(ui::LAYER_NOT_DRAWN); |
| 45 return WmWindowAura::Get(aura_window); | 45 return WmWindowAura::Get(aura_window); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 63 return WmWindowAura::Get(Shell::GetInstance() | 63 return WmWindowAura::Get(Shell::GetInstance() |
| 64 ->window_tree_host_manager() | 64 ->window_tree_host_manager() |
| 65 ->GetRootWindowForDisplayId(display_id)); | 65 ->GetRootWindowForDisplayId(display_id)); |
| 66 } | 66 } |
| 67 | 67 |
| 68 WmWindow* WmShellAura::GetRootWindowForNewWindows() { | 68 WmWindow* WmShellAura::GetRootWindowForNewWindows() { |
| 69 return WmWindowAura::Get(Shell::GetTargetRootWindow()); | 69 return WmWindowAura::Get(Shell::GetTargetRootWindow()); |
| 70 } | 70 } |
| 71 | 71 |
| 72 std::vector<WmWindow*> WmShellAura::GetMruWindowList() { | 72 std::vector<WmWindow*> WmShellAura::GetMruWindowList() { |
| 73 return WmWindowAura::FromAuraWindows( | 73 // TODO(sky): remove this and provide accessor for MruWindowTracker. |
| 74 Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList()); | 74 // http://crbug.com/617789. |
| 75 return Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList(); |
| 75 } | 76 } |
| 76 | 77 |
| 77 std::vector<WmWindow*> WmShellAura::GetMruWindowListIgnoreModals() { | 78 std::vector<WmWindow*> WmShellAura::GetMruWindowListIgnoreModals() { |
| 78 return WmWindowAura::FromAuraWindows( | 79 // TODO(sky): remove this and provide accessor for MruWindowTracker. |
| 79 Shell::GetInstance()->mru_window_tracker()->BuildWindowListIgnoreModal()); | 80 // http://crbug.com/617789. |
| 81 return Shell::GetInstance() |
| 82 ->mru_window_tracker() |
| 83 ->BuildWindowListIgnoreModal(); |
| 80 } | 84 } |
| 81 | 85 |
| 82 bool WmShellAura::IsForceMaximizeOnFirstRun() { | 86 bool WmShellAura::IsForceMaximizeOnFirstRun() { |
| 83 return Shell::GetInstance()->delegate()->IsForceMaximizeOnFirstRun(); | 87 return Shell::GetInstance()->delegate()->IsForceMaximizeOnFirstRun(); |
| 84 } | 88 } |
| 85 | 89 |
| 86 bool WmShellAura::IsUserSessionBlocked() { | 90 bool WmShellAura::IsUserSessionBlocked() { |
| 87 return Shell::GetInstance()->session_state_delegate()->IsUserSessionBlocked(); | 91 return Shell::GetInstance()->session_state_delegate()->IsUserSessionBlocked(); |
| 88 } | 92 } |
| 89 | 93 |
| 90 bool WmShellAura::IsScreenLocked() { | 94 bool WmShellAura::IsScreenLocked() { |
| 91 return Shell::GetInstance()->session_state_delegate()->IsScreenLocked(); | 95 return Shell::GetInstance()->session_state_delegate()->IsScreenLocked(); |
| 92 } | 96 } |
| 93 | 97 |
| 98 bool WmShellAura::CanShowWindowForUser(WmWindow* window) { |
| 99 return Shell::GetInstance()->delegate()->CanShowWindowForUser( |
| 100 WmWindowAura::GetAuraWindow(window)); |
| 101 } |
| 102 |
| 94 void WmShellAura::LockCursor() { | 103 void WmShellAura::LockCursor() { |
| 95 Shell::GetInstance()->cursor_manager()->LockCursor(); | 104 Shell::GetInstance()->cursor_manager()->LockCursor(); |
| 96 } | 105 } |
| 97 | 106 |
| 98 void WmShellAura::UnlockCursor() { | 107 void WmShellAura::UnlockCursor() { |
| 99 Shell::GetInstance()->cursor_manager()->UnlockCursor(); | 108 Shell::GetInstance()->cursor_manager()->UnlockCursor(); |
| 100 } | 109 } |
| 101 | 110 |
| 102 std::vector<WmWindow*> WmShellAura::GetAllRootWindows() { | 111 std::vector<WmWindow*> WmShellAura::GetAllRootWindows() { |
| 103 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 112 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 128 bool WmShellAura::IsOverviewModeRestoringMinimizedWindows() { | 137 bool WmShellAura::IsOverviewModeRestoringMinimizedWindows() { |
| 129 WindowSelectorController* window_selector_controller = | 138 WindowSelectorController* window_selector_controller = |
| 130 Shell::GetInstance()->window_selector_controller(); | 139 Shell::GetInstance()->window_selector_controller(); |
| 131 return window_selector_controller && | 140 return window_selector_controller && |
| 132 window_selector_controller->IsRestoringMinimizedWindows(); | 141 window_selector_controller->IsRestoringMinimizedWindows(); |
| 133 } | 142 } |
| 134 | 143 |
| 135 void WmShellAura::AddActivationObserver(WmActivationObserver* observer) { | 144 void WmShellAura::AddActivationObserver(WmActivationObserver* observer) { |
| 136 if (!added_activation_observer_) { | 145 if (!added_activation_observer_) { |
| 137 added_activation_observer_ = true; | 146 added_activation_observer_ = true; |
| 138 aura::client::GetActivationClient(Shell::GetPrimaryRootWindow()) | 147 Shell::GetInstance()->activation_client()->AddObserver(this); |
| 139 ->AddObserver(this); | |
| 140 } | 148 } |
| 141 activation_observers_.AddObserver(observer); | 149 activation_observers_.AddObserver(observer); |
| 142 } | 150 } |
| 143 | 151 |
| 144 void WmShellAura::RemoveActivationObserver(WmActivationObserver* observer) { | 152 void WmShellAura::RemoveActivationObserver(WmActivationObserver* observer) { |
| 145 activation_observers_.RemoveObserver(observer); | 153 activation_observers_.RemoveObserver(observer); |
| 146 } | 154 } |
| 147 | 155 |
| 148 void WmShellAura::AddDisplayObserver(WmDisplayObserver* observer) { | 156 void WmShellAura::AddDisplayObserver(WmDisplayObserver* observer) { |
| 149 if (!added_display_observer_) { | 157 if (!added_display_observer_) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 FOR_EACH_OBSERVER(WmDisplayObserver, display_observers_, | 199 FOR_EACH_OBSERVER(WmDisplayObserver, display_observers_, |
| 192 OnDisplayConfigurationChanged()); | 200 OnDisplayConfigurationChanged()); |
| 193 } | 201 } |
| 194 | 202 |
| 195 void WmShellAura::OnOverviewModeEnded() { | 203 void WmShellAura::OnOverviewModeEnded() { |
| 196 FOR_EACH_OBSERVER(WmOverviewModeObserver, overview_mode_observers_, | 204 FOR_EACH_OBSERVER(WmOverviewModeObserver, overview_mode_observers_, |
| 197 OnOverviewModeEnded()); | 205 OnOverviewModeEnded()); |
| 198 } | 206 } |
| 199 | 207 |
| 200 } // namespace ash | 208 } // namespace ash |
| OLD | NEW |