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/view_manager_connection.h" | 5 #include "mojo/services/view_manager/view_manager_connection.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "mojo/public/cpp/bindings/allocation_scope.h" | 8 #include "mojo/public/cpp/bindings/allocation_scope.h" |
9 #include "mojo/services/view_manager/node.h" | 9 #include "mojo/services/view_manager/node.h" |
10 #include "mojo/services/view_manager/root_node_manager.h" | 10 #include "mojo/services/view_manager/root_node_manager.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 } | 75 } |
76 | 76 |
77 STLDeleteContainerPairSecondPointers(node_map_.begin(), node_map_.end()); | 77 STLDeleteContainerPairSecondPointers(node_map_.begin(), node_map_.end()); |
78 context()->RemoveConnection(this); | 78 context()->RemoveConnection(this); |
79 } | 79 } |
80 | 80 |
81 void ViewManagerConnection::Initialize( | 81 void ViewManagerConnection::Initialize( |
82 ServiceConnector<ViewManagerConnection, RootNodeManager>* service_factory, | 82 ServiceConnector<ViewManagerConnection, RootNodeManager>* service_factory, |
83 ScopedMessagePipeHandle client_handle) { | 83 ScopedMessagePipeHandle client_handle) { |
84 DCHECK_EQ(0, id_); // Should only get Initialize() once. | 84 DCHECK_EQ(0, id_); // Should only get Initialize() once. |
85 ServiceConnection<ViewManager, ViewManagerConnection, RootNodeManager>:: | 85 ServiceConnection<IViewManager, ViewManagerConnection, RootNodeManager>:: |
86 Initialize(service_factory, client_handle.Pass()); | 86 Initialize(service_factory, client_handle.Pass()); |
87 id_ = context()->GetAndAdvanceNextConnectionId(); | 87 id_ = context()->GetAndAdvanceNextConnectionId(); |
88 context()->AddConnection(this); | 88 context()->AddConnection(this); |
89 client()->OnConnectionEstablished(id_); | 89 client()->OnConnectionEstablished(id_); |
90 } | 90 } |
91 | 91 |
92 Node* ViewManagerConnection::GetNode(const NodeId& id) { | 92 Node* ViewManagerConnection::GetNode(const NodeId& id) { |
93 if (id_ == id.connection_id) { | 93 if (id_ == id.connection_id) { |
94 NodeMap::iterator i = node_map_.find(id.node_id); | 94 NodeMap::iterator i = node_map_.find(id.node_id); |
95 return i == node_map_.end() ? NULL : i->second; | 95 return i == node_map_.end() ? NULL : i->second; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 | 278 |
279 void ViewManagerConnection::OnNodeViewReplaced(const NodeId& node, | 279 void ViewManagerConnection::OnNodeViewReplaced(const NodeId& node, |
280 const ViewId& new_view_id, | 280 const ViewId& new_view_id, |
281 const ViewId& old_view_id) { | 281 const ViewId& old_view_id) { |
282 context()->NotifyNodeViewReplaced(node, new_view_id, old_view_id); | 282 context()->NotifyNodeViewReplaced(node, new_view_id, old_view_id); |
283 } | 283 } |
284 | 284 |
285 } // namespace view_manager | 285 } // namespace view_manager |
286 } // namespace services | 286 } // namespace services |
287 } // namespace mojo | 287 } // namespace mojo |
OLD | NEW |