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_browser.h" |
12 #include "chrome/common/chrome_constants.h" | |
13 #include "chrome/common/chrome_process_type.h" | 12 #include "chrome/common/chrome_process_type.h" |
14 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
15 #include "chrome/common/logging_chrome.h" | 14 #include "chrome/common/logging_chrome.h" |
16 #include "chrome/common/nacl_cmd_line.h" | 15 #include "chrome/common/nacl_cmd_line.h" |
17 #include "chrome/common/nacl_messages.h" | 16 #include "chrome/common/nacl_messages.h" |
18 #include "content/public/browser/browser_child_process_host.h" | 17 #include "content/public/browser/browser_child_process_host.h" |
19 #include "content/public/browser/child_process_data.h" | 18 #include "content/public/browser/child_process_data.h" |
20 #include "content/public/common/child_process_host.h" | 19 #include "content/public/common/child_process_host.h" |
21 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 20 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
22 | 21 |
(...skipping 22 matching lines...) Expand all Loading... |
45 NaClBrokerHost::~NaClBrokerHost() { | 44 NaClBrokerHost::~NaClBrokerHost() { |
46 } | 45 } |
47 | 46 |
48 bool NaClBrokerHost::Init() { | 47 bool NaClBrokerHost::Init() { |
49 // Create the channel that will be used for communicating with the broker. | 48 // Create the channel that will be used for communicating with the broker. |
50 std::string channel_id = process_->GetHost()->CreateChannel(); | 49 std::string channel_id = process_->GetHost()->CreateChannel(); |
51 if (channel_id.empty()) | 50 if (channel_id.empty()) |
52 return false; | 51 return false; |
53 | 52 |
54 // Create the path to the nacl broker/loader executable. | 53 // Create the path to the nacl broker/loader executable. |
55 base::FilePath module_path; | 54 base::FilePath nacl_path; |
56 if (!PathService::Get(base::FILE_MODULE, &module_path)) | 55 if (!NaClBrowser::GetInstance()->GetNaCl64ExePath(&nacl_path)) |
57 return false; | 56 return false; |
58 | 57 |
59 base::FilePath nacl_path = module_path.DirName().Append(chrome::kNaClAppName); | |
60 CommandLine* cmd_line = new CommandLine(nacl_path); | 58 CommandLine* cmd_line = new CommandLine(nacl_path); |
61 nacl::CopyNaClCommandLineArguments(cmd_line); | 59 nacl::CopyNaClCommandLineArguments(cmd_line); |
62 | 60 |
63 cmd_line->AppendSwitchASCII(switches::kProcessType, | 61 cmd_line->AppendSwitchASCII(switches::kProcessType, |
64 switches::kNaClBrokerProcess); | 62 switches::kNaClBrokerProcess); |
65 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); | 63 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); |
66 if (logging::DialogsAreSuppressed()) | 64 if (logging::DialogsAreSuppressed()) |
67 cmd_line->AppendSwitch(switches::kNoErrorDialogs); | 65 cmd_line->AppendSwitch(switches::kNoErrorDialogs); |
68 | 66 |
69 process_->Launch(new NaClBrokerSandboxedProcessLauncherDelegate, cmd_line); | 67 process_->Launch(new NaClBrokerSandboxedProcessLauncherDelegate, cmd_line); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 104 |
107 void NaClBrokerHost::OnDebugExceptionHandlerLaunched(int32 pid, bool success) { | 105 void NaClBrokerHost::OnDebugExceptionHandlerLaunched(int32 pid, bool success) { |
108 NaClBrokerService::GetInstance()->OnDebugExceptionHandlerLaunched(pid, | 106 NaClBrokerService::GetInstance()->OnDebugExceptionHandlerLaunched(pid, |
109 success); | 107 success); |
110 } | 108 } |
111 | 109 |
112 void NaClBrokerHost::StopBroker() { | 110 void NaClBrokerHost::StopBroker() { |
113 is_terminating_ = true; | 111 is_terminating_ = true; |
114 process_->Send(new NaClProcessMsg_StopBroker()); | 112 process_->Send(new NaClProcessMsg_StopBroker()); |
115 } | 113 } |
OLD | NEW |