Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(365)

Unified Diff: mojo/services/view_manager/view_manager_connection.cc

Issue 287053004: SetBounds for ViewTreeNode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {

Powered by Google App Engine
This is Rietveld 408576698