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

Side by Side Diff: ui/wm/core/transient_window_manager.cc

Issue 1484383003: Use WindowTracker when resizing root window as it may delete other window in unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | « ui/aura/window_tracker.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/wm/core/transient_window_manager.h" 5 #include "ui/wm/core/transient_window_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 158
159 void TransientWindowManager::OnWindowVisibilityChanged(Window* window, 159 void TransientWindowManager::OnWindowVisibilityChanged(Window* window,
160 bool visible) { 160 bool visible) {
161 if (window_ != window) 161 if (window_ != window)
162 return; 162 return;
163 163
164 // If the window has transient children, updates the transient children's 164 // If the window has transient children, updates the transient children's
165 // visiblity as well. 165 // visiblity as well.
166 // WindowTracker is used because child window 166 // WindowTracker is used because child window
167 // could be deleted inside UpdateTransientChildVisibility call. 167 // could be deleted inside UpdateTransientChildVisibility call.
168 aura::WindowTracker tracker; 168 aura::WindowTracker tracker(transient_children_);
169 for (Window* child : transient_children_) 169 while (tracker.has_windows())
170 tracker.Add(child); 170 Get(tracker.Pop())->UpdateTransientChildVisibility(visible);
171
172 while (!tracker.windows().empty()) {
173 Window* window = *(tracker.windows().begin());
174 Get(window)->UpdateTransientChildVisibility(visible);
175 tracker.Remove(window);
176 }
177 171
178 // Remember the show request in |show_on_parent_visible_| and hide it again 172 // Remember the show request in |show_on_parent_visible_| and hide it again
179 // if the following conditions are met 173 // if the following conditions are met
180 // - |parent_controls_visibility| is set to true. 174 // - |parent_controls_visibility| is set to true.
181 // - the window is hidden while the transient parent is not visible. 175 // - the window is hidden while the transient parent is not visible.
182 // - Show/Hide was NOT called from TransientWindowManager. 176 // - Show/Hide was NOT called from TransientWindowManager.
183 if (ignore_visibility_changed_event_ || 177 if (ignore_visibility_changed_event_ ||
184 !transient_parent_ || !parent_controls_visibility_) { 178 !transient_parent_ || !parent_controls_visibility_) {
185 return; 179 return;
186 } 180 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 217
224 // Destroy transient children, only after we've removed ourselves from our 218 // Destroy transient children, only after we've removed ourselves from our
225 // parent, as destroying an active transient child may otherwise attempt to 219 // parent, as destroying an active transient child may otherwise attempt to
226 // refocus us. 220 // refocus us.
227 Windows transient_children(transient_children_); 221 Windows transient_children(transient_children_);
228 STLDeleteElements(&transient_children); 222 STLDeleteElements(&transient_children);
229 DCHECK(transient_children_.empty()); 223 DCHECK(transient_children_.empty());
230 } 224 }
231 225
232 } // namespace wm 226 } // namespace wm
OLDNEW
« no previous file with comments | « ui/aura/window_tracker.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698