| 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/view_manager/public/cpp/view.h" | 5 #include "mojo/services/view_manager/public/cpp/view.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "mojo/public/cpp/application/service_provider_impl.h" | 9 #include "mojo/public/cpp/application/service_provider_impl.h" |
| 10 #include "mojo/services/view_manager/public/cpp/lib/view_manager_client_impl.h" | 10 #include "mojo/services/view_manager/public/cpp/lib/view_manager_client_impl.h" |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 } | 266 } |
| 267 | 267 |
| 268 void View::AddObserver(ViewObserver* observer) { | 268 void View::AddObserver(ViewObserver* observer) { |
| 269 observers_.AddObserver(observer); | 269 observers_.AddObserver(observer); |
| 270 } | 270 } |
| 271 | 271 |
| 272 void View::RemoveObserver(ViewObserver* observer) { | 272 void View::RemoveObserver(ViewObserver* observer) { |
| 273 observers_.RemoveObserver(observer); | 273 observers_.RemoveObserver(observer); |
| 274 } | 274 } |
| 275 | 275 |
| 276 View* View::GetRoot() { |
| 277 View* root = this; |
| 278 for (View* parent = this; parent; parent = parent->parent()) |
| 279 root = parent; |
| 280 return root; |
| 281 } |
| 282 |
| 276 const View* View::GetRoot() const { | 283 const View* View::GetRoot() const { |
| 277 const View* root = this; | 284 const View* root = this; |
| 278 for (const View* parent = this; parent; parent = parent->parent()) | 285 for (const View* parent = this; parent; parent = parent->parent()) |
| 279 root = parent; | 286 root = parent; |
| 280 return root; | 287 return root; |
| 281 } | 288 } |
| 282 | 289 |
| 283 void View::AddChild(View* child) { | 290 void View::AddChild(View* child) { |
| 284 // TODO(beng): not necessarily valid to all connections, but possibly to the | 291 // TODO(beng): not necessarily valid to all connections, but possibly to the |
| 285 // embeddee in an embedder-embeddee relationship. | 292 // embeddee in an embedder-embeddee relationship. |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 void View::NotifyViewVisibilityChangedUp(View* target) { | 555 void View::NotifyViewVisibilityChangedUp(View* target) { |
| 549 // Start with the parent as we already notified |this| | 556 // Start with the parent as we already notified |this| |
| 550 // in NotifyViewVisibilityChangedDown. | 557 // in NotifyViewVisibilityChangedDown. |
| 551 for (View* view = parent(); view; view = view->parent()) { | 558 for (View* view = parent(); view; view = view->parent()) { |
| 552 bool ret = view->NotifyViewVisibilityChangedAtReceiver(target); | 559 bool ret = view->NotifyViewVisibilityChangedAtReceiver(target); |
| 553 DCHECK(ret); | 560 DCHECK(ret); |
| 554 } | 561 } |
| 555 } | 562 } |
| 556 | 563 |
| 557 } // namespace mojo | 564 } // namespace mojo |
| OLD | NEW |