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 "view_manager/public/cpp/view.h" | 5 #include "view_manager/cpp/view.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "mojo/public/cpp/application/service_provider_impl.h" | 10 #include "mojo/public/cpp/application/service_provider_impl.h" |
11 #include "view_manager/public/cpp/lib/view_manager_client_impl.h" | 11 #include "view_manager/cpp/lib/view_manager_client_impl.h" |
12 #include "view_manager/public/cpp/lib/view_private.h" | 12 #include "view_manager/cpp/lib/view_private.h" |
13 #include "view_manager/public/cpp/view_observer.h" | 13 #include "view_manager/cpp/view_observer.h" |
14 #include "view_manager/public/cpp/view_tracker.h" | 14 #include "view_manager/cpp/view_tracker.h" |
15 | 15 |
16 namespace mojo { | 16 namespace mojo { |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 void NotifyViewTreeChangeAtReceiver( | 20 void NotifyViewTreeChangeAtReceiver( |
21 View* receiver, | 21 View* receiver, |
22 const ViewObserver::TreeChangeParams& params, | 22 const ViewObserver::TreeChangeParams& params, |
23 bool change_applied) { | 23 bool change_applied) { |
24 ViewObserver::TreeChangeParams local_params = params; | 24 ViewObserver::TreeChangeParams local_params = params; |
25 local_params.receiver = receiver; | 25 local_params.receiver = receiver; |
26 if (change_applied) { | 26 if (change_applied) { |
27 FOR_EACH_OBSERVER(ViewObserver, | 27 FOR_EACH_OBSERVER(ViewObserver, *ViewPrivate(receiver).observers(), |
28 *ViewPrivate(receiver).observers(), | |
29 OnTreeChanged(local_params)); | 28 OnTreeChanged(local_params)); |
30 } else { | 29 } else { |
31 FOR_EACH_OBSERVER(ViewObserver, | 30 FOR_EACH_OBSERVER(ViewObserver, *ViewPrivate(receiver).observers(), |
32 *ViewPrivate(receiver).observers(), | |
33 OnTreeChanging(local_params)); | 31 OnTreeChanging(local_params)); |
34 } | 32 } |
35 } | 33 } |
36 | 34 |
37 void NotifyViewTreeChangeUp( | 35 void NotifyViewTreeChangeUp(View* start_at, |
38 View* start_at, | 36 const ViewObserver::TreeChangeParams& params, |
39 const ViewObserver::TreeChangeParams& params, | 37 bool change_applied) { |
40 bool change_applied) { | |
41 for (View* current = start_at; current; current = current->parent()) | 38 for (View* current = start_at; current; current = current->parent()) |
42 NotifyViewTreeChangeAtReceiver(current, params, change_applied); | 39 NotifyViewTreeChangeAtReceiver(current, params, change_applied); |
43 } | 40 } |
44 | 41 |
45 void NotifyViewTreeChangeDown( | 42 void NotifyViewTreeChangeDown(View* start_at, |
46 View* start_at, | 43 const ViewObserver::TreeChangeParams& params, |
47 const ViewObserver::TreeChangeParams& params, | 44 bool change_applied) { |
48 bool change_applied) { | |
49 NotifyViewTreeChangeAtReceiver(start_at, params, change_applied); | 45 NotifyViewTreeChangeAtReceiver(start_at, params, change_applied); |
50 View::Children::const_iterator it = start_at->children().begin(); | 46 View::Children::const_iterator it = start_at->children().begin(); |
51 for (; it != start_at->children().end(); ++it) | 47 for (; it != start_at->children().end(); ++it) |
52 NotifyViewTreeChangeDown(*it, params, change_applied); | 48 NotifyViewTreeChangeDown(*it, params, change_applied); |
53 } | 49 } |
54 | 50 |
55 void NotifyViewTreeChange( | 51 void NotifyViewTreeChange(const ViewObserver::TreeChangeParams& params, |
56 const ViewObserver::TreeChangeParams& params, | 52 bool change_applied) { |
57 bool change_applied) { | |
58 NotifyViewTreeChangeDown(params.target, params, change_applied); | 53 NotifyViewTreeChangeDown(params.target, params, change_applied); |
59 if (params.old_parent) | 54 if (params.old_parent) |
60 NotifyViewTreeChangeUp(params.old_parent, params, change_applied); | 55 NotifyViewTreeChangeUp(params.old_parent, params, change_applied); |
61 if (params.new_parent) | 56 if (params.new_parent) |
62 NotifyViewTreeChangeUp(params.new_parent, params, change_applied); | 57 NotifyViewTreeChangeUp(params.new_parent, params, change_applied); |
63 } | 58 } |
64 | 59 |
65 class ScopedTreeNotifier { | 60 class ScopedTreeNotifier { |
66 public: | 61 public: |
67 ScopedTreeNotifier(View* target, View* old_parent, View* new_parent) { | 62 ScopedTreeNotifier(View* target, View* old_parent, View* new_parent) { |
68 params_.target = target; | 63 params_.target = target; |
69 params_.old_parent = old_parent; | 64 params_.old_parent = old_parent; |
70 params_.new_parent = new_parent; | 65 params_.new_parent = new_parent; |
71 NotifyViewTreeChange(params_, false); | 66 NotifyViewTreeChange(params_, false); |
72 } | 67 } |
73 ~ScopedTreeNotifier() { | 68 ~ScopedTreeNotifier() { NotifyViewTreeChange(params_, true); } |
74 NotifyViewTreeChange(params_, true); | |
75 } | |
76 | 69 |
77 private: | 70 private: |
78 ViewObserver::TreeChangeParams params_; | 71 ViewObserver::TreeChangeParams params_; |
79 | 72 |
80 MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedTreeNotifier); | 73 MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedTreeNotifier); |
81 }; | 74 }; |
82 | 75 |
83 void RemoveChildImpl(View* child, View::Children* children) { | 76 void RemoveChildImpl(View* child, View::Children* children) { |
84 View::Children::iterator it = | 77 View::Children::iterator it = |
85 std::find(children->begin(), children->end(), child); | 78 std::find(children->begin(), children->end(), child); |
86 if (it != children->end()) { | 79 if (it != children->end()) { |
87 children->erase(it); | 80 children->erase(it); |
88 ViewPrivate(child).ClearParent(); | 81 ViewPrivate(child).ClearParent(); |
89 } | 82 } |
90 } | 83 } |
91 | 84 |
92 class ScopedOrderChangedNotifier { | 85 class ScopedOrderChangedNotifier { |
93 public: | 86 public: |
94 ScopedOrderChangedNotifier(View* view, | 87 ScopedOrderChangedNotifier(View* view, |
95 View* relative_view, | 88 View* relative_view, |
96 OrderDirection direction) | 89 OrderDirection direction) |
97 : view_(view), | 90 : view_(view), relative_view_(relative_view), direction_(direction) { |
98 relative_view_(relative_view), | 91 FOR_EACH_OBSERVER(ViewObserver, *ViewPrivate(view_).observers(), |
99 direction_(direction) { | |
100 FOR_EACH_OBSERVER(ViewObserver, | |
101 *ViewPrivate(view_).observers(), | |
102 OnViewReordering(view_, relative_view_, direction_)); | 92 OnViewReordering(view_, relative_view_, direction_)); |
103 } | 93 } |
104 ~ScopedOrderChangedNotifier() { | 94 ~ScopedOrderChangedNotifier() { |
105 FOR_EACH_OBSERVER(ViewObserver, | 95 FOR_EACH_OBSERVER(ViewObserver, *ViewPrivate(view_).observers(), |
106 *ViewPrivate(view_).observers(), | |
107 OnViewReordered(view_, relative_view_, direction_)); | 96 OnViewReordered(view_, relative_view_, direction_)); |
108 } | 97 } |
109 | 98 |
110 private: | 99 private: |
111 View* view_; | 100 View* view_; |
112 View* relative_view_; | 101 View* relative_view_; |
113 OrderDirection direction_; | 102 OrderDirection direction_; |
114 | 103 |
115 MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedOrderChangedNotifier); | 104 MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedOrderChangedNotifier); |
116 }; | 105 }; |
(...skipping 26 matching lines...) Expand all Loading... |
143 children->insert(children->begin() + dest_i, view); | 132 children->insert(children->begin() + dest_i, view); |
144 | 133 |
145 return true; | 134 return true; |
146 } | 135 } |
147 | 136 |
148 class ScopedSetBoundsNotifier { | 137 class ScopedSetBoundsNotifier { |
149 public: | 138 public: |
150 ScopedSetBoundsNotifier(View* view, | 139 ScopedSetBoundsNotifier(View* view, |
151 const Rect& old_bounds, | 140 const Rect& old_bounds, |
152 const Rect& new_bounds) | 141 const Rect& new_bounds) |
153 : view_(view), | 142 : view_(view), old_bounds_(old_bounds), new_bounds_(new_bounds) { |
154 old_bounds_(old_bounds), | 143 FOR_EACH_OBSERVER(ViewObserver, *ViewPrivate(view_).observers(), |
155 new_bounds_(new_bounds) { | |
156 FOR_EACH_OBSERVER(ViewObserver, | |
157 *ViewPrivate(view_).observers(), | |
158 OnViewBoundsChanging(view_, old_bounds_, new_bounds_)); | 144 OnViewBoundsChanging(view_, old_bounds_, new_bounds_)); |
159 } | 145 } |
160 ~ScopedSetBoundsNotifier() { | 146 ~ScopedSetBoundsNotifier() { |
161 FOR_EACH_OBSERVER(ViewObserver, | 147 FOR_EACH_OBSERVER(ViewObserver, *ViewPrivate(view_).observers(), |
162 *ViewPrivate(view_).observers(), | |
163 OnViewBoundsChanged(view_, old_bounds_, new_bounds_)); | 148 OnViewBoundsChanged(view_, old_bounds_, new_bounds_)); |
164 } | 149 } |
165 | 150 |
166 private: | 151 private: |
167 View* view_; | 152 View* view_; |
168 const Rect old_bounds_; | 153 const Rect old_bounds_; |
169 const Rect new_bounds_; | 154 const Rect new_bounds_; |
170 | 155 |
171 MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedSetBoundsNotifier); | 156 MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedSetBoundsNotifier); |
172 }; | 157 }; |
173 | 158 |
174 // Some operations are only permitted in the connection that created the view. | 159 // Some operations are only permitted in the connection that created the view. |
175 bool OwnsView(ViewManager* manager, View* view) { | 160 bool OwnsView(ViewManager* manager, View* view) { |
176 return !manager || | 161 return !manager || |
177 static_cast<ViewManagerClientImpl*>(manager)->OwnsView(view->id()); | 162 static_cast<ViewManagerClientImpl*>(manager)->OwnsView(view->id()); |
178 } | 163 } |
179 | 164 |
180 } // namespace | 165 } // namespace |
181 | 166 |
182 //////////////////////////////////////////////////////////////////////////////// | 167 //////////////////////////////////////////////////////////////////////////////// |
183 // View, public: | 168 // View, public: |
184 | 169 |
185 void View::Destroy() { | 170 void View::Destroy() { |
186 if (!OwnsView(manager_, this)) | 171 if (!OwnsView(manager_, this)) |
187 return; | 172 return; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 } | 232 } |
248 | 233 |
249 // TODO: add test coverage of this (450303). | 234 // TODO: add test coverage of this (450303). |
250 if (manager_) { | 235 if (manager_) { |
251 Array<uint8_t> transport_value; | 236 Array<uint8_t> transport_value; |
252 if (value) { | 237 if (value) { |
253 transport_value.resize(value->size()); | 238 transport_value.resize(value->size()); |
254 if (value->size()) | 239 if (value->size()) |
255 memcpy(&transport_value.front(), &(value->front()), value->size()); | 240 memcpy(&transport_value.front(), &(value->front()), value->size()); |
256 } | 241 } |
257 static_cast<ViewManagerClientImpl*>(manager_)->SetProperty( | 242 static_cast<ViewManagerClientImpl*>(manager_) |
258 id_, name, transport_value.Pass()); | 243 ->SetProperty(id_, name, transport_value.Pass()); |
259 } | 244 } |
260 | 245 |
261 FOR_EACH_OBSERVER( | 246 FOR_EACH_OBSERVER( |
262 ViewObserver, observers_, | 247 ViewObserver, observers_, |
263 OnViewSharedPropertyChanged(this, name, old_value_ptr, value)); | 248 OnViewSharedPropertyChanged(this, name, old_value_ptr, value)); |
264 } | 249 } |
265 | 250 |
266 bool View::IsDrawn() const { | 251 bool View::IsDrawn() const { |
267 if (!visible_) | 252 if (!visible_) |
268 return false; | 253 return false; |
(...skipping 25 matching lines...) Expand all Loading... |
294 static_cast<ViewManagerClientImpl*>(manager_)->AddChild(child->id(), id_); | 279 static_cast<ViewManagerClientImpl*>(manager_)->AddChild(child->id(), id_); |
295 } | 280 } |
296 | 281 |
297 void View::RemoveChild(View* child) { | 282 void View::RemoveChild(View* child) { |
298 // TODO(beng): not necessarily valid to all connections, but possibly to the | 283 // TODO(beng): not necessarily valid to all connections, but possibly to the |
299 // embeddee in an embedder-embeddee relationship. | 284 // embeddee in an embedder-embeddee relationship. |
300 if (manager_) | 285 if (manager_) |
301 CHECK_EQ(child->view_manager(), manager_); | 286 CHECK_EQ(child->view_manager(), manager_); |
302 LocalRemoveChild(child); | 287 LocalRemoveChild(child); |
303 if (manager_) { | 288 if (manager_) { |
304 static_cast<ViewManagerClientImpl*>(manager_)->RemoveChild(child->id(), | 289 static_cast<ViewManagerClientImpl*>(manager_) |
305 id_); | 290 ->RemoveChild(child->id(), id_); |
306 } | 291 } |
307 } | 292 } |
308 | 293 |
309 void View::MoveToFront() { | 294 void View::MoveToFront() { |
310 if (!parent_ || parent_->children_.back() == this) | 295 if (!parent_ || parent_->children_.back() == this) |
311 return; | 296 return; |
312 Reorder(parent_->children_.back(), OrderDirection::ABOVE); | 297 Reorder(parent_->children_.back(), OrderDirection::ABOVE); |
313 } | 298 } |
314 | 299 |
315 void View::MoveToBack() { | 300 void View::MoveToBack() { |
316 if (!parent_ || parent_->children_.front() == this) | 301 if (!parent_ || parent_->children_.front() == this) |
317 return; | 302 return; |
318 Reorder(parent_->children_.front(), OrderDirection::BELOW); | 303 Reorder(parent_->children_.front(), OrderDirection::BELOW); |
319 } | 304 } |
320 | 305 |
321 void View::Reorder(View* relative, OrderDirection direction) { | 306 void View::Reorder(View* relative, OrderDirection direction) { |
322 if (!LocalReorder(relative, direction)) | 307 if (!LocalReorder(relative, direction)) |
323 return; | 308 return; |
324 if (manager_) { | 309 if (manager_) { |
325 static_cast<ViewManagerClientImpl*>(manager_)->Reorder(id_, | 310 static_cast<ViewManagerClientImpl*>(manager_) |
326 relative->id(), | 311 ->Reorder(id_, relative->id(), direction); |
327 direction); | |
328 } | 312 } |
329 } | 313 } |
330 | 314 |
331 bool View::Contains(View* child) const { | 315 bool View::Contains(View* child) const { |
332 if (!child) | 316 if (!child) |
333 return false; | 317 return false; |
334 if (child == this) | 318 if (child == this) |
335 return true; | 319 return true; |
336 if (manager_) | 320 if (manager_) |
337 CHECK_EQ(child->view_manager(), manager_); | 321 CHECK_EQ(child->view_manager(), manager_); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 } | 383 } |
400 | 384 |
401 } // namespace | 385 } // namespace |
402 | 386 |
403 View::View() | 387 View::View() |
404 : manager_(NULL), | 388 : manager_(NULL), |
405 id_(static_cast<Id>(-1)), | 389 id_(static_cast<Id>(-1)), |
406 parent_(NULL), | 390 parent_(NULL), |
407 viewport_metrics_(CreateEmptyViewportMetrics()), | 391 viewport_metrics_(CreateEmptyViewportMetrics()), |
408 visible_(true), | 392 visible_(true), |
409 drawn_(false) { | 393 drawn_(false) {} |
410 } | |
411 | 394 |
412 View::~View() { | 395 View::~View() { |
413 FOR_EACH_OBSERVER(ViewObserver, observers_, OnViewDestroying(this)); | 396 FOR_EACH_OBSERVER(ViewObserver, observers_, OnViewDestroying(this)); |
414 if (parent_) | 397 if (parent_) |
415 parent_->LocalRemoveChild(this); | 398 parent_->LocalRemoveChild(this); |
416 | 399 |
417 // We may still have children. This can happen if the embedder destroys the | 400 // We may still have children. This can happen if the embedder destroys the |
418 // root while we're still alive. | 401 // root while we're still alive. |
419 while (!children_.empty()) { | 402 while (!children_.empty()) { |
420 View* child = children_.front(); | 403 View* child = children_.front(); |
(...skipping 18 matching lines...) Expand all Loading... |
439 | 422 |
440 //////////////////////////////////////////////////////////////////////////////// | 423 //////////////////////////////////////////////////////////////////////////////// |
441 // View, private: | 424 // View, private: |
442 | 425 |
443 View::View(ViewManager* manager, Id id) | 426 View::View(ViewManager* manager, Id id) |
444 : manager_(manager), | 427 : manager_(manager), |
445 id_(id), | 428 id_(id), |
446 parent_(nullptr), | 429 parent_(nullptr), |
447 viewport_metrics_(CreateEmptyViewportMetrics()), | 430 viewport_metrics_(CreateEmptyViewportMetrics()), |
448 visible_(false), | 431 visible_(false), |
449 drawn_(false) { | 432 drawn_(false) {} |
450 } | |
451 | 433 |
452 int64 View::SetLocalPropertyInternal(const void* key, | 434 int64 View::SetLocalPropertyInternal(const void* key, |
453 const char* name, | 435 const char* name, |
454 PropertyDeallocator deallocator, | 436 PropertyDeallocator deallocator, |
455 int64 value, | 437 int64 value, |
456 int64 default_value) { | 438 int64 default_value) { |
457 int64 old = GetLocalPropertyInternal(key, default_value); | 439 int64 old = GetLocalPropertyInternal(key, default_value); |
458 if (value == default_value) { | 440 if (value == default_value) { |
459 prop_map_.erase(key); | 441 prop_map_.erase(key); |
460 } else { | 442 } else { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 void View::LocalRemoveChild(View* child) { | 474 void View::LocalRemoveChild(View* child) { |
493 DCHECK_EQ(this, child->parent()); | 475 DCHECK_EQ(this, child->parent()); |
494 ScopedTreeNotifier notifier(child, this, NULL); | 476 ScopedTreeNotifier notifier(child, this, NULL); |
495 RemoveChildImpl(child, &children_); | 477 RemoveChildImpl(child, &children_); |
496 } | 478 } |
497 | 479 |
498 bool View::LocalReorder(View* relative, OrderDirection direction) { | 480 bool View::LocalReorder(View* relative, OrderDirection direction) { |
499 return ReorderImpl(&parent_->children_, this, relative, direction); | 481 return ReorderImpl(&parent_->children_, this, relative, direction); |
500 } | 482 } |
501 | 483 |
502 void View::LocalSetBounds(const Rect& old_bounds, | 484 void View::LocalSetBounds(const Rect& old_bounds, const Rect& new_bounds) { |
503 const Rect& new_bounds) { | |
504 DCHECK(old_bounds.x == bounds_.x); | 485 DCHECK(old_bounds.x == bounds_.x); |
505 DCHECK(old_bounds.y == bounds_.y); | 486 DCHECK(old_bounds.y == bounds_.y); |
506 DCHECK(old_bounds.width == bounds_.width); | 487 DCHECK(old_bounds.width == bounds_.width); |
507 DCHECK(old_bounds.height == bounds_.height); | 488 DCHECK(old_bounds.height == bounds_.height); |
508 ScopedSetBoundsNotifier notifier(this, old_bounds, new_bounds); | 489 ScopedSetBoundsNotifier notifier(this, old_bounds, new_bounds); |
509 bounds_ = new_bounds; | 490 bounds_ = new_bounds; |
510 } | 491 } |
511 | 492 |
512 void View::LocalSetViewportMetrics(const ViewportMetrics& old_metrics, | 493 void View::LocalSetViewportMetrics(const ViewportMetrics& old_metrics, |
513 const ViewportMetrics& new_metrics) { | 494 const ViewportMetrics& new_metrics) { |
(...skipping 23 matching lines...) Expand all Loading... |
537 if (visible_ == visible) | 518 if (visible_ == visible) |
538 return; | 519 return; |
539 | 520 |
540 FOR_EACH_OBSERVER(ViewObserver, observers_, OnViewVisibilityChanging(this)); | 521 FOR_EACH_OBSERVER(ViewObserver, observers_, OnViewVisibilityChanging(this)); |
541 visible_ = visible; | 522 visible_ = visible; |
542 NotifyViewVisibilityChanged(this); | 523 NotifyViewVisibilityChanged(this); |
543 } | 524 } |
544 | 525 |
545 void View::NotifyViewVisibilityChanged(View* target) { | 526 void View::NotifyViewVisibilityChanged(View* target) { |
546 if (!NotifyViewVisibilityChangedDown(target)) { | 527 if (!NotifyViewVisibilityChangedDown(target)) { |
547 return; // |this| has been deleted. | 528 return; // |this| has been deleted. |
548 } | 529 } |
549 NotifyViewVisibilityChangedUp(target); | 530 NotifyViewVisibilityChangedUp(target); |
550 } | 531 } |
551 | 532 |
552 bool View::NotifyViewVisibilityChangedAtReceiver(View* target) { | 533 bool View::NotifyViewVisibilityChangedAtReceiver(View* target) { |
553 // |this| may be deleted during a call to OnViewVisibilityChanged() on one | 534 // |this| may be deleted during a call to OnViewVisibilityChanged() on one |
554 // of the observers. We create an local observer for that. In that case we | 535 // of the observers. We create an local observer for that. In that case we |
555 // exit without further access to any members. | 536 // exit without further access to any members. |
556 ViewTracker tracker; | 537 ViewTracker tracker; |
557 tracker.Add(this); | 538 tracker.Add(this); |
558 FOR_EACH_OBSERVER(ViewObserver, observers_, OnViewVisibilityChanged(target)); | 539 FOR_EACH_OBSERVER(ViewObserver, observers_, OnViewVisibilityChanged(target)); |
559 return tracker.Contains(this); | 540 return tracker.Contains(this); |
560 } | 541 } |
561 | 542 |
562 bool View::NotifyViewVisibilityChangedDown(View* target) { | 543 bool View::NotifyViewVisibilityChangedDown(View* target) { |
563 if (!NotifyViewVisibilityChangedAtReceiver(target)) | 544 if (!NotifyViewVisibilityChangedAtReceiver(target)) |
564 return false; // |this| was deleted. | 545 return false; // |this| was deleted. |
565 std::set<const View*> child_already_processed; | 546 std::set<const View*> child_already_processed; |
566 bool child_destroyed = false; | 547 bool child_destroyed = false; |
567 do { | 548 do { |
568 child_destroyed = false; | 549 child_destroyed = false; |
569 for (View::Children::const_iterator it = children_.begin(); | 550 for (View::Children::const_iterator it = children_.begin(); |
570 it != children_.end(); ++it) { | 551 it != children_.end(); ++it) { |
571 if (!child_already_processed.insert(*it).second) | 552 if (!child_already_processed.insert(*it).second) |
572 continue; | 553 continue; |
573 if (!(*it)->NotifyViewVisibilityChangedDown(target)) { | 554 if (!(*it)->NotifyViewVisibilityChangedDown(target)) { |
574 // |*it| was deleted, |it| is invalid and |children_| has changed. We | 555 // |*it| was deleted, |it| is invalid and |children_| has changed. We |
(...skipping 18 matching lines...) Expand all Loading... |
593 bool View::PrepareForEmbed() { | 574 bool View::PrepareForEmbed() { |
594 if (!OwnsView(manager_, this)) | 575 if (!OwnsView(manager_, this)) |
595 return false; | 576 return false; |
596 | 577 |
597 while (!children_.empty()) | 578 while (!children_.empty()) |
598 RemoveChild(children_[0]); | 579 RemoveChild(children_[0]); |
599 return true; | 580 return true; |
600 } | 581 } |
601 | 582 |
602 } // namespace mojo | 583 } // namespace mojo |
OLD | NEW |