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 |