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 "chrome/browser/nacl_host/nacl_broker_host_win.h" | 5 #include "chrome/browser/nacl_host/nacl_broker_host_win.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "ipc/ipc_switches.h" | 9 #include "ipc/ipc_switches.h" |
10 #include "chrome/browser/nacl_host/nacl_broker_service_win.h" | 10 #include "chrome/browser/nacl_host/nacl_broker_service_win.h" |
11 #include "chrome/browser/nacl_host/nacl_process_host.h" | 11 #include "chrome/browser/nacl_host/nacl_process_host.h" |
12 #include "chrome/common/chrome_constants.h" | 12 #include "chrome/common/chrome_constants.h" |
13 #include "chrome/common/chrome_process_type.h" | 13 #include "chrome/common/chrome_process_type.h" |
14 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
15 #include "chrome/common/logging_chrome.h" | 15 #include "chrome/common/logging_chrome.h" |
16 #include "chrome/common/nacl_cmd_line.h" | 16 #include "components/nacl/common/nacl_delegate.h" |
17 #include "chrome/common/nacl_messages.h" | 17 #include "components/nacl/common/nacl_messages.h" |
| 18 #include "components/nacl/common/nacl_switches.h" |
18 #include "content/public/browser/browser_child_process_host.h" | 19 #include "content/public/browser/browser_child_process_host.h" |
19 #include "content/public/browser/child_process_data.h" | 20 #include "content/public/browser/child_process_data.h" |
20 #include "content/public/common/child_process_host.h" | 21 #include "content/public/common/child_process_host.h" |
21 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 22 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
22 | 23 |
23 namespace { | 24 namespace { |
24 // NOTE: changes to this class need to be reviewed by the security team. | 25 // NOTE: changes to this class need to be reviewed by the security team. |
25 class NaClBrokerSandboxedProcessLauncherDelegate | 26 class NaClBrokerSandboxedProcessLauncherDelegate |
26 : public content::SandboxedProcessLauncherDelegate { | 27 : public content::SandboxedProcessLauncherDelegate { |
27 public: | 28 public: |
(...skipping 23 matching lines...) Expand all Loading... |
51 if (channel_id.empty()) | 52 if (channel_id.empty()) |
52 return false; | 53 return false; |
53 | 54 |
54 // Create the path to the nacl broker/loader executable. | 55 // Create the path to the nacl broker/loader executable. |
55 base::FilePath module_path; | 56 base::FilePath module_path; |
56 if (!PathService::Get(base::FILE_MODULE, &module_path)) | 57 if (!PathService::Get(base::FILE_MODULE, &module_path)) |
57 return false; | 58 return false; |
58 | 59 |
59 base::FilePath nacl_path = module_path.DirName().Append(chrome::kNaClAppName); | 60 base::FilePath nacl_path = module_path.DirName().Append(chrome::kNaClAppName); |
60 CommandLine* cmd_line = new CommandLine(nacl_path); | 61 CommandLine* cmd_line = new CommandLine(nacl_path); |
61 nacl::CopyNaClCommandLineArguments(cmd_line); | 62 GetNaClDelegate()->CopyNaClCommandLineArguments(cmd_line); |
62 | 63 |
63 cmd_line->AppendSwitchASCII(switches::kProcessType, | 64 cmd_line->AppendSwitchASCII(switches::kProcessType, |
64 switches::kNaClBrokerProcess); | 65 switches::kNaClBrokerProcess); |
65 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); | 66 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); |
66 if (logging::DialogsAreSuppressed()) | 67 if (logging::DialogsAreSuppressed()) |
67 cmd_line->AppendSwitch(switches::kNoErrorDialogs); | 68 cmd_line->AppendSwitch(switches::kNoErrorDialogs); |
68 | 69 |
69 process_->Launch(new NaClBrokerSandboxedProcessLauncherDelegate, cmd_line); | 70 process_->Launch(new NaClBrokerSandboxedProcessLauncherDelegate, cmd_line); |
70 return true; | 71 return true; |
71 } | 72 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 107 |
107 void NaClBrokerHost::OnDebugExceptionHandlerLaunched(int32 pid, bool success) { | 108 void NaClBrokerHost::OnDebugExceptionHandlerLaunched(int32 pid, bool success) { |
108 NaClBrokerService::GetInstance()->OnDebugExceptionHandlerLaunched(pid, | 109 NaClBrokerService::GetInstance()->OnDebugExceptionHandlerLaunched(pid, |
109 success); | 110 success); |
110 } | 111 } |
111 | 112 |
112 void NaClBrokerHost::StopBroker() { | 113 void NaClBrokerHost::StopBroker() { |
113 is_terminating_ = true; | 114 is_terminating_ = true; |
114 process_->Send(new NaClProcessMsg_StopBroker()); | 115 process_->Send(new NaClProcessMsg_StopBroker()); |
115 } | 116 } |
OLD | NEW |