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

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

Issue 489493004: Update view manager to support content handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: blah to the blizzah Created 6 years, 4 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_service_impl.cc
diff --git a/mojo/services/view_manager/view_manager_service_impl.cc b/mojo/services/view_manager/view_manager_service_impl.cc
index 2311b74e7f7e78e911e3f4a361f577e5556b8bca..4938cb461210ddd8823dc9486f499bb494d0efe8 100644
--- a/mojo/services/view_manager/view_manager_service_impl.cc
+++ b/mojo/services/view_manager/view_manager_service_impl.cc
@@ -464,33 +464,25 @@ void ViewManagerServiceImpl::Embed(
return;
}
const Node* node = GetNode(NodeIdFromTransportId(transport_view_id));
- bool success = node && access_policy_->CanEmbed(node);
- if (success) {
- // Only allow a node to be the root for one connection.
- const NodeId node_id(NodeIdFromTransportId(transport_view_id));
- ViewManagerServiceImpl* connection_by_url =
- root_node_manager_->GetConnectionByCreator(id_, url.To<std::string>());
- ViewManagerServiceImpl* connection_with_node_as_root =
- root_node_manager_->GetConnectionWithRoot(node_id);
- if ((connection_by_url != connection_with_node_as_root ||
- (!connection_by_url && !connection_with_node_as_root)) &&
- (!connection_by_url || !connection_by_url->HasRoot(node_id))) {
- RootNodeManager::ScopedChange change(this, root_node_manager_, true);
- RemoveChildrenAsPartOfEmbed(node_id);
- // Never message the originating connection.
- root_node_manager_->OnConnectionMessagedClient(id_);
- if (connection_with_node_as_root)
- connection_with_node_as_root->RemoveRoot(node_id);
- if (connection_by_url) {
- connection_by_url->AddRoot(node_id, spir.Pass());
- } else {
- root_node_manager_->Embed(id_, url, transport_view_id, spir.Pass());
- }
- } else {
- success = false;
- }
+ if (!node && access_policy_->CanEmbed(node)) {
+ callback.Run(false);
+ return;
}
- callback.Run(success);
+
+ // Only allow a node to be the root for one connection.
+ const NodeId node_id(NodeIdFromTransportId(transport_view_id));
+ ViewManagerServiceImpl* existing_owner =
+ root_node_manager_->GetConnectionWithRoot(node_id);
+
+ RootNodeManager::ScopedChange change(this, root_node_manager_, true);
+ if (existing_owner) {
+ RemoveChildrenAsPartOfEmbed(node_id);
+ // Never message the originating connection.
+ root_node_manager_->OnConnectionMessagedClient(id_);
+ existing_owner->RemoveRoot(node_id);
+ }
+ root_node_manager_->Embed(id_, url, transport_view_id, spir.Pass());
+ callback.Run(true);
}
void ViewManagerServiceImpl::DispatchOnViewInputEvent(Id transport_view_id,
« no previous file with comments | « mojo/services/view_manager/root_node_manager.cc ('k') | mojo/services/view_manager/view_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698