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_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
14 #include "chrome/common/logging_chrome.h" | 15 #include "chrome/common/logging_chrome.h" |
15 #include "chrome/common/nacl_cmd_line.h" | 16 #include "chrome/common/nacl_cmd_line.h" |
16 #include "chrome/common/nacl_messages.h" | 17 #include "chrome/common/nacl_messages.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" |
20 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 21 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
21 | 22 |
22 namespace { | 23 namespace { |
23 // NOTE: changes to this class need to be reviewed by the security team. | 24 // NOTE: changes to this class need to be reviewed by the security team. |
24 class NaClBrokerSandboxedProcessLauncherDelegate | 25 class NaClBrokerSandboxedProcessLauncherDelegate |
25 : public content::SandboxedProcessLauncherDelegate { | 26 : public content::SandboxedProcessLauncherDelegate { |
26 public: | 27 public: |
27 NaClBrokerSandboxedProcessLauncherDelegate() {} | 28 NaClBrokerSandboxedProcessLauncherDelegate() {} |
28 virtual ~NaClBrokerSandboxedProcessLauncherDelegate() {} | 29 virtual ~NaClBrokerSandboxedProcessLauncherDelegate() {} |
29 | 30 |
30 virtual void ShouldSandbox(bool* in_sandbox) OVERRIDE { | 31 virtual void ShouldSandbox(bool* in_sandbox) OVERRIDE { |
31 *in_sandbox = false; | 32 *in_sandbox = false; |
32 } | 33 } |
33 | 34 |
34 private: | 35 private: |
35 DISALLOW_COPY_AND_ASSIGN(NaClBrokerSandboxedProcessLauncherDelegate); | 36 DISALLOW_COPY_AND_ASSIGN(NaClBrokerSandboxedProcessLauncherDelegate); |
36 }; | 37 }; |
37 } // namespace | 38 } // namespace |
38 | 39 |
39 NaClBrokerHost::NaClBrokerHost() : is_terminating_(false) { | 40 NaClBrokerHost::NaClBrokerHost() : is_terminating_(false) { |
40 process_.reset(content::BrowserChildProcessHost::Create( | 41 process_.reset(content::BrowserChildProcessHost::Create( |
41 content::PROCESS_TYPE_NACL_BROKER, this)); | 42 PROCESS_TYPE_NACL_BROKER, this)); |
42 } | 43 } |
43 | 44 |
44 NaClBrokerHost::~NaClBrokerHost() { | 45 NaClBrokerHost::~NaClBrokerHost() { |
45 } | 46 } |
46 | 47 |
47 bool NaClBrokerHost::Init() { | 48 bool NaClBrokerHost::Init() { |
48 // Create the channel that will be used for communicating with the broker. | 49 // Create the channel that will be used for communicating with the broker. |
49 std::string channel_id = process_->GetHost()->CreateChannel(); | 50 std::string channel_id = process_->GetHost()->CreateChannel(); |
50 if (channel_id.empty()) | 51 if (channel_id.empty()) |
51 return false; | 52 return false; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 106 |
106 void NaClBrokerHost::OnDebugExceptionHandlerLaunched(int32 pid, bool success) { | 107 void NaClBrokerHost::OnDebugExceptionHandlerLaunched(int32 pid, bool success) { |
107 NaClBrokerService::GetInstance()->OnDebugExceptionHandlerLaunched(pid, | 108 NaClBrokerService::GetInstance()->OnDebugExceptionHandlerLaunched(pid, |
108 success); | 109 success); |
109 } | 110 } |
110 | 111 |
111 void NaClBrokerHost::StopBroker() { | 112 void NaClBrokerHost::StopBroker() { |
112 is_terminating_ = true; | 113 is_terminating_ = true; |
113 process_->Send(new NaClProcessMsg_StopBroker()); | 114 process_->Send(new NaClProcessMsg_StopBroker()); |
114 } | 115 } |
OLD | NEW |