| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/nacl/browser/nacl_broker_host_win.h" | 5 #include "components/nacl/browser/nacl_broker_host_win.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" |
| 10 #include "components/nacl/browser/nacl_broker_service_win.h" | 11 #include "components/nacl/browser/nacl_broker_service_win.h" |
| 11 #include "components/nacl/browser/nacl_browser.h" | 12 #include "components/nacl/browser/nacl_browser.h" |
| 12 #include "components/nacl/common/nacl_cmd_line.h" | 13 #include "components/nacl/common/nacl_cmd_line.h" |
| 13 #include "components/nacl/common/nacl_constants.h" | 14 #include "components/nacl/common/nacl_constants.h" |
| 14 #include "components/nacl/common/nacl_messages.h" | 15 #include "components/nacl/common/nacl_messages.h" |
| 15 #include "components/nacl/common/nacl_process_type.h" | 16 #include "components/nacl/common/nacl_process_type.h" |
| 16 #include "components/nacl/common/nacl_switches.h" | 17 #include "components/nacl/common/nacl_switches.h" |
| 17 #include "content/public/browser/browser_child_process_host.h" | 18 #include "content/public/browser/browser_child_process_host.h" |
| 18 #include "content/public/browser/child_process_data.h" | 19 #include "content/public/browser/child_process_data.h" |
| 19 #include "content/public/common/child_process_host.h" | 20 #include "content/public/common/child_process_host.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 return false; | 62 return false; |
| 62 | 63 |
| 63 base::CommandLine* cmd_line = new base::CommandLine(nacl_path); | 64 base::CommandLine* cmd_line = new base::CommandLine(nacl_path); |
| 64 CopyNaClCommandLineArguments(cmd_line); | 65 CopyNaClCommandLineArguments(cmd_line); |
| 65 | 66 |
| 66 cmd_line->AppendSwitchASCII(switches::kProcessType, | 67 cmd_line->AppendSwitchASCII(switches::kProcessType, |
| 67 switches::kNaClBrokerProcess); | 68 switches::kNaClBrokerProcess); |
| 68 if (NaClBrowser::GetDelegate()->DialogsAreSuppressed()) | 69 if (NaClBrowser::GetDelegate()->DialogsAreSuppressed()) |
| 69 cmd_line->AppendSwitch(switches::kNoErrorDialogs); | 70 cmd_line->AppendSwitch(switches::kNoErrorDialogs); |
| 70 | 71 |
| 71 process_->Launch(new NaClBrokerSandboxedProcessLauncherDelegate, cmd_line, | 72 process_->Launch( |
| 72 true); | 73 base::MakeUnique<NaClBrokerSandboxedProcessLauncherDelegate>(), |
| 74 base::WrapUnique(cmd_line), |
| 75 true); |
| 73 return true; | 76 return true; |
| 74 } | 77 } |
| 75 | 78 |
| 76 bool NaClBrokerHost::OnMessageReceived(const IPC::Message& msg) { | 79 bool NaClBrokerHost::OnMessageReceived(const IPC::Message& msg) { |
| 77 bool handled = true; | 80 bool handled = true; |
| 78 IPC_BEGIN_MESSAGE_MAP(NaClBrokerHost, msg) | 81 IPC_BEGIN_MESSAGE_MAP(NaClBrokerHost, msg) |
| 79 IPC_MESSAGE_HANDLER(NaClProcessMsg_LoaderLaunched, OnLoaderLaunched) | 82 IPC_MESSAGE_HANDLER(NaClProcessMsg_LoaderLaunched, OnLoaderLaunched) |
| 80 IPC_MESSAGE_HANDLER(NaClProcessMsg_DebugExceptionHandlerLaunched, | 83 IPC_MESSAGE_HANDLER(NaClProcessMsg_DebugExceptionHandlerLaunched, |
| 81 OnDebugExceptionHandlerLaunched) | 84 OnDebugExceptionHandlerLaunched) |
| 82 IPC_MESSAGE_UNHANDLED(handled = false) | 85 IPC_MESSAGE_UNHANDLED(handled = false) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 NaClBrokerService::GetInstance()->OnDebugExceptionHandlerLaunched(pid, | 117 NaClBrokerService::GetInstance()->OnDebugExceptionHandlerLaunched(pid, |
| 115 success); | 118 success); |
| 116 } | 119 } |
| 117 | 120 |
| 118 void NaClBrokerHost::StopBroker() { | 121 void NaClBrokerHost::StopBroker() { |
| 119 is_terminating_ = true; | 122 is_terminating_ = true; |
| 120 process_->Send(new NaClProcessMsg_StopBroker()); | 123 process_->Send(new NaClProcessMsg_StopBroker()); |
| 121 } | 124 } |
| 122 | 125 |
| 123 } // namespace nacl | 126 } // namespace nacl |
| OLD | NEW |