Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 } | 155 } |
| 156 } | 156 } |
| 157 | 157 |
| 158 void TransientWindowManager::OnWindowVisibilityChanged(Window* window, | 158 void TransientWindowManager::OnWindowVisibilityChanged(Window* window, |
| 159 bool visible) { | 159 bool 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 Windows transient_children = transient_children_; |
| 166 Get(child)->UpdateTransientChildVisibility(visible); | 166 for (Window* child : transient_children) { |
| 167 // Child window can be removed inside UpdateTransientChildVisibility call. | |
|
sky
2015/11/20 15:56:57
Your description says some of the children can be
oshima
2015/11/20 18:39:18
Sorry if I'm missing something, but the window lif
sky
2015/11/20 18:53:44
The copy of the windows (transient_children) is re
oshima
2015/11/20 19:07:26
If a new window is created at the same address, it
| |
| 168 if (std::find(transient_children_.begin(), transient_children_.end(), | |
| 169 child) != transient_children_.end()) { | |
| 170 Get(child)->UpdateTransientChildVisibility(visible); | |
| 171 } | |
|
sadrul
2015/11/21 08:42:43
Maybe this could use a WindowTracker? e.g.
Wind
| |
| 172 } | |
| 167 | 173 |
| 168 // Remember the show request in |show_on_parent_visible_| and hide it again | 174 // Remember the show request in |show_on_parent_visible_| and hide it again |
| 169 // if the following conditions are met | 175 // if the following conditions are met |
| 170 // - |parent_controls_visibility| is set to true. | 176 // - |parent_controls_visibility| is set to true. |
| 171 // - the window is hidden while the transient parent is not visible. | 177 // - the window is hidden while the transient parent is not visible. |
| 172 // - Show/Hide was NOT called from TransientWindowManager. | 178 // - Show/Hide was NOT called from TransientWindowManager. |
| 173 if (ignore_visibility_changed_event_ || | 179 if (ignore_visibility_changed_event_ || |
| 174 !transient_parent_ || !parent_controls_visibility_) { | 180 !transient_parent_ || !parent_controls_visibility_) { |
| 175 return; | 181 return; |
| 176 } | 182 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 | 219 |
| 214 // Destroy transient children, only after we've removed ourselves from our | 220 // Destroy transient children, only after we've removed ourselves from our |
| 215 // parent, as destroying an active transient child may otherwise attempt to | 221 // parent, as destroying an active transient child may otherwise attempt to |
| 216 // refocus us. | 222 // refocus us. |
| 217 Windows transient_children(transient_children_); | 223 Windows transient_children(transient_children_); |
| 218 STLDeleteElements(&transient_children); | 224 STLDeleteElements(&transient_children); |
| 219 DCHECK(transient_children_.empty()); | 225 DCHECK(transient_children_.empty()); |
| 220 } | 226 } |
| 221 | 227 |
| 222 } // namespace wm | 228 } // namespace wm |
| OLD | NEW |