| 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/wm/aura/wm_globals_aura.h" | 5 #include "ash/wm/aura/wm_globals_aura.h" |
| 6 | 6 |
| 7 #include "ash/display/window_tree_host_manager.h" | 7 #include "ash/display/window_tree_host_manager.h" |
| 8 #include "ash/session/session_state_delegate.h" | 8 #include "ash/session/session_state_delegate.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_delegate.h" | 10 #include "ash/shell_delegate.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 WmWindow* WmGlobalsAura::GetFocusedWindow() { | 43 WmWindow* WmGlobalsAura::GetFocusedWindow() { |
| 44 return WmWindowAura::Get( | 44 return WmWindowAura::Get( |
| 45 aura::client::GetFocusClient(Shell::GetPrimaryRootWindow()) | 45 aura::client::GetFocusClient(Shell::GetPrimaryRootWindow()) |
| 46 ->GetFocusedWindow()); | 46 ->GetFocusedWindow()); |
| 47 } | 47 } |
| 48 | 48 |
| 49 WmWindow* WmGlobalsAura::GetActiveWindow() { | 49 WmWindow* WmGlobalsAura::GetActiveWindow() { |
| 50 return WmWindowAura::Get(wm::GetActiveWindow()); | 50 return WmWindowAura::Get(wm::GetActiveWindow()); |
| 51 } | 51 } |
| 52 | 52 |
| 53 WmWindow* WmGlobalsAura::GetPrimaryRootWindow() { |
| 54 return WmWindowAura::Get(Shell::GetPrimaryRootWindow()); |
| 55 } |
| 56 |
| 53 WmWindow* WmGlobalsAura::GetRootWindowForDisplayId(int64_t display_id) { | 57 WmWindow* WmGlobalsAura::GetRootWindowForDisplayId(int64_t display_id) { |
| 54 return WmWindowAura::Get(Shell::GetInstance() | 58 return WmWindowAura::Get(Shell::GetInstance() |
| 55 ->window_tree_host_manager() | 59 ->window_tree_host_manager() |
| 56 ->GetRootWindowForDisplayId(display_id)); | 60 ->GetRootWindowForDisplayId(display_id)); |
| 57 } | 61 } |
| 58 | 62 |
| 59 WmWindow* WmGlobalsAura::GetRootWindowForNewWindows() { | 63 WmWindow* WmGlobalsAura::GetRootWindowForNewWindows() { |
| 60 return WmWindowAura::Get(Shell::GetTargetRootWindow()); | 64 return WmWindowAura::Get(Shell::GetTargetRootWindow()); |
| 61 } | 65 } |
| 62 | 66 |
| 67 std::vector<WmWindow*> WmGlobalsAura::GetMruWindowList() { |
| 68 return WmWindowAura::FromAuraWindows( |
| 69 Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList()); |
| 70 } |
| 71 |
| 63 std::vector<WmWindow*> WmGlobalsAura::GetMruWindowListIgnoreModals() { | 72 std::vector<WmWindow*> WmGlobalsAura::GetMruWindowListIgnoreModals() { |
| 64 const std::vector<aura::Window*> windows = ash::Shell::GetInstance() | 73 return WmWindowAura::FromAuraWindows( |
| 65 ->mru_window_tracker() | 74 Shell::GetInstance()->mru_window_tracker()->BuildWindowListIgnoreModal()); |
| 66 ->BuildWindowListIgnoreModal(); | |
| 67 std::vector<WmWindow*> wm_windows(windows.size()); | |
| 68 for (size_t i = 0; i < windows.size(); ++i) | |
| 69 wm_windows[i] = WmWindowAura::Get(windows[i]); | |
| 70 return wm_windows; | |
| 71 } | 75 } |
| 72 | 76 |
| 73 bool WmGlobalsAura::IsForceMaximizeOnFirstRun() { | 77 bool WmGlobalsAura::IsForceMaximizeOnFirstRun() { |
| 74 return Shell::GetInstance()->delegate()->IsForceMaximizeOnFirstRun(); | 78 return Shell::GetInstance()->delegate()->IsForceMaximizeOnFirstRun(); |
| 75 } | 79 } |
| 76 | 80 |
| 77 bool WmGlobalsAura::IsUserSessionBlocked() { | 81 bool WmGlobalsAura::IsUserSessionBlocked() { |
| 78 return Shell::GetInstance()->session_state_delegate()->IsUserSessionBlocked(); | 82 return Shell::GetInstance()->session_state_delegate()->IsUserSessionBlocked(); |
| 79 } | 83 } |
| 80 | 84 |
| 81 bool WmGlobalsAura::IsScreenLocked() { | 85 bool WmGlobalsAura::IsScreenLocked() { |
| 82 return Shell::GetInstance()->session_state_delegate()->IsScreenLocked(); | 86 return Shell::GetInstance()->session_state_delegate()->IsScreenLocked(); |
| 83 } | 87 } |
| 84 | 88 |
| 85 void WmGlobalsAura::LockCursor() { | 89 void WmGlobalsAura::LockCursor() { |
| 86 ash::Shell::GetInstance()->cursor_manager()->LockCursor(); | 90 Shell::GetInstance()->cursor_manager()->LockCursor(); |
| 87 } | 91 } |
| 88 | 92 |
| 89 void WmGlobalsAura::UnlockCursor() { | 93 void WmGlobalsAura::UnlockCursor() { |
| 90 ash::Shell::GetInstance()->cursor_manager()->UnlockCursor(); | 94 Shell::GetInstance()->cursor_manager()->UnlockCursor(); |
| 91 } | 95 } |
| 92 | 96 |
| 93 std::vector<WmWindow*> WmGlobalsAura::GetAllRootWindows() { | 97 std::vector<WmWindow*> WmGlobalsAura::GetAllRootWindows() { |
| 94 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 98 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 95 std::vector<WmWindow*> wm_windows(root_windows.size()); | 99 std::vector<WmWindow*> wm_windows(root_windows.size()); |
| 96 for (size_t i = 0; i < root_windows.size(); ++i) | 100 for (size_t i = 0; i < root_windows.size(); ++i) |
| 97 wm_windows[i] = WmWindowAura::Get(root_windows[i]); | 101 wm_windows[i] = WmWindowAura::Get(root_windows[i]); |
| 98 return wm_windows; | 102 return wm_windows; |
| 99 } | 103 } |
| 100 | 104 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 163 |
| 160 void WmGlobalsAura::OnWindowActivated( | 164 void WmGlobalsAura::OnWindowActivated( |
| 161 aura::client::ActivationChangeObserver::ActivationReason reason, | 165 aura::client::ActivationChangeObserver::ActivationReason reason, |
| 162 aura::Window* gained_active, | 166 aura::Window* gained_active, |
| 163 aura::Window* lost_active) { | 167 aura::Window* lost_active) { |
| 164 FOR_EACH_OBSERVER(WmActivationObserver, activation_observers_, | 168 FOR_EACH_OBSERVER(WmActivationObserver, activation_observers_, |
| 165 OnWindowActivated(WmWindowAura::Get(gained_active), | 169 OnWindowActivated(WmWindowAura::Get(gained_active), |
| 166 WmWindowAura::Get(lost_active))); | 170 WmWindowAura::Get(lost_active))); |
| 167 } | 171 } |
| 168 | 172 |
| 173 void WmGlobalsAura::OnAttemptToReactivateWindow(aura::Window* request_active, |
| 174 aura::Window* actual_active) { |
| 175 FOR_EACH_OBSERVER( |
| 176 WmActivationObserver, activation_observers_, |
| 177 OnAttemptToReactivateWindow(WmWindowAura::Get(request_active), |
| 178 WmWindowAura::Get(actual_active))); |
| 179 } |
| 180 |
| 169 void WmGlobalsAura::OnDisplayConfigurationChanging() { | 181 void WmGlobalsAura::OnDisplayConfigurationChanging() { |
| 170 FOR_EACH_OBSERVER(WmDisplayObserver, display_observers_, | 182 FOR_EACH_OBSERVER(WmDisplayObserver, display_observers_, |
| 171 OnDisplayConfigurationChanging()); | 183 OnDisplayConfigurationChanging()); |
| 172 } | 184 } |
| 173 | 185 |
| 174 void WmGlobalsAura::OnDisplayConfigurationChanged() { | 186 void WmGlobalsAura::OnDisplayConfigurationChanged() { |
| 175 FOR_EACH_OBSERVER(WmDisplayObserver, display_observers_, | 187 FOR_EACH_OBSERVER(WmDisplayObserver, display_observers_, |
| 176 OnDisplayConfigurationChanged()); | 188 OnDisplayConfigurationChanged()); |
| 177 } | 189 } |
| 178 | 190 |
| 179 void WmGlobalsAura::OnOverviewModeEnded() { | 191 void WmGlobalsAura::OnOverviewModeEnded() { |
| 180 FOR_EACH_OBSERVER(WmOverviewModeObserver, overview_mode_observers_, | 192 FOR_EACH_OBSERVER(WmOverviewModeObserver, overview_mode_observers_, |
| 181 OnOverviewModeEnded()); | 193 OnOverviewModeEnded()); |
| 182 } | 194 } |
| 183 | 195 |
| 184 } // namespace wm | 196 } // namespace wm |
| 185 } // namespace ash | 197 } // namespace ash |
| OLD | NEW |