Index: content/child/mojo/mojo_application.cc |
diff --git a/content/child/mojo/mojo_application.cc b/content/child/mojo/mojo_application.cc |
index cd369d3d541e95437d3f0a4fc197adde0138ece7..0864424b94070799f4514b23e80a82fbb5bf5db7 100644 |
--- a/content/child/mojo/mojo_application.cc |
+++ b/content/child/mojo/mojo_application.cc |
@@ -12,6 +12,7 @@ |
#include "content/common/mojo/channel_init.h" |
#include "content/common/mojo/mojo_messages.h" |
#include "ipc/ipc_message.h" |
+#include "mojo/edk/embedder/embedder.h" |
#include "mojo/public/cpp/bindings/interface_ptr.h" |
namespace content { |
@@ -34,6 +35,23 @@ bool MojoApplication::OnMessageReceived(const IPC::Message& msg) { |
return handled; |
} |
+void MojoApplication::InitWithToken(std::string token) { |
+ mojo::ScopedMessagePipeHandle handle = |
+ mojo::edk::CreateChildMessagePipe(token); |
+ DCHECK(handle.is_valid()); |
+ |
+ mojom::ApplicationSetupPtr application_setup; |
+ application_setup.Bind( |
+ mojo::InterfacePtrInfo<mojom::ApplicationSetup>(std::move(handle), 0u)); |
+ |
+ mojo::shell::mojom::InterfaceProviderPtr services; |
+ mojo::shell::mojom::InterfaceProviderPtr exposed_services; |
+ service_registry_.Bind(GetProxy(&exposed_services)); |
+ application_setup->ExchangeInterfaceProviders(GetProxy(&services), |
+ std::move(exposed_services)); |
+ service_registry_.BindRemoteServiceProvider(std::move(services)); |
+} |
+ |
void MojoApplication::OnActivate( |
const IPC::PlatformFileForTransit& file) { |
#if defined(OS_POSIX) |