Index: content/child/child_thread_impl.cc |
diff --git a/content/child/child_thread_impl.cc b/content/child/child_thread_impl.cc |
index abff09fea9eae1e11182a43a6de4915aa278a628..184c32956f52ea61f8112529131ed5cdc9fb5ab4 100644 |
--- a/content/child/child_thread_impl.cc |
+++ b/content/child/child_thread_impl.cc |
@@ -41,7 +41,6 @@ |
#include "content/child/fileapi/file_system_dispatcher.h" |
#include "content/child/fileapi/webfilesystem_impl.h" |
#include "content/child/memory/child_memory_message_filter.h" |
-#include "content/child/mojo/mojo_application.h" |
#include "content/child/notifications/notification_dispatcher.h" |
#include "content/child/power_monitor_broadcast_source.h" |
#include "content/child/push_messaging/push_dispatcher.h" |
@@ -54,9 +53,9 @@ |
#include "content/child/websocket_message_filter.h" |
#include "content/common/child_process_messages.h" |
#include "content/common/in_process_child_thread_params.h" |
-#include "content/common/mojo/mojo_shell_connection_impl.h" |
#include "content/public/common/content_switches.h" |
#include "content/public/common/mojo_channel_switches.h" |
+#include "content/public/common/mojo_shell_connection.h" |
#include "ipc/attachment_broker.h" |
#include "ipc/attachment_broker_unprivileged.h" |
#include "ipc/ipc_channel_mojo.h" |
@@ -401,12 +400,6 @@ void ChildThreadImpl::Init(const Options& options) { |
mojo_ipc_support_.reset(new mojo::edk::ScopedIPCSupport(GetIOTaskRunner())); |
InitializeMojoIPCChannel(); |
} |
- if (shell::ShellIsRemote()) { |
- MojoShellConnection::SetForProcess( |
- MojoShellConnection::Create( |
- shell::GetShellClientRequestFromCommandLine())); |
- } |
- mojo_application_.reset(new MojoApplication()); |
std::string mojo_application_token; |
if (!IsInBrowserProcess()) { |
mojo_application_token = |
@@ -415,8 +408,12 @@ void ChildThreadImpl::Init(const Options& options) { |
} else { |
mojo_application_token = options.in_process_application_token; |
} |
- if (!mojo_application_token.empty()) |
- mojo_application_->InitWithToken(mojo_application_token); |
+ mojo::ScopedMessagePipeHandle handle = |
+ mojo::edk::CreateChildMessagePipe(mojo_application_token); |
+ DCHECK(handle.is_valid()); |
+ mojo_shell_connection_ = MojoShellConnection::Create( |
+ mojo::MakeRequest<shell::mojom::ShellClient>(std::move(handle))); |
+ mojo_shell_connection_->AddEmbeddedShellClient(this); |
sync_message_filter_ = channel_->CreateSyncMessageFilter(); |
thread_safe_sender_ = new ThreadSafeSender( |
@@ -593,6 +590,30 @@ void ChildThreadImpl::RecordComputedAction(const std::string& action) { |
NOTREACHED(); |
} |
+MojoShellConnection* ChildThreadImpl::GetMojoShellConnection() { |
+ return mojo_shell_connection_.get(); |
+} |
+ |
+shell::InterfaceRegistry* ChildThreadImpl::GetInterfaceRegistry() { |
+ if (!interface_registry_.get()) |
+ interface_registry_.reset(new shell::InterfaceRegistry(nullptr)); |
+ return interface_registry_.get(); |
+} |
+ |
+shell::InterfaceProvider* ChildThreadImpl::GetRemoteInterfaces() { |
+ if (!remote_interfaces_.get()) |
+ remote_interfaces_.reset(new shell::InterfaceProvider); |
+ return remote_interfaces_.get(); |
+} |
+ |
+shell::InterfaceRegistry* ChildThreadImpl::GetInterfaceRegistryForConnection() { |
+ return GetInterfaceRegistry(); |
+} |
+ |
+shell::InterfaceProvider* ChildThreadImpl::GetInterfaceProviderForConnection() { |
+ return GetRemoteInterfaces(); |
+} |
+ |
IPC::MessageRouter* ChildThreadImpl::GetRouter() { |
DCHECK(base::MessageLoop::current() == message_loop()); |
return &router_; |