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 const Node* ViewManagerConnection::GetNode(const NodeId& id) const { | 73 const Node* ViewManagerConnection::GetNode(const NodeId& id) const { |
76 if (id_ == id.connection_id) { | 74 if (id_ == id.connection_id) { |
77 NodeMap::const_iterator i = node_map_.find(id.node_id); | 75 NodeMap::const_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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 | 398 |
401 void ViewManagerConnection::OnNodeViewReplaced(const Node* node, | 399 void ViewManagerConnection::OnNodeViewReplaced(const Node* node, |
402 const View* new_view, | 400 const View* new_view, |
403 const View* old_view) { | 401 const View* old_view) { |
404 root_node_manager_->ProcessNodeViewReplaced(node, new_view, old_view); | 402 root_node_manager_->ProcessNodeViewReplaced(node, new_view, old_view); |
405 } | 403 } |
406 | 404 |
407 } // namespace service | 405 } // namespace service |
408 } // namespace view_manager | 406 } // namespace view_manager |
409 } // namespace mojo | 407 } // namespace mojo |
OLD | NEW |