Index: mojo/services/public/cpp/view_manager/lib/view.cc |
diff --git a/mojo/services/public/cpp/view_manager/lib/view.cc b/mojo/services/public/cpp/view_manager/lib/view.cc |
index bedac6b67b6bea406fb55d0288a3bec5f9295e67..4dc45227fcb36139a692e624b5728fd8cec934e3 100644 |
--- a/mojo/services/public/cpp/view_manager/lib/view.cc |
+++ b/mojo/services/public/cpp/view_manager/lib/view.cc |
@@ -270,6 +270,13 @@ void View::RemoveObserver(ViewObserver* observer) { |
observers_.RemoveObserver(observer); |
} |
+const View* View::GetRoot() const { |
+ const View* root = this; |
+ for (const View* parent = this; parent; parent = parent->parent()) |
+ root = parent; |
+ return root; |
+} |
+ |
void View::AddChild(View* child) { |
// TODO(beng): not necessarily valid to all connections, but possibly to the |
// embeddee in an embedder-embeddee relationship. |