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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 root_node_manager_->AddConnection(this); | 63 root_node_manager_->AddConnection(this); |
64 std::vector<const Node*> to_send; | 64 std::vector<const Node*> to_send; |
65 GetUnknownNodesFrom(root_node_manager_->root(), &to_send); | 65 GetUnknownNodesFrom(root_node_manager_->root(), &to_send); |
66 AllocationScope allocation_scope; | 66 AllocationScope allocation_scope; |
67 client()->OnConnectionEstablished( | 67 client()->OnConnectionEstablished( |
68 id_, | 68 id_, |
69 root_node_manager_->next_server_change_id(), | 69 root_node_manager_->next_server_change_id(), |
70 Array<INode>::From(to_send)); | 70 Array<INode>::From(to_send)); |
71 } | 71 } |
72 | 72 |
73 void ViewManagerConnection::OnConnectionError() {} | |
74 | |
75 Node* ViewManagerConnection::GetNode(const NodeId& id) { | 73 Node* ViewManagerConnection::GetNode(const NodeId& id) { |
76 if (id_ == id.connection_id) { | 74 if (id_ == id.connection_id) { |
77 NodeMap::iterator i = node_map_.find(id.node_id); | 75 NodeMap::iterator i = node_map_.find(id.node_id); |
78 return i == node_map_.end() ? NULL : i->second; | 76 return i == node_map_.end() ? NULL : i->second; |
79 } | 77 } |
80 return root_node_manager_->GetNode(id); | 78 return root_node_manager_->GetNode(id); |
81 } | 79 } |
82 | 80 |
83 View* ViewManagerConnection::GetView(const ViewId& id) { | 81 View* ViewManagerConnection::GetView(const ViewId& id) { |
84 if (id_ == id.connection_id) { | 82 if (id_ == id.connection_id) { |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 | 383 |
386 void ViewManagerConnection::OnNodeViewReplaced(const Node* node, | 384 void ViewManagerConnection::OnNodeViewReplaced(const Node* node, |
387 const View* new_view, | 385 const View* new_view, |
388 const View* old_view) { | 386 const View* old_view) { |
389 root_node_manager_->ProcessNodeViewReplaced(node, new_view, old_view); | 387 root_node_manager_->ProcessNodeViewReplaced(node, new_view, old_view); |
390 } | 388 } |
391 | 389 |
392 } // namespace service | 390 } // namespace service |
393 } // namespace view_manager | 391 } // namespace view_manager |
394 } // namespace mojo | 392 } // namespace mojo |
OLD | NEW |