| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } | 91 } |
| 92 | 92 |
| 93 std::vector<WmWindow*> WmGlobalsAura::GetAllRootWindows() { | 93 std::vector<WmWindow*> WmGlobalsAura::GetAllRootWindows() { |
| 94 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 94 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 95 std::vector<WmWindow*> wm_windows(root_windows.size()); | 95 std::vector<WmWindow*> wm_windows(root_windows.size()); |
| 96 for (size_t i = 0; i < root_windows.size(); ++i) | 96 for (size_t i = 0; i < root_windows.size(); ++i) |
| 97 wm_windows[i] = WmWindowAura::Get(root_windows[i]); | 97 wm_windows[i] = WmWindowAura::Get(root_windows[i]); |
| 98 return wm_windows; | 98 return wm_windows; |
| 99 } | 99 } |
| 100 | 100 |
| 101 UserMetricsRecorder* WmGlobalsAura::GetUserMetricsRecorder() { |
| 102 return Shell::GetInstance()->metrics(); |
| 103 } |
| 104 |
| 101 void WmGlobalsAura::AddActivationObserver(WmActivationObserver* observer) { | 105 void WmGlobalsAura::AddActivationObserver(WmActivationObserver* observer) { |
| 102 if (!added_activation_observer_) { | 106 if (!added_activation_observer_) { |
| 103 added_activation_observer_ = true; | 107 added_activation_observer_ = true; |
| 104 aura::client::GetActivationClient(Shell::GetPrimaryRootWindow()) | 108 aura::client::GetActivationClient(Shell::GetPrimaryRootWindow()) |
| 105 ->AddObserver(this); | 109 ->AddObserver(this); |
| 106 } | 110 } |
| 107 activation_observers_.AddObserver(observer); | 111 activation_observers_.AddObserver(observer); |
| 108 } | 112 } |
| 109 | 113 |
| 110 void WmGlobalsAura::RemoveActivationObserver(WmActivationObserver* observer) { | 114 void WmGlobalsAura::RemoveActivationObserver(WmActivationObserver* observer) { |
| 111 activation_observers_.RemoveObserver(observer); | 115 activation_observers_.RemoveObserver(observer); |
| 112 } | 116 } |
| 113 | 117 |
| 114 void WmGlobalsAura::OnWindowActivated( | 118 void WmGlobalsAura::OnWindowActivated( |
| 115 aura::client::ActivationChangeObserver::ActivationReason reason, | 119 aura::client::ActivationChangeObserver::ActivationReason reason, |
| 116 aura::Window* gained_active, | 120 aura::Window* gained_active, |
| 117 aura::Window* lost_active) { | 121 aura::Window* lost_active) { |
| 118 FOR_EACH_OBSERVER(WmActivationObserver, activation_observers_, | 122 FOR_EACH_OBSERVER(WmActivationObserver, activation_observers_, |
| 119 OnWindowActivated(WmWindowAura::Get(gained_active), | 123 OnWindowActivated(WmWindowAura::Get(gained_active), |
| 120 WmWindowAura::Get(lost_active))); | 124 WmWindowAura::Get(lost_active))); |
| 121 } | 125 } |
| 122 | 126 |
| 123 } // namespace wm | 127 } // namespace wm |
| 124 } // namespace ash | 128 } // namespace ash |
| OLD | NEW |