Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Side by Side Diff: ash/wm/aura/wm_globals_aura.cc

Issue 1929023002: Refactors WindowResizers to use ash/wm/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "ash/wm/aura/wm_window_aura.h" 11 #include "ash/wm/aura/wm_window_aura.h"
12 #include "ash/wm/common/wm_activation_observer.h" 12 #include "ash/wm/common/wm_activation_observer.h"
13 #include "ash/wm/common/wm_display_observer.h" 13 #include "ash/wm/common/wm_display_observer.h"
14 #include "ash/wm/common/wm_overview_mode_observer.h" 14 #include "ash/wm/common/wm_overview_mode_observer.h"
15 #include "ash/wm/drag_window_resizer.h"
15 #include "ash/wm/mru_window_tracker.h" 16 #include "ash/wm/mru_window_tracker.h"
17 #include "ash/wm/overview/window_selector_controller.h"
16 #include "ash/wm/window_util.h" 18 #include "ash/wm/window_util.h"
19 #include "base/memory/ptr_util.h"
17 #include "ui/aura/client/focus_client.h" 20 #include "ui/aura/client/focus_client.h"
18 #include "ui/wm/public/activation_client.h" 21 #include "ui/wm/public/activation_client.h"
19 22
20 namespace ash { 23 namespace ash {
21 namespace wm { 24 namespace wm {
22 namespace { 25 namespace {
23 26
24 WmGlobalsAura* instance_ = nullptr; 27 WmGlobalsAura* instance_ = nullptr;
25 28
26 } // namespace 29 } // namespace
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 105 }
103 106
104 std::vector<WmWindow*> WmGlobalsAura::GetAllRootWindows() { 107 std::vector<WmWindow*> WmGlobalsAura::GetAllRootWindows() {
105 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 108 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
106 std::vector<WmWindow*> wm_windows(root_windows.size()); 109 std::vector<WmWindow*> wm_windows(root_windows.size());
107 for (size_t i = 0; i < root_windows.size(); ++i) 110 for (size_t i = 0; i < root_windows.size(); ++i)
108 wm_windows[i] = WmWindowAura::Get(root_windows[i]); 111 wm_windows[i] = WmWindowAura::Get(root_windows[i]);
109 return wm_windows; 112 return wm_windows;
110 } 113 }
111 114
112 UserMetricsRecorder* WmGlobalsAura::GetUserMetricsRecorder() { 115 void WmGlobalsAura::RecordUserMetricsAction(WmUserMetricsAction action) {
113 return Shell::GetInstance()->metrics(); 116 return Shell::GetInstance()->metrics()->RecordUserMetricsAction(action);
117 }
118
119 std::unique_ptr<WindowResizer> WmGlobalsAura::CreateDragWindowResizer(
120 std::unique_ptr<WindowResizer> next_window_resizer,
121 wm::WindowState* window_state) {
122 return base::WrapUnique(
123 DragWindowResizer::Create(next_window_resizer.release(), window_state));
124 }
125
126 bool WmGlobalsAura::IsOverviewModeSelecting() {
127 WindowSelectorController* window_selector_controller =
128 Shell::GetInstance()->window_selector_controller();
129 return window_selector_controller &&
130 window_selector_controller->IsSelecting();
131 }
132
133 bool WmGlobalsAura::IsOverviewModeRestoringMinimizedWindows() {
134 WindowSelectorController* window_selector_controller =
135 Shell::GetInstance()->window_selector_controller();
136 return window_selector_controller &&
137 window_selector_controller->IsRestoringMinimizedWindows();
114 } 138 }
115 139
116 void WmGlobalsAura::AddActivationObserver(WmActivationObserver* observer) { 140 void WmGlobalsAura::AddActivationObserver(WmActivationObserver* observer) {
117 if (!added_activation_observer_) { 141 if (!added_activation_observer_) {
118 added_activation_observer_ = true; 142 added_activation_observer_ = true;
119 aura::client::GetActivationClient(Shell::GetPrimaryRootWindow()) 143 aura::client::GetActivationClient(Shell::GetPrimaryRootWindow())
120 ->AddObserver(this); 144 ->AddObserver(this);
121 } 145 }
122 activation_observers_.AddObserver(observer); 146 activation_observers_.AddObserver(observer);
123 } 147 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 OnDisplayConfigurationChanged()); 185 OnDisplayConfigurationChanged());
162 } 186 }
163 187
164 void WmGlobalsAura::OnOverviewModeEnded() { 188 void WmGlobalsAura::OnOverviewModeEnded() {
165 FOR_EACH_OBSERVER(WmOverviewModeObserver, overview_mode_observers_, 189 FOR_EACH_OBSERVER(WmOverviewModeObserver, overview_mode_observers_,
166 OnOverviewModeEnded()); 190 OnOverviewModeEnded());
167 } 191 }
168 192
169 } // namespace wm 193 } // namespace wm
170 } // namespace ash 194 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698