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

Unified Diff: mojo/services/public/cpp/view_manager/lib/node.cc

Issue 433513005: Pass ServiceProvider thru ViewManagerService::Embed() allowing embedder & embeddee to expose servic… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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/public/cpp/view_manager/lib/node.cc
diff --git a/mojo/services/public/cpp/view_manager/lib/node.cc b/mojo/services/public/cpp/view_manager/lib/node.cc
index 738a5be97c4750e9f6db3e5e53282d1cc65e7297..ccaf8907b8ce07f7689e00a056f53e98b1a2b837 100644
--- a/mojo/services/public/cpp/view_manager/lib/node.cc
+++ b/mojo/services/public/cpp/view_manager/lib/node.cc
@@ -4,6 +4,7 @@
#include "mojo/services/public/cpp/view_manager/node.h"
+#include "mojo/public/cpp/application/exported_service_registry.h"
#include "mojo/services/public/cpp/view_manager/lib/node_private.h"
#include "mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h"
#include "mojo/services/public/cpp/view_manager/lib/view_private.h"
@@ -336,6 +337,24 @@ void Node::Embed(const String& url) {
static_cast<ViewManagerClientImpl*>(manager_)->Embed(url, id_);
}
+scoped_ptr<ServiceProvider>
+ Node::Embed(const String& url,
+ scoped_ptr<ExportedServiceRegistry> exported_services) {
+ scoped_ptr<ServiceProvider> imported_services;
+ // BindToProxy() takes ownership of |exported_services|.
+ ExportedServiceRegistry* registry = exported_services.release();
+ ServiceProviderPtr sp;
+ if (registry) {
+ BindToProxy(registry, &sp);
+ RemoteServiceProvider* remote =
+ new RemoteServiceProvider(registry->client());
+ registry->set_remote(remote);
+ imported_services.reset(remote);
+ }
+ static_cast<ViewManagerClientImpl*>(manager_)->Embed(url, id_, sp.Pass());
+ return imported_services.Pass();
+}
+
////////////////////////////////////////////////////////////////////////////////
// Node, protected:

Powered by Google App Engine
This is Rietveld 408576698