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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 // |window_|. The existing stacking order is preserved by iterating backwards | 130 // |window_|. The existing stacking order is preserved by iterating backwards |
| 131 // and always stacking on top. | 131 // and always stacking on top. |
| 132 Window::Windows children(parent->children()); | 132 Window::Windows children(parent->children()); |
| 133 for (Window::Windows::reverse_iterator it = children.rbegin(); | 133 for (Window::Windows::reverse_iterator it = children.rbegin(); |
| 134 it != children.rend(); ++it) { | 134 it != children.rend(); ++it) { |
| 135 if ((*it) != window_ && HasTransientAncestor(*it, window_)) { | 135 if ((*it) != window_ && HasTransientAncestor(*it, window_)) { |
| 136 TransientWindowManager* descendant_manager = Get(*it); | 136 TransientWindowManager* descendant_manager = Get(*it); |
| 137 base::AutoReset<Window*> resetter( | 137 base::AutoReset<Window*> resetter( |
| 138 &descendant_manager->stacking_target_, | 138 &descendant_manager->stacking_target_, |
| 139 window_); | 139 window_); |
| 140 for (aura::client::TransientWindowClientObserver& observer : | |
|
msw
2016/11/21 19:56:34
optional nit: auto& here and below?
sky
2016/11/21 21:31:43
I like not using auto here as the observers are di
| |
| 141 TransientWindowController::Get()->observers_) { | |
| 142 observer.OnWillRestackTransientChildAbove(window_, *it); | |
| 143 } | |
| 140 parent->StackChildAbove((*it), window_); | 144 parent->StackChildAbove((*it), window_); |
| 145 for (aura::client::TransientWindowClientObserver& observer : | |
| 146 TransientWindowController::Get()->observers_) { | |
| 147 observer.OnDidRestackTransientChildAbove(window_, *it); | |
| 148 } | |
| 141 } | 149 } |
| 142 } | 150 } |
| 143 } | 151 } |
| 144 | 152 |
| 145 void TransientWindowManager::OnWindowParentChanged(aura::Window* window, | 153 void TransientWindowManager::OnWindowParentChanged(aura::Window* window, |
| 146 aura::Window* parent) { | 154 aura::Window* parent) { |
| 147 DCHECK_EQ(window_, window); | 155 DCHECK_EQ(window_, window); |
| 148 // Stack |window| properly if it is transient child of a sibling. | 156 // Stack |window| properly if it is transient child of a sibling. |
| 149 Window* transient_parent = wm::GetTransientParent(window); | 157 Window* transient_parent = wm::GetTransientParent(window); |
| 150 if (transient_parent && transient_parent->parent() == parent) { | 158 if (transient_parent && transient_parent->parent() == parent) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 229 // Destroy transient children, only after we've removed ourselves from our | 237 // Destroy transient children, only after we've removed ourselves from our |
| 230 // parent, as destroying an active transient child may otherwise attempt to | 238 // parent, as destroying an active transient child may otherwise attempt to |
| 231 // refocus us. | 239 // refocus us. |
| 232 Windows transient_children(transient_children_); | 240 Windows transient_children(transient_children_); |
| 233 for (auto* child : transient_children) | 241 for (auto* child : transient_children) |
| 234 delete child; | 242 delete child; |
| 235 DCHECK(transient_children_.empty()); | 243 DCHECK(transient_children_.empty()); |
| 236 } | 244 } |
| 237 | 245 |
| 238 } // namespace wm | 246 } // namespace wm |
| OLD | NEW |