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

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

Issue 250633003: Adds more to viewmanager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: override Created 6 years, 8 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/root_node_manager.h ('k') | mojo/services/view_manager/view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/view_manager/root_node_manager.cc
diff --git a/mojo/services/view_manager/root_node_manager.cc b/mojo/services/view_manager/root_node_manager.cc
index f35df3da298f49d38d8ab56482e7f2b49995cc64..210427a1f47a944ac778bb4c32aafe44656086fb 100644
--- a/mojo/services/view_manager/root_node_manager.cc
+++ b/mojo/services/view_manager/root_node_manager.cc
@@ -51,6 +51,11 @@ void RootNodeManager::RemoveConnection(ViewManagerConnection* connection) {
connection_map_.erase(connection->id());
}
+ViewManagerConnection* RootNodeManager::GetConnection(uint16_t connection_id) {
+ ConnectionMap::iterator i = connection_map_.find(connection_id);
+ return i == connection_map_.end() ? NULL : i->second;
+}
+
Node* RootNodeManager::GetNode(const NodeId& id) {
if (id == root_.id())
return &root_;
@@ -58,6 +63,11 @@ Node* RootNodeManager::GetNode(const NodeId& id) {
return i == connection_map_.end() ? NULL : i->second->GetNode(id);
}
+View* RootNodeManager::GetView(const ViewId& id) {
+ ConnectionMap::iterator i = connection_map_.find(id.connection_id);
+ return i == connection_map_.end() ? NULL : i->second->GetView(id);
+}
+
void RootNodeManager::NotifyNodeHierarchyChanged(const NodeId& node,
const NodeId& new_parent,
const NodeId& old_parent) {
@@ -70,6 +80,19 @@ void RootNodeManager::NotifyNodeHierarchyChanged(const NodeId& node,
}
}
+void RootNodeManager::NotifyNodeViewReplaced(const NodeId& node,
+ const ViewId& new_view_id,
+ const ViewId& old_view_id) {
+ // TODO(sky): make a macro for this.
+ for (ConnectionMap::iterator i = connection_map_.begin();
+ i != connection_map_.end(); ++i) {
+ const int32_t change_id = (change_ && i->first == change_->connection_id) ?
+ change_->change_id : 0;
+ i->second->NotifyNodeViewReplaced(node, new_view_id, old_view_id,
+ change_id);
+ }
+}
+
void RootNodeManager::PrepareForChange(ViewManagerConnection* connection,
int32_t change_id) {
DCHECK(!change_.get()); // Should only ever have one change in flight.
@@ -101,6 +124,12 @@ void RootNodeManager::OnNodeHierarchyChanged(const NodeId& node,
NotifyNodeHierarchyChanged(node, new_parent, old_parent);
}
+void RootNodeManager::OnNodeViewReplaced(const NodeId& node,
+ const ViewId& new_view_id,
+ const ViewId& old_view_id) {
+ NotifyNodeViewReplaced(node, new_view_id, old_view_id);
+}
+
} // namespace view_manager
} // namespace services
} // namespace mojo
« no previous file with comments | « mojo/services/view_manager/root_node_manager.h ('k') | mojo/services/view_manager/view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698