Chromium Code Reviews| Index: mojo/services/view_manager/view_manager_connection.cc |
| diff --git a/mojo/services/view_manager/view_manager_connection.cc b/mojo/services/view_manager/view_manager_connection.cc |
| index 6caf9a1f253241c97e8dbeaf36496d5f9bbbc837..fb853d12675e56fed86da6d71e46f8374ef60462 100644 |
| --- a/mojo/services/view_manager/view_manager_connection.cc |
| +++ b/mojo/services/view_manager/view_manager_connection.cc |
| @@ -5,6 +5,7 @@ |
| #include "mojo/services/view_manager/view_manager_connection.h" |
| #include "base/stl_util.h" |
| +#include "mojo/geometry/geometry_type_converters.h" |
| #include "mojo/public/cpp/bindings/allocation_scope.h" |
| #include "mojo/services/view_manager/node.h" |
| #include "mojo/services/view_manager/root_node_manager.h" |
| @@ -85,6 +86,20 @@ View* ViewManagerConnection::GetView(const ViewId& id) { |
| return root_node_manager_->GetView(id); |
| } |
| +void ViewManagerConnection::ProcessNodeBoundsChanged( |
| + const Node* node, |
| + const gfx::Rect& old_bounds, |
| + const gfx::Rect& new_bounds, |
| + bool originated_change) { |
| + if (originated_change) |
| + return; |
| + TransportNodeId node_id = NodeIdToTransportId(node->id()); |
| + if (known_nodes_.count(node_id) > 0) { |
| + AllocationScope scope; |
| + client()->OnNodeBoundsChanged(node_id, old_bounds, new_bounds); |
| + } |
| +} |
| + |
| void ViewManagerConnection::ProcessNodeHierarchyChanged( |
| const Node* node, |
| const Node* new_parent, |
| @@ -511,6 +526,24 @@ void ViewManagerConnection::SetRoots( |
| connection->ProcessSetRoots(id_, transport_node_ids)); |
| } |
| +void ViewManagerConnection::SetNodeBounds( |
| + TransportNodeId node_id, |
| + const Rect& bounds, |
| + const Callback<void(bool)>& callback) { |
| + bool success = false; |
| + Node* node = GetNode(NodeIdFromTransportId(node_id)); |
|
sky
2014/05/21 21:16:35
Only do this if node->id().connection_id == id_.
|
| + if (node) { |
| + RootNodeManager::ScopedChange change( |
| + this, root_node_manager_, |
| + RootNodeManager::CHANGE_TYPE_DONT_ADVANCE_SERVER_CHANGE_ID, false); |
| + gfx::Rect old_bounds = node->window()->bounds(); |
| + node->window()->SetBounds(bounds); |
| + root_node_manager_->ProcessNodeBoundsChanged(node, old_bounds, bounds); |
| + success = true; |
| + } |
| + callback.Run(success); |
| +} |
| + |
| void ViewManagerConnection::OnNodeHierarchyChanged(const Node* node, |
| const Node* new_parent, |
| const Node* old_parent) { |