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/services/view_manager/node.h" | 8 #include "mojo/services/view_manager/node.h" |
9 #include "mojo/services/view_manager/root_node_manager.h" | 9 #include "mojo/services/view_manager/root_node_manager.h" |
10 #include "mojo/services/view_manager/view.h" | 10 #include "mojo/services/view_manager/view.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 } | 32 } |
33 | 33 |
34 STLDeleteContainerPairSecondPointers(node_map_.begin(), node_map_.end()); | 34 STLDeleteContainerPairSecondPointers(node_map_.begin(), node_map_.end()); |
35 context()->RemoveConnection(this); | 35 context()->RemoveConnection(this); |
36 } | 36 } |
37 | 37 |
38 void ViewManagerConnection::Initialize( | 38 void ViewManagerConnection::Initialize( |
39 ServiceConnector<ViewManagerConnection, RootNodeManager>* service_factory, | 39 ServiceConnector<ViewManagerConnection, RootNodeManager>* service_factory, |
40 ScopedMessagePipeHandle client_handle) { | 40 ScopedMessagePipeHandle client_handle) { |
41 DCHECK_EQ(0, id_); // Should only get Initialize() once. | 41 DCHECK_EQ(0, id_); // Should only get Initialize() once. |
42 ServiceConnection<IViewManager, ViewManagerConnection, RootNodeManager>:: | 42 ServiceConnection<ViewManager, ViewManagerConnection, RootNodeManager>:: |
43 Initialize(service_factory, client_handle.Pass()); | 43 Initialize(service_factory, client_handle.Pass()); |
44 id_ = context()->GetAndAdvanceNextConnectionId(); | 44 id_ = context()->GetAndAdvanceNextConnectionId(); |
45 context()->AddConnection(this); | 45 context()->AddConnection(this); |
46 client()->OnConnectionEstablished(id_); | 46 client()->OnConnectionEstablished(id_); |
47 } | 47 } |
48 | 48 |
49 Node* ViewManagerConnection::GetNode(const NodeId& id) { | 49 Node* ViewManagerConnection::GetNode(const NodeId& id) { |
50 if (id_ == id.connection_id) { | 50 if (id_ == id.connection_id) { |
51 NodeMap::iterator i = node_map_.find(id.node_id); | 51 NodeMap::iterator i = node_map_.find(id.node_id); |
52 return i == node_map_.end() ? NULL : i->second; | 52 return i == node_map_.end() ? NULL : i->second; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 222 |
223 void ViewManagerConnection::OnNodeViewReplaced(const NodeId& node, | 223 void ViewManagerConnection::OnNodeViewReplaced(const NodeId& node, |
224 const ViewId& new_view_id, | 224 const ViewId& new_view_id, |
225 const ViewId& old_view_id) { | 225 const ViewId& old_view_id) { |
226 context()->NotifyNodeViewReplaced(node, new_view_id, old_view_id); | 226 context()->NotifyNodeViewReplaced(node, new_view_id, old_view_id); |
227 } | 227 } |
228 | 228 |
229 } // namespace view_manager | 229 } // namespace view_manager |
230 } // namespace services | 230 } // namespace services |
231 } // namespace mojo | 231 } // namespace mojo |
OLD | NEW |