Chromium Code Reviews| Index: components/nacl/browser/nacl_broker_host_win.cc |
| diff --git a/components/nacl/browser/nacl_broker_host_win.cc b/components/nacl/browser/nacl_broker_host_win.cc |
| index 3aa98862384a5509791596523bed9441fc8e5f68..b0fb82dae5c3ac7dced49401f88eb420cc95d1d2 100644 |
| --- a/components/nacl/browser/nacl_broker_host_win.cc |
| +++ b/components/nacl/browser/nacl_broker_host_win.cc |
| @@ -17,8 +17,10 @@ |
| #include "content/public/browser/child_process_data.h" |
| #include "content/public/common/child_process_host.h" |
| #include "content/public/common/content_switches.h" |
| +#include "content/public/common/mojo_channel_switches.h" |
| #include "content/public/common/sandboxed_process_launcher_delegate.h" |
| #include "ipc/ipc_switches.h" |
| +#include "mojo/edk/embedder/embedder.h" |
| namespace { |
| // NOTE: changes to this class need to be reviewed by the security team. |
| @@ -39,9 +41,12 @@ class NaClBrokerSandboxedProcessLauncherDelegate |
| namespace nacl { |
| -NaClBrokerHost::NaClBrokerHost() : is_terminating_(false) { |
| +NaClBrokerHost::NaClBrokerHost() |
| + : is_terminating_(false), |
| + mojo_child_token_(mojo::edk::GenerateRandomToken()) { |
| process_.reset(content::BrowserChildProcessHost::Create( |
|
Mark Seaborn
2016/07/08 20:26:19
It looks like this Create() call could be moved in
Anand Mistry (off Chromium)
2016/07/12 07:26:23
Done.
|
| - static_cast<content::ProcessType>(PROCESS_TYPE_NACL_BROKER), this)); |
| + static_cast<content::ProcessType>(PROCESS_TYPE_NACL_BROKER), this, |
| + mojo_child_token_)); |
| } |
| NaClBrokerHost::~NaClBrokerHost() { |
| @@ -49,8 +54,9 @@ NaClBrokerHost::~NaClBrokerHost() { |
| bool NaClBrokerHost::Init() { |
| // Create the channel that will be used for communicating with the broker. |
| - std::string channel_id = process_->GetHost()->CreateChannel(); |
| - if (channel_id.empty()) |
| + std::string mojo_channel_token = |
| + process_->GetHost()->CreateChannelMojo(mojo_child_token_); |
| + if (mojo_channel_token.empty()) |
| return false; |
| // Create the path to the nacl broker/loader executable. |
| @@ -63,7 +69,7 @@ bool NaClBrokerHost::Init() { |
| cmd_line->AppendSwitchASCII(switches::kProcessType, |
| switches::kNaClBrokerProcess); |
| - cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); |
| + cmd_line->AppendSwitchASCII(switches::kMojoChannelToken, mojo_channel_token); |
| if (NaClBrowser::GetDelegate()->DialogsAreSuppressed()) |
| cmd_line->AppendSwitch(switches::kNoErrorDialogs); |