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; | |
318 if (manager_) | 314 if (manager_) |
319 CHECK_EQ(ViewPrivate(child).view_manager(), manager_); | 315 CHECK_EQ(ViewPrivate(child).view_manager(), manager_); |
320 for (View* p = child->parent(); p; p = p->parent()) { | 316 for (View* p = child->parent(); p; p = p->parent()) { |
321 if (p == this) | 317 if (p == this) |
322 return true; | 318 return true; |
323 } | 319 } |
324 return false; | 320 return false; |
325 } | 321 } |
326 | 322 |
327 View* View::GetChildById(Id id) { | 323 View* View::GetChildById(Id id) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 if (IsDrawn() == value) { | 437 if (IsDrawn() == value) { |
442 drawn_ = value; | 438 drawn_ = value; |
443 return; | 439 return; |
444 } | 440 } |
445 FOR_EACH_OBSERVER(ViewObserver, observers_, OnViewDrawnChanging(this)); | 441 FOR_EACH_OBSERVER(ViewObserver, observers_, OnViewDrawnChanging(this)); |
446 drawn_ = value; | 442 drawn_ = value; |
447 FOR_EACH_OBSERVER(ViewObserver, observers_, OnViewDrawnChanged(this)); | 443 FOR_EACH_OBSERVER(ViewObserver, observers_, OnViewDrawnChanged(this)); |
448 } | 444 } |
449 | 445 |
450 } // namespace mojo | 446 } // namespace mojo |
OLD | NEW |