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

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

Issue 2416963006: Remove usage of FOR_EACH_OBSERVER macro in ui/wm/. (Closed)
Patch Set: Created 4 years, 2 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 | « ui/wm/core/focus_controller.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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 DCHECK(std::find(transient_children_.begin(), transient_children_.end(), 65 DCHECK(std::find(transient_children_.begin(), transient_children_.end(),
66 child) == transient_children_.end()); 66 child) == transient_children_.end());
67 transient_children_.push_back(child); 67 transient_children_.push_back(child);
68 child_manager->transient_parent_ = window_; 68 child_manager->transient_parent_ = window_;
69 69
70 // Restack |child| properly above its transient parent, if they share the same 70 // Restack |child| properly above its transient parent, if they share the same
71 // parent. 71 // parent.
72 if (child->parent() == window_->parent()) 72 if (child->parent() == window_->parent())
73 RestackTransientDescendants(); 73 RestackTransientDescendants();
74 74
75 FOR_EACH_OBSERVER(TransientWindowObserver, observers_, 75 for (auto& observer : observers_)
76 OnTransientChildAdded(window_, child)); 76 observer.OnTransientChildAdded(window_, child);
77 } 77 }
78 78
79 void TransientWindowManager::RemoveTransientChild(Window* child) { 79 void TransientWindowManager::RemoveTransientChild(Window* child) {
80 Windows::iterator i = 80 Windows::iterator i =
81 std::find(transient_children_.begin(), transient_children_.end(), child); 81 std::find(transient_children_.begin(), transient_children_.end(), child);
82 DCHECK(i != transient_children_.end()); 82 DCHECK(i != transient_children_.end());
83 transient_children_.erase(i); 83 transient_children_.erase(i);
84 TransientWindowManager* child_manager = Get(child); 84 TransientWindowManager* child_manager = Get(child);
85 DCHECK_EQ(window_, child_manager->transient_parent_); 85 DCHECK_EQ(window_, child_manager->transient_parent_);
86 child_manager->transient_parent_ = NULL; 86 child_manager->transient_parent_ = NULL;
87 87
88 // If |child| and its former transient parent share the same parent, |child| 88 // If |child| and its former transient parent share the same parent, |child|
89 // should be restacked properly so it is not among transient children of its 89 // should be restacked properly so it is not among transient children of its
90 // former parent, anymore. 90 // former parent, anymore.
91 if (window_->parent() == child->parent()) 91 if (window_->parent() == child->parent())
92 RestackTransientDescendants(); 92 RestackTransientDescendants();
93 93
94 FOR_EACH_OBSERVER(TransientWindowObserver, observers_, 94 for (auto& observer : observers_)
95 OnTransientChildRemoved(window_, child)); 95 observer.OnTransientChildRemoved(window_, child);
96 } 96 }
97 97
98 bool TransientWindowManager::IsStackingTransient( 98 bool TransientWindowManager::IsStackingTransient(
99 const aura::Window* target) const { 99 const aura::Window* target) const {
100 return stacking_target_ == target; 100 return stacking_target_ == target;
101 } 101 }
102 102
103 TransientWindowManager::TransientWindowManager(Window* window) 103 TransientWindowManager::TransientWindowManager(Window* window)
104 : window_(window), 104 : window_(window),
105 transient_parent_(NULL), 105 transient_parent_(NULL),
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 217
218 // Destroy transient children, only after we've removed ourselves from our 218 // Destroy transient children, only after we've removed ourselves from our
219 // parent, as destroying an active transient child may otherwise attempt to 219 // parent, as destroying an active transient child may otherwise attempt to
220 // refocus us. 220 // refocus us.
221 Windows transient_children(transient_children_); 221 Windows transient_children(transient_children_);
222 base::STLDeleteElements(&transient_children); 222 base::STLDeleteElements(&transient_children);
223 DCHECK(transient_children_.empty()); 223 DCHECK(transient_children_.empty());
224 } 224 }
225 225
226 } // namespace wm 226 } // namespace wm
OLDNEW
« no previous file with comments | « ui/wm/core/focus_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698