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

Side by Side Diff: ash/wm/screen_pinning_controller.cc

Issue 2904073002: [mus+ash] Removes WmWindow from ash/wm/screen_pinning_controller.h (Closed)
Patch Set: [mus+ash] Removes WmWindow from ash/wm/screen_pinning_controller.h (removes unneeded header) Created 3 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
« no previous file with comments | « ash/wm/screen_pinning_controller.h ('k') | ash/wm/workspace/workspace_layout_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/screen_pinning_controller.h" 5 #include "ash/wm/screen_pinning_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/public/cpp/shell_window_ids.h" 10 #include "ash/public/cpp/shell_window_ids.h"
11 #include "ash/shell.h" 11 #include "ash/shell.h"
12 #include "ash/shell_port.h" 12 #include "ash/shell_port.h"
13 #include "ash/window_user_data.h" 13 #include "ash/window_user_data.h"
14 #include "ash/wm/container_finder.h" 14 #include "ash/wm/container_finder.h"
15 #include "ash/wm/window_dimmer.h" 15 #include "ash/wm/window_dimmer.h"
16 #include "ash/wm/window_state.h" 16 #include "ash/wm/window_state.h"
17 #include "ash/wm_window.h" 17 #include "ash/wm_window.h"
18 #include "base/auto_reset.h" 18 #include "base/auto_reset.h"
19 #include "base/logging.h" 19 #include "base/logging.h"
20 #include "base/memory/ptr_util.h" 20 #include "base/memory/ptr_util.h"
21 #include "ui/aura/window.h" 21 #include "ui/aura/window.h"
22 #include "ui/aura/window_observer.h" 22 #include "ui/aura/window_observer.h"
23 #include "ui/wm/core/window_util.h" 23 #include "ui/wm/core/window_util.h"
24 24
25 namespace ash { 25 namespace ash {
26 namespace { 26 namespace {
27 27
28 // Returns a list of WmWindows corresponding to SystemModalContainers, 28 // Returns a list of Windows corresponding to SystemModalContainers,
29 // except ones whose root is shared with |pinned_window|. 29 // except ones whose root is shared with |pinned_window|.
30 std::vector<WmWindow*> GetSystemModalWindowsExceptPinned( 30 aura::Window::Windows GetSystemModalWindowsExceptPinned(
31 WmWindow* pinned_window) { 31 aura::Window* pinned_window) {
32 WmWindow* pinned_root = pinned_window->GetRootWindow(); 32 aura::Window* pinned_root = pinned_window->GetRootWindow();
33 33
34 std::vector<WmWindow*> result; 34 aura::Window::Windows result;
35 for (aura::Window* system_modal : wm::GetContainersFromAllRootWindows( 35 for (aura::Window* system_modal : wm::GetContainersFromAllRootWindows(
36 kShellWindowId_SystemModalContainer)) { 36 kShellWindowId_SystemModalContainer)) {
37 if (WmWindow::Get(system_modal)->GetRootWindow() == pinned_root) 37 if (system_modal->GetRootWindow() == pinned_root)
38 continue; 38 continue;
39 result.push_back(WmWindow::Get(system_modal)); 39 result.push_back(system_modal);
40 } 40 }
41 return result; 41 return result;
42 } 42 }
43 43
44 void AddObserverToChildren(WmWindow* container, 44 void AddObserverToChildren(aura::Window* container,
45 aura::WindowObserver* observer) { 45 aura::WindowObserver* observer) {
46 for (WmWindow* child : container->GetChildren()) { 46 for (aura::Window* child : container->children())
47 WmWindow::GetAuraWindow(child)->AddObserver(observer); 47 child->AddObserver(observer);
48 }
49 } 48 }
50 49
51 void RemoveObserverFromChildren(WmWindow* container, 50 void RemoveObserverFromChildren(aura::Window* container,
52 aura::WindowObserver* observer) { 51 aura::WindowObserver* observer) {
53 for (WmWindow* child : container->GetChildren()) { 52 for (aura::Window* child : container->children())
54 WmWindow::GetAuraWindow(child)->RemoveObserver(observer); 53 child->RemoveObserver(observer);
55 }
56 } 54 }
57 55
58 // Returns true if the aura::Window from a WindowDimmer is visible. 56 // Returns true if the aura::Window from a WindowDimmer is visible.
59 bool IsWindowDimmerWindowVisible(WindowDimmer* window_dimmer) { 57 bool IsWindowDimmerWindowVisible(WindowDimmer* window_dimmer) {
60 return window_dimmer->window()->layer()->GetTargetVisibility(); 58 return window_dimmer->window()->layer()->GetTargetVisibility();
61 } 59 }
62 60
63 } // namespace 61 } // namespace
64 62
65 // Adapter to fire OnPinnedContainerWindowStackingChanged(). 63 // Adapter to fire OnPinnedContainerWindowStackingChanged().
66 class ScreenPinningController::PinnedContainerChildWindowObserver 64 class ScreenPinningController::PinnedContainerChildWindowObserver
67 : public aura::WindowObserver { 65 : public aura::WindowObserver {
68 public: 66 public:
69 explicit PinnedContainerChildWindowObserver( 67 explicit PinnedContainerChildWindowObserver(
70 ScreenPinningController* controller) 68 ScreenPinningController* controller)
71 : controller_(controller) {} 69 : controller_(controller) {}
72 70
73 void OnWindowStackingChanged(aura::Window* window) override { 71 void OnWindowStackingChanged(aura::Window* window) override {
74 controller_->OnPinnedContainerWindowStackingChanged(WmWindow::Get(window)); 72 controller_->OnPinnedContainerWindowStackingChanged(window);
75 } 73 }
76 74
77 private: 75 private:
78 ScreenPinningController* controller_; 76 ScreenPinningController* controller_;
79 DISALLOW_COPY_AND_ASSIGN(PinnedContainerChildWindowObserver); 77 DISALLOW_COPY_AND_ASSIGN(PinnedContainerChildWindowObserver);
80 }; 78 };
81 79
82 // Adapter to translate OnWindowAdded/OnWillRemoveWindow for the container 80 // Adapter to translate OnWindowAdded/OnWillRemoveWindow for the container
83 // containing the pinned window, to the corresponding controller's methods. 81 // containing the pinned window, to the corresponding controller's methods.
84 class ScreenPinningController::PinnedContainerWindowObserver 82 class ScreenPinningController::PinnedContainerWindowObserver
85 : public aura::WindowObserver { 83 : public aura::WindowObserver {
86 public: 84 public:
87 explicit PinnedContainerWindowObserver(ScreenPinningController* controller) 85 explicit PinnedContainerWindowObserver(ScreenPinningController* controller)
88 : controller_(controller) {} 86 : controller_(controller) {}
89 87
90 void OnWindowAdded(aura::Window* new_window) override { 88 void OnWindowAdded(aura::Window* new_window) override {
91 controller_->OnWindowAddedToPinnedContainer(WmWindow::Get(new_window)); 89 controller_->OnWindowAddedToPinnedContainer(new_window);
92 } 90 }
93 void OnWillRemoveWindow(aura::Window* window) override { 91 void OnWillRemoveWindow(aura::Window* window) override {
94 controller_->OnWillRemoveWindowFromPinnedContainer(WmWindow::Get(window)); 92 controller_->OnWillRemoveWindowFromPinnedContainer(window);
95 } 93 }
96 void OnWindowDestroying(aura::Window* window) override { 94 void OnWindowDestroying(aura::Window* window) override {
97 // Just in case. There is nothing we can do here. 95 // Just in case. There is nothing we can do here.
98 window->RemoveObserver(this); 96 window->RemoveObserver(this);
99 } 97 }
100 98
101 private: 99 private:
102 ScreenPinningController* controller_; 100 ScreenPinningController* controller_;
103 DISALLOW_COPY_AND_ASSIGN(PinnedContainerWindowObserver); 101 DISALLOW_COPY_AND_ASSIGN(PinnedContainerWindowObserver);
104 }; 102 };
105 103
106 // Adapter to fire OnSystemModalContainerWindowStackingChanged(). 104 // Adapter to fire OnSystemModalContainerWindowStackingChanged().
107 class ScreenPinningController::SystemModalContainerChildWindowObserver 105 class ScreenPinningController::SystemModalContainerChildWindowObserver
108 : public aura::WindowObserver { 106 : public aura::WindowObserver {
109 public: 107 public:
110 explicit SystemModalContainerChildWindowObserver( 108 explicit SystemModalContainerChildWindowObserver(
111 ScreenPinningController* controller) 109 ScreenPinningController* controller)
112 : controller_(controller) {} 110 : controller_(controller) {}
113 111
114 void OnWindowStackingChanged(aura::Window* window) override { 112 void OnWindowStackingChanged(aura::Window* window) override {
115 controller_->OnSystemModalContainerWindowStackingChanged( 113 controller_->OnSystemModalContainerWindowStackingChanged(window);
116 WmWindow::Get(window));
117 } 114 }
118 115
119 private: 116 private:
120 ScreenPinningController* controller_; 117 ScreenPinningController* controller_;
121 DISALLOW_COPY_AND_ASSIGN(SystemModalContainerChildWindowObserver); 118 DISALLOW_COPY_AND_ASSIGN(SystemModalContainerChildWindowObserver);
122 }; 119 };
123 120
124 // Adapter to translate OnWindowAdded/OnWillRemoveWindow for the 121 // Adapter to translate OnWindowAdded/OnWillRemoveWindow for the
125 // SystemModalContainer to the corresponding controller's methods. 122 // SystemModalContainer to the corresponding controller's methods.
126 class ScreenPinningController::SystemModalContainerWindowObserver 123 class ScreenPinningController::SystemModalContainerWindowObserver
127 : public aura::WindowObserver { 124 : public aura::WindowObserver {
128 public: 125 public:
129 explicit SystemModalContainerWindowObserver( 126 explicit SystemModalContainerWindowObserver(
130 ScreenPinningController* controller) 127 ScreenPinningController* controller)
131 : controller_(controller) {} 128 : controller_(controller) {}
132 129
133 void OnWindowAdded(aura::Window* new_window) override { 130 void OnWindowAdded(aura::Window* new_window) override {
134 controller_->OnWindowAddedToSystemModalContainer(WmWindow::Get(new_window)); 131 controller_->OnWindowAddedToSystemModalContainer(new_window);
135 } 132 }
136 void OnWillRemoveWindow(aura::Window* window) override { 133 void OnWillRemoveWindow(aura::Window* window) override {
137 controller_->OnWillRemoveWindowFromSystemModalContainer( 134 controller_->OnWillRemoveWindowFromSystemModalContainer(window);
138 WmWindow::Get(window));
139 } 135 }
140 void OnWindowDestroying(aura::Window* window) override { 136 void OnWindowDestroying(aura::Window* window) override {
141 // Just in case. There is nothing we can do here. 137 // Just in case. There is nothing we can do here.
142 window->RemoveObserver(this); 138 window->RemoveObserver(this);
143 } 139 }
144 140
145 private: 141 private:
146 ScreenPinningController* controller_; 142 ScreenPinningController* controller_;
147 DISALLOW_COPY_AND_ASSIGN(SystemModalContainerWindowObserver); 143 DISALLOW_COPY_AND_ASSIGN(SystemModalContainerWindowObserver);
148 }; 144 };
(...skipping 12 matching lines...) Expand all
161 } 157 }
162 158
163 ScreenPinningController::~ScreenPinningController() { 159 ScreenPinningController::~ScreenPinningController() {
164 ShellPort::Get()->RemoveDisplayObserver(this); 160 ShellPort::Get()->RemoveDisplayObserver(this);
165 } 161 }
166 162
167 bool ScreenPinningController::IsPinned() const { 163 bool ScreenPinningController::IsPinned() const {
168 return pinned_window_ != nullptr; 164 return pinned_window_ != nullptr;
169 } 165 }
170 166
171 void ScreenPinningController::SetPinnedWindow(WmWindow* pinned_window) { 167 void ScreenPinningController::SetPinnedWindow(aura::Window* pinned_window) {
172 if (pinned_window->GetWindowState()->IsPinned()) { 168 if (wm::GetWindowState(pinned_window)->IsPinned()) {
173 if (pinned_window_) { 169 if (pinned_window_) {
174 LOG(DFATAL) << "Pinned mode is enabled, while it is already in " 170 LOG(DFATAL) << "Pinned mode is enabled, while it is already in "
175 << "the pinned mode"; 171 << "the pinned mode";
176 return; 172 return;
177 } 173 }
178 174
179 WmWindow* container = pinned_window->GetParent(); 175 aura::Window* container = pinned_window->parent();
180 std::vector<WmWindow*> system_modal_containers = 176 aura::Window::Windows system_modal_containers =
181 GetSystemModalWindowsExceptPinned(pinned_window); 177 GetSystemModalWindowsExceptPinned(pinned_window);
182 178
183 // Set up the container which has the pinned window. 179 // Set up the container which has the pinned window.
184 pinned_window_ = pinned_window; 180 pinned_window_ = pinned_window;
185 container->StackChildAtTop(pinned_window); 181 container->StackChildAtTop(pinned_window);
186 container->StackChildBelow(CreateWindowDimmer(container), pinned_window); 182 container->StackChildBelow(CreateWindowDimmer(container), pinned_window);
187 183
188 // Set the dim windows to the system containers, other than the one which 184 // Set the dim windows to the system containers, other than the one which
189 // the root window of the pinned window holds. 185 // the root window of the pinned window holds.
190 for (WmWindow* system_modal : system_modal_containers) 186 for (aura::Window* system_modal : system_modal_containers)
191 system_modal->StackChildAtBottom(CreateWindowDimmer(system_modal)); 187 system_modal->StackChildAtBottom(CreateWindowDimmer(system_modal));
192 188
193 // Set observers. 189 // Set observers.
194 WmWindow::GetAuraWindow(container)->AddObserver( 190 container->AddObserver(pinned_container_window_observer_.get());
195 pinned_container_window_observer_.get());
196 AddObserverToChildren(container, 191 AddObserverToChildren(container,
197 pinned_container_child_window_observer_.get()); 192 pinned_container_child_window_observer_.get());
198 for (WmWindow* system_modal : system_modal_containers) { 193 for (aura::Window* system_modal : system_modal_containers) {
199 WmWindow::GetAuraWindow(system_modal) 194 system_modal->AddObserver(system_modal_container_window_observer_.get());
200 ->AddObserver(system_modal_container_window_observer_.get());
201 AddObserverToChildren( 195 AddObserverToChildren(
202 system_modal, system_modal_container_child_window_observer_.get()); 196 system_modal, system_modal_container_child_window_observer_.get());
203 } 197 }
204 } else { 198 } else {
205 if (pinned_window != pinned_window_) { 199 if (pinned_window != pinned_window_) {
206 LOG(DFATAL) << "Pinned mode is being disabled, but for the different " 200 LOG(DFATAL) << "Pinned mode is being disabled, but for the different "
207 << "target window."; 201 << "target window.";
208 return; 202 return;
209 } 203 }
210 204
211 WmWindow* container = pinned_window->GetParent(); 205 aura::Window* container = pinned_window->parent();
212 std::vector<WmWindow*> system_modal_containers = 206 aura::Window::Windows system_modal_containers =
213 GetSystemModalWindowsExceptPinned(pinned_window_); 207 GetSystemModalWindowsExceptPinned(pinned_window_);
214 208
215 // Unset observers. 209 // Unset observers.
216 for (WmWindow* system_modal : 210 for (aura::Window* system_modal :
217 GetSystemModalWindowsExceptPinned(pinned_window_)) { 211 GetSystemModalWindowsExceptPinned(pinned_window_)) {
218 RemoveObserverFromChildren( 212 RemoveObserverFromChildren(
219 system_modal, system_modal_container_child_window_observer_.get()); 213 system_modal, system_modal_container_child_window_observer_.get());
220 WmWindow::GetAuraWindow(system_modal) 214 system_modal->RemoveObserver(
221 ->RemoveObserver(system_modal_container_window_observer_.get()); 215 system_modal_container_window_observer_.get());
222 } 216 }
223 RemoveObserverFromChildren(container, 217 RemoveObserverFromChildren(container,
224 pinned_container_child_window_observer_.get()); 218 pinned_container_child_window_observer_.get());
225 WmWindow::GetAuraWindow(container)->RemoveObserver( 219 container->RemoveObserver(pinned_container_window_observer_.get());
226 pinned_container_window_observer_.get());
227 220
228 window_dimmers_->clear(); 221 window_dimmers_->clear();
229
230 pinned_window_ = nullptr; 222 pinned_window_ = nullptr;
231 } 223 }
232 224
233 Shell::Get()->NotifyPinnedStateChanged(pinned_window); 225 Shell::Get()->NotifyPinnedStateChanged(pinned_window);
234 } 226 }
235 227
236 void ScreenPinningController::OnWindowAddedToPinnedContainer( 228 void ScreenPinningController::OnWindowAddedToPinnedContainer(
237 WmWindow* new_window) { 229 aura::Window* new_window) {
238 KeepPinnedWindowOnTop(); 230 KeepPinnedWindowOnTop();
239 WmWindow::GetAuraWindow(new_window) 231 new_window->AddObserver(pinned_container_child_window_observer_.get());
240 ->AddObserver(pinned_container_child_window_observer_.get());
241 } 232 }
242 233
243 void ScreenPinningController::OnWillRemoveWindowFromPinnedContainer( 234 void ScreenPinningController::OnWillRemoveWindowFromPinnedContainer(
244 WmWindow* window) { 235 aura::Window* window) {
245 WmWindow::GetAuraWindow(window)->RemoveObserver( 236 window->RemoveObserver(pinned_container_child_window_observer_.get());
246 pinned_container_child_window_observer_.get());
247 if (window == pinned_window_) { 237 if (window == pinned_window_) {
248 pinned_window_->GetWindowState()->Restore(); 238 wm::GetWindowState(pinned_window_)->Restore();
249 return; 239 return;
250 } 240 }
251 } 241 }
252 242
253 void ScreenPinningController::OnPinnedContainerWindowStackingChanged( 243 void ScreenPinningController::OnPinnedContainerWindowStackingChanged(
254 WmWindow* window) { 244 aura::Window* window) {
255 KeepPinnedWindowOnTop(); 245 KeepPinnedWindowOnTop();
256 } 246 }
257 247
258 void ScreenPinningController::OnWindowAddedToSystemModalContainer( 248 void ScreenPinningController::OnWindowAddedToSystemModalContainer(
259 WmWindow* new_window) { 249 aura::Window* new_window) {
260 KeepDimWindowAtBottom(new_window->GetParent()->aura_window()); 250 KeepDimWindowAtBottom(new_window->parent());
261 WmWindow::GetAuraWindow(new_window) 251 new_window->AddObserver(system_modal_container_child_window_observer_.get());
262 ->AddObserver(system_modal_container_child_window_observer_.get());
263 } 252 }
264 253
265 void ScreenPinningController::OnWillRemoveWindowFromSystemModalContainer( 254 void ScreenPinningController::OnWillRemoveWindowFromSystemModalContainer(
266 WmWindow* window) { 255 aura::Window* window) {
267 WmWindow::GetAuraWindow(window)->RemoveObserver( 256 window->RemoveObserver(system_modal_container_child_window_observer_.get());
268 system_modal_container_child_window_observer_.get());
269 } 257 }
270 258
271 void ScreenPinningController::OnSystemModalContainerWindowStackingChanged( 259 void ScreenPinningController::OnSystemModalContainerWindowStackingChanged(
272 WmWindow* window) { 260 aura::Window* window) {
273 KeepDimWindowAtBottom(window->GetParent()->aura_window()); 261 KeepDimWindowAtBottom(window->parent());
274 } 262 }
275 263
276 WmWindow* ScreenPinningController::CreateWindowDimmer(WmWindow* container) { 264 aura::Window* ScreenPinningController::CreateWindowDimmer(
265 aura::Window* container) {
277 std::unique_ptr<WindowDimmer> window_dimmer = 266 std::unique_ptr<WindowDimmer> window_dimmer =
278 base::MakeUnique<WindowDimmer>(container->aura_window()); 267 base::MakeUnique<WindowDimmer>(container);
279 window_dimmer->SetDimOpacity(1); // Fully opaque. 268 window_dimmer->SetDimOpacity(1); // Fully opaque.
280 ::wm::SetWindowFullscreen(window_dimmer->window(), true); 269 ::wm::SetWindowFullscreen(window_dimmer->window(), true);
281 window_dimmer->window()->Show(); 270 window_dimmer->window()->Show();
282 WmWindow* window = WmWindow::Get(window_dimmer->window()); 271 aura::Window* window = window_dimmer->window();
283 window_dimmers_->Set(container->aura_window(), std::move(window_dimmer)); 272 window_dimmers_->Set(container, std::move(window_dimmer));
284 return window; 273 return window;
285 } 274 }
286 275
287 void ScreenPinningController::OnDisplayConfigurationChanged() { 276 void ScreenPinningController::OnDisplayConfigurationChanged() {
288 // Note: this is called on display attached or detached. 277 // Note: this is called on display attached or detached.
289 if (!IsPinned()) 278 if (!IsPinned())
290 return; 279 return;
291 280
292 // On display detaching, all necessary windows are transfered to the 281 // On display detaching, all necessary windows are transfered to the
293 // primary display's tree, and called this. 282 // primary display's tree, and called this.
294 // So, delete WindowDimmers which are not a part of target system modal 283 // So, delete WindowDimmers which are not a part of target system modal
295 // container. 284 // container.
296 // On display attaching, the new system modal container does not have the 285 // On display attaching, the new system modal container does not have the
297 // WindowDimmer. So create it. 286 // WindowDimmer. So create it.
298 287
299 // First, delete unnecessary WindowDimmers. 288 // First, delete unnecessary WindowDimmers.
300 for (aura::Window* container : window_dimmers_->GetWindows()) { 289 for (aura::Window* container : window_dimmers_->GetWindows()) {
301 if (container != pinned_window_->GetParent()->aura_window() && 290 if (container != pinned_window_->parent() &&
302 !IsWindowDimmerWindowVisible(window_dimmers_->Get(container))) { 291 !IsWindowDimmerWindowVisible(window_dimmers_->Get(container))) {
303 window_dimmers_->Set(container, nullptr); 292 window_dimmers_->Set(container, nullptr);
304 } 293 }
305 } 294 }
306 295
307 // Then, create missing WindowDimmers. 296 // Then, create missing WindowDimmers.
308 std::vector<WmWindow*> system_modal_containers = 297 aura::Window::Windows system_modal_containers =
309 GetSystemModalWindowsExceptPinned(pinned_window_); 298 GetSystemModalWindowsExceptPinned(pinned_window_);
310 for (WmWindow* system_modal : system_modal_containers) { 299 for (aura::Window* system_modal : system_modal_containers) {
311 if (window_dimmers_->Get(system_modal->aura_window())) { 300 if (window_dimmers_->Get(system_modal)) {
312 // |system_modal| already has a WindowDimmer. 301 // |system_modal| already has a WindowDimmer.
313 continue; 302 continue;
314 } 303 }
315 304
316 // This is the new system modal dialog. 305 // This is the new system modal dialog.
317 system_modal->StackChildAtBottom(CreateWindowDimmer(system_modal)); 306 system_modal->StackChildAtBottom(CreateWindowDimmer(system_modal));
318 307
319 // Set observers to the tree. 308 // Set observers to the tree.
320 WmWindow::GetAuraWindow(system_modal) 309 system_modal->AddObserver(system_modal_container_window_observer_.get());
321 ->AddObserver(system_modal_container_window_observer_.get());
322 AddObserverToChildren(system_modal, 310 AddObserverToChildren(system_modal,
323 system_modal_container_child_window_observer_.get()); 311 system_modal_container_child_window_observer_.get());
324 } 312 }
325 } 313 }
326 314
327 void ScreenPinningController::KeepPinnedWindowOnTop() { 315 void ScreenPinningController::KeepPinnedWindowOnTop() {
328 if (in_restacking_) 316 if (in_restacking_)
329 return; 317 return;
330 318
331 base::AutoReset<bool> auto_reset(&in_restacking_, true); 319 base::AutoReset<bool> auto_reset(&in_restacking_, true);
332 WmWindow* container = pinned_window_->GetParent(); 320 aura::Window* container = pinned_window_->parent();
333 container->StackChildAtTop(pinned_window_); 321 container->StackChildAtTop(pinned_window_);
334 WindowDimmer* pinned_window_dimmer = 322 WindowDimmer* pinned_window_dimmer = window_dimmers_->Get(container);
335 window_dimmers_->Get(container->aura_window()); 323 if (pinned_window_dimmer && pinned_window_dimmer->window())
336 if (pinned_window_dimmer && pinned_window_dimmer->window()) { 324 container->StackChildBelow(pinned_window_dimmer->window(), pinned_window_);
337 container->StackChildBelow(WmWindow::Get(pinned_window_dimmer->window()),
338 pinned_window_);
339 }
340 } 325 }
341 326
342 void ScreenPinningController::KeepDimWindowAtBottom(aura::Window* container) { 327 void ScreenPinningController::KeepDimWindowAtBottom(aura::Window* container) {
343 if (in_restacking_) 328 if (in_restacking_)
344 return; 329 return;
345 330
346 WindowDimmer* window_dimmer = window_dimmers_->Get(container); 331 WindowDimmer* window_dimmer = window_dimmers_->Get(container);
347 if (window_dimmer) { 332 if (window_dimmer) {
348 base::AutoReset<bool> auto_reset(&in_restacking_, true); 333 base::AutoReset<bool> auto_reset(&in_restacking_, true);
349 container->StackChildAtBottom(window_dimmer->window()); 334 container->StackChildAtBottom(window_dimmer->window());
350 } 335 }
351 } 336 }
352 337
353 } // namespace ash 338 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/screen_pinning_controller.h ('k') | ash/wm/workspace/workspace_layout_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698