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

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

Issue 944763002: Make Page Visibility API work when the browser window is visible or not Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 show_on_parent_visible_ = window_->TargetVisibility(); 149 show_on_parent_visible_ = window_->TargetVisibility();
150 window_->Hide(); 150 window_->Hide();
151 } else { 151 } else {
152 if (show_on_parent_visible_ && parent_controls_visibility_) 152 if (show_on_parent_visible_ && parent_controls_visibility_)
153 window_->Show(); 153 window_->Show();
154 show_on_parent_visible_ = false; 154 show_on_parent_visible_ = false;
155 } 155 }
156 } 156 }
157 157
158 void TransientWindowManager::OnWindowVisibilityChanged(Window* window, 158 void TransientWindowManager::OnWindowVisibilityChanged(Window* window,
159 bool visible) { 159 bool visible, bool content_visible) {
160 if (window_ != window) 160 if (window_ != window)
161 return; 161 return;
162 162
163 // If the window has transient children, updates the transient children's 163 // If the window has transient children, updates the transient children's
164 // visiblity as well. 164 // visiblity as well.
165 for (Window* child : transient_children_) 165 for (Window* child : transient_children_)
166 Get(child)->UpdateTransientChildVisibility(visible); 166 Get(child)->UpdateTransientChildVisibility(visible);
167 167
168 // Remember the show request in |show_on_parent_visible_| and hide it again 168 // Remember the show request in |show_on_parent_visible_| and hide it again
169 // if the following conditions are met 169 // if the following conditions are met
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 213
214 // Destroy transient children, only after we've removed ourselves from our 214 // Destroy transient children, only after we've removed ourselves from our
215 // parent, as destroying an active transient child may otherwise attempt to 215 // parent, as destroying an active transient child may otherwise attempt to
216 // refocus us. 216 // refocus us.
217 Windows transient_children(transient_children_); 217 Windows transient_children(transient_children_);
218 STLDeleteElements(&transient_children); 218 STLDeleteElements(&transient_children);
219 DCHECK(transient_children_.empty()); 219 DCHECK(transient_children_.empty());
220 } 220 }
221 221
222 } // namespace wm 222 } // namespace wm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698