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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 } | 129 } |
130 | 130 |
131 void ViewManagerConnection::NotifyNodeDeleted( | 131 void ViewManagerConnection::NotifyNodeDeleted( |
132 const NodeId& node, | 132 const NodeId& node, |
133 TransportChangeId server_change_id, | 133 TransportChangeId server_change_id, |
134 TransportChangeId client_change_id) { | 134 TransportChangeId client_change_id) { |
135 client()->OnNodeDeleted(NodeIdToTransportId(node), server_change_id, | 135 client()->OnNodeDeleted(NodeIdToTransportId(node), server_change_id, |
136 client_change_id); | 136 client_change_id); |
137 } | 137 } |
138 | 138 |
139 void ViewManagerConnection::NotifyViewDeleted( | |
140 const ViewId& view, | |
141 TransportChangeId server_change_id, | |
142 TransportChangeId client_change_id) { | |
143 client()->OnViewDeleted(ViewIdToTransportId(view), server_change_id, | |
144 client_change_id); | |
145 } | |
146 | |
147 bool ViewManagerConnection::DeleteNodeImpl(ViewManagerConnection* source, | 139 bool ViewManagerConnection::DeleteNodeImpl(ViewManagerConnection* source, |
148 const NodeId& node_id, | 140 const NodeId& node_id, |
149 TransportChangeId change_id) { | 141 TransportChangeId change_id) { |
150 DCHECK_EQ(node_id.connection_id, id_); | 142 DCHECK_EQ(node_id.connection_id, id_); |
151 Node* node = GetNode(node_id); | 143 Node* node = GetNode(node_id); |
152 if (!node) | 144 if (!node) |
153 return false; | 145 return false; |
154 RootNodeManager::ScopedChange change( | 146 RootNodeManager::ScopedChange change( |
155 source, context(), change_id, | 147 source, context(), change_id, |
156 RootNodeManager::CHANGE_TYPE_ADVANCE_SERVER_CHANGE_ID); | 148 RootNodeManager::CHANGE_TYPE_ADVANCE_SERVER_CHANGE_ID); |
(...skipping 17 matching lines...) Expand all Loading... |
174 View* view = GetView(view_id); | 166 View* view = GetView(view_id); |
175 if (!view) | 167 if (!view) |
176 return false; | 168 return false; |
177 RootNodeManager::ScopedChange change( | 169 RootNodeManager::ScopedChange change( |
178 source, context(), change_id, | 170 source, context(), change_id, |
179 RootNodeManager::CHANGE_TYPE_DONT_ADVANCE_SERVER_CHANGE_ID); | 171 RootNodeManager::CHANGE_TYPE_DONT_ADVANCE_SERVER_CHANGE_ID); |
180 if (view->node()) | 172 if (view->node()) |
181 view->node()->SetView(NULL); | 173 view->node()->SetView(NULL); |
182 view_map_.erase(view_id.view_id); | 174 view_map_.erase(view_id.view_id); |
183 delete view; | 175 delete view; |
184 context()->NotifyViewDeleted(view_id); | |
185 return true; | 176 return true; |
186 } | 177 } |
187 | 178 |
188 bool ViewManagerConnection::SetViewImpl(const NodeId& node_id, | 179 bool ViewManagerConnection::SetViewImpl(const NodeId& node_id, |
189 const ViewId& view_id, | 180 const ViewId& view_id, |
190 TransportChangeId change_id) { | 181 TransportChangeId change_id) { |
191 Node* node = GetNode(node_id); | 182 Node* node = GetNode(node_id); |
192 if (!node) | 183 if (!node) |
193 return false; | 184 return false; |
194 View* view = GetView(view_id); | 185 View* view = GetView(view_id); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 | 328 |
338 void ViewManagerConnection::OnNodeViewReplaced(const NodeId& node, | 329 void ViewManagerConnection::OnNodeViewReplaced(const NodeId& node, |
339 const ViewId& new_view_id, | 330 const ViewId& new_view_id, |
340 const ViewId& old_view_id) { | 331 const ViewId& old_view_id) { |
341 context()->NotifyNodeViewReplaced(node, new_view_id, old_view_id); | 332 context()->NotifyNodeViewReplaced(node, new_view_id, old_view_id); |
342 } | 333 } |
343 | 334 |
344 } // namespace view_manager | 335 } // namespace view_manager |
345 } // namespace services | 336 } // namespace services |
346 } // namespace mojo | 337 } // namespace mojo |
OLD | NEW |