Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1614)

Unified Diff: mojo/services/view_manager/node.cc

Issue 288313002: Tweaks to ViewManager: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/services/view_manager/node.h ('k') | mojo/services/view_manager/root_node_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/view_manager/node.cc
diff --git a/mojo/services/view_manager/node.cc b/mojo/services/view_manager/node.cc
index 49d9376b631022d4c930a44874f58aaa8cc0f5b0..21b3b5cab7daf937cdf1d22100c8ed9a7de1e3b9 100644
--- a/mojo/services/view_manager/node.cc
+++ b/mojo/services/view_manager/node.cc
@@ -40,7 +40,7 @@ Node::~Node() {
SetView(NULL);
}
-Node* Node::GetParent() {
+const Node* Node::GetParent() const {
if (!window_.parent())
return NULL;
return window_.parent()->GetProperty(kNodeKey);
@@ -54,6 +54,13 @@ void Node::Remove(Node* child) {
window_.RemoveChild(&child->window_);
}
+const Node* Node::GetRoot() const {
+ const aura::Window* window = &window_;
+ while (window && window->parent())
+ window = window->parent();
+ return window->GetProperty(kNodeKey);
+}
+
std::vector<Node*> Node::GetChildren() {
std::vector<Node*> children;
children.reserve(window_.children().size());
@@ -62,6 +69,10 @@ std::vector<Node*> Node::GetChildren() {
return children;
}
+bool Node::Contains(const Node* node) const {
+ return node && window_.Contains(&(node->window_));
+}
+
void Node::SetView(View* view) {
if (view == view_)
return;
« no previous file with comments | « mojo/services/view_manager/node.h ('k') | mojo/services/view_manager/root_node_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698