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 "mojo/services/public/cpp/view_manager/view.h" | 5 #include "mojo/services/public/cpp/view_manager/view.h" |
6 | 6 |
7 #include "mojo/public/cpp/application/service_provider_impl.h" | 7 #include "mojo/public/cpp/application/service_provider_impl.h" |
8 #include "mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h" | 8 #include "mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h" |
9 #include "mojo/services/public/cpp/view_manager/lib/view_private.h" | 9 #include "mojo/services/public/cpp/view_manager/lib/view_private.h" |
10 #include "mojo/services/public/cpp/view_manager/view_observer.h" | 10 #include "mojo/services/public/cpp/view_manager/view_observer.h" |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 if (!LocalReorder(relative, direction)) | 304 if (!LocalReorder(relative, direction)) |
305 return; | 305 return; |
306 if (manager_) { | 306 if (manager_) { |
307 static_cast<ViewManagerClientImpl*>(manager_)->Reorder(id_, | 307 static_cast<ViewManagerClientImpl*>(manager_)->Reorder(id_, |
308 relative->id(), | 308 relative->id(), |
309 direction); | 309 direction); |
310 } | 310 } |
311 } | 311 } |
312 | 312 |
313 bool View::Contains(View* child) const { | 313 bool View::Contains(View* child) const { |
| 314 if (!child) |
| 315 return false; |
| 316 if (child == this) |
| 317 return true; |
314 if (manager_) | 318 if (manager_) |
315 CHECK_EQ(ViewPrivate(child).view_manager(), manager_); | 319 CHECK_EQ(ViewPrivate(child).view_manager(), manager_); |
316 for (View* p = child->parent(); p; p = p->parent()) { | 320 for (View* p = child->parent(); p; p = p->parent()) { |
317 if (p == this) | 321 if (p == this) |
318 return true; | 322 return true; |
319 } | 323 } |
320 return false; | 324 return false; |
321 } | 325 } |
322 | 326 |
323 View* View::GetChildById(Id id) { | 327 View* View::GetChildById(Id id) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 if (IsDrawn() == value) { | 441 if (IsDrawn() == value) { |
438 drawn_ = value; | 442 drawn_ = value; |
439 return; | 443 return; |
440 } | 444 } |
441 FOR_EACH_OBSERVER(ViewObserver, observers_, OnViewDrawnChanging(this)); | 445 FOR_EACH_OBSERVER(ViewObserver, observers_, OnViewDrawnChanging(this)); |
442 drawn_ = value; | 446 drawn_ = value; |
443 FOR_EACH_OBSERVER(ViewObserver, observers_, OnViewDrawnChanged(this)); | 447 FOR_EACH_OBSERVER(ViewObserver, observers_, OnViewDrawnChanged(this)); |
444 } | 448 } |
445 | 449 |
446 } // namespace mojo | 450 } // namespace mojo |
OLD | NEW |