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 c3053c0d5899575b48c79fd70fcb5d9168d6c87b..0d717ab413bc10235302be9add9df4543f1549e1 100644 |
--- a/mojo/services/view_manager/view_manager_connection.cc |
+++ b/mojo/services/view_manager/view_manager_connection.cc |
@@ -331,6 +331,11 @@ bool ViewManagerConnection::CanSetView(const Node* node, |
return (view && view_id.connection_id == id_) || view_id == ViewId(); |
} |
+bool ViewManagerConnection::CanSetFocus(const Node* node) const { |
+ // TODO(beng): security. |
+ return true; |
+} |
+ |
bool ViewManagerConnection::CanGetNodeTree(const Node* node) const { |
return node && |
(IsNodeDescendantOfRoots(node) || node->id().connection_id == id_); |
@@ -695,6 +700,17 @@ void ViewManagerConnection::SetViewContents( |
callback.Run(true); |
} |
+void ViewManagerConnection::SetFocus(Id node_id, |
+ const Callback<void(bool)> & callback) { |
+ bool success = false; |
+ Node* node = GetNode(NodeIdFromTransportId(node_id)); |
+ if (CanSetFocus(node)) { |
+ success = true; |
+ node->window()->Focus(); |
+ } |
+ callback.Run(success); |
+} |
+ |
void ViewManagerConnection::SetNodeBounds( |
Id node_id, |
RectPtr bounds, |