OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/common/sandbox_init_wrapper.h" | 5 #include "chrome/common/sandbox_init_wrapper.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
9 | 9 |
10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
11 | 11 |
12 void SandboxInitWrapper::SetServices(sandbox::SandboxInterfaceInfo* info) { | 12 void SandboxInitWrapper::SetServices(sandbox::SandboxInterfaceInfo* info) { |
13 if (info) { | 13 if (info) { |
14 broker_services_ = info->broker_services; | 14 broker_services_ = info->broker_services; |
15 target_services_ = info->target_services; | 15 target_services_ = info->target_services; |
16 } | 16 } |
17 } | 17 } |
18 | 18 |
19 #endif | 19 #endif |
20 | 20 |
21 void SandboxInitWrapper::InitializeSandbox(const CommandLine& command_line, | 21 void SandboxInitWrapper::InitializeSandbox(const CommandLine& command_line, |
22 const std::wstring& process_type) { | 22 const std::string& process_type) { |
23 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
24 if (!target_services_) | 24 if (!target_services_) |
25 return; | 25 return; |
26 #endif | 26 #endif |
27 if (!command_line.HasSwitch(switches::kNoSandbox)) { | 27 if (!command_line.HasSwitch(switches::kNoSandbox)) { |
28 if ((process_type == switches::kRendererProcess) || | 28 if ((process_type == switches::kRendererProcess) || |
29 (process_type == switches::kWorkerProcess) || | 29 (process_type == switches::kWorkerProcess) || |
30 (process_type == switches::kNaClProcess) || | 30 (process_type == switches::kNaClProcess) || |
31 (process_type == switches::kUtilityProcess) || | 31 (process_type == switches::kUtilityProcess) || |
32 (process_type == switches::kPluginProcess && | 32 (process_type == switches::kPluginProcess && |
33 command_line.HasSwitch(switches::kSafePlugins))) { | 33 command_line.HasSwitch(switches::kSafePlugins))) { |
34 #if defined(OS_WIN) | 34 #if defined(OS_WIN) |
35 target_services_->Init(); | 35 target_services_->Init(); |
36 #elif defined(OS_MACOSX) | 36 #elif defined(OS_MACOSX) |
37 // We just cache the process type so we can configure the sandbox | 37 // We just cache the process type so we can configure the sandbox |
38 // correctly, see renderer_main_platform_delegate_mac.cc for one of those | 38 // correctly, see renderer_main_platform_delegate_mac.cc for one of those |
39 // places. | 39 // places. |
40 process_type_ = process_type; | 40 process_type_ = process_type; |
41 #endif | 41 #endif |
42 } | 42 } |
43 } | 43 } |
44 } | 44 } |
OLD | NEW |