Index: components/nacl/renderer/trusted_plugin_channel.cc |
diff --git a/components/nacl/renderer/trusted_plugin_channel.cc b/components/nacl/renderer/trusted_plugin_channel.cc |
index 1cfef1777cdc5c3666a6bd60bbbb6aaa0c78e22c..bf47f0e940cd5aadf5fc6eb5d6556058a8bb1d96 100644 |
--- a/components/nacl/renderer/trusted_plugin_channel.cc |
+++ b/components/nacl/renderer/trusted_plugin_channel.cc |
@@ -5,56 +5,43 @@ |
#include "components/nacl/renderer/trusted_plugin_channel.h" |
#include "base/callback_helpers.h" |
-#include "components/nacl/common/nacl_renderer_messages.h" |
#include "components/nacl/renderer/histogram.h" |
#include "components/nacl/renderer/nexe_load_manager.h" |
-#include "content/public/renderer/render_thread.h" |
-#include "ipc/ipc_sync_channel.h" |
-#include "ipc/ipc_message_macros.h" |
#include "ppapi/c/pp_errors.h" |
namespace nacl { |
TrustedPluginChannel::TrustedPluginChannel( |
NexeLoadManager* nexe_load_manager, |
- const IPC::ChannelHandle& handle, |
- base::WaitableEvent* shutdown_event, |
+ mojom::NaClRendererHostRequest request, |
bool is_helper_nexe) |
: nexe_load_manager_(nexe_load_manager), |
+ binding_(this, std::move(request)), |
is_helper_nexe_(is_helper_nexe) { |
- channel_ = IPC::SyncChannel::Create( |
- handle, IPC::Channel::MODE_CLIENT, this, |
- content::RenderThread::Get()->GetIOTaskRunner(), true, shutdown_event); |
+ binding_.set_connection_error_handler(base::Bind( |
+ &TrustedPluginChannel::OnChannelError, base::Unretained(this))); |
} |
TrustedPluginChannel::~TrustedPluginChannel() { |
} |
-bool TrustedPluginChannel::Send(IPC::Message* message) { |
- return channel_->Send(message); |
-} |
- |
-bool TrustedPluginChannel::OnMessageReceived(const IPC::Message& msg) { |
- bool handled = true; |
- IPC_BEGIN_MESSAGE_MAP(TrustedPluginChannel, msg) |
- IPC_MESSAGE_HANDLER(NaClRendererMsg_ReportExitStatus, OnReportExitStatus); |
- IPC_MESSAGE_HANDLER(NaClRendererMsg_ReportLoadStatus, OnReportLoadStatus); |
- IPC_MESSAGE_UNHANDLED(handled = false) |
- IPC_END_MESSAGE_MAP() |
- return handled; |
-} |
- |
void TrustedPluginChannel::OnChannelError() { |
if (!is_helper_nexe_) |
nexe_load_manager_->NexeDidCrash(); |
} |
-void TrustedPluginChannel::OnReportExitStatus(int exit_status) { |
+void TrustedPluginChannel::ReportExitStatus( |
+ int exit_status, |
+ const ReportExitStatusCallback& callback) { |
+ callback.Run(); |
if (!is_helper_nexe_) |
nexe_load_manager_->set_exit_status(exit_status); |
} |
-void TrustedPluginChannel::OnReportLoadStatus(NaClErrorCode load_status) { |
+void TrustedPluginChannel::ReportLoadStatus( |
+ NaClErrorCode load_status, |
+ const ReportLoadStatusCallback& callback) { |
+ callback.Run(); |
if (load_status < 0 || load_status > NACL_ERROR_CODE_MAX) { |
load_status = LOAD_STATUS_UNKNOWN; |
} |
@@ -75,4 +62,9 @@ void TrustedPluginChannel::OnReportLoadStatus(NaClErrorCode load_status) { |
} |
} |
+void TrustedPluginChannel::ProvideExitControl( |
+ mojom::NaClExitControlPtr exit_control) { |
+ exit_control_ = std::move(exit_control); |
+} |
+ |
} // namespace nacl |