OLD | NEW |
---|---|
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/logging.h" | |
9 | |
8 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
9 | 11 |
10 void SandboxInitWrapper::SetServices(sandbox::SandboxInterfaceInfo* info) { | 12 void SandboxInitWrapper::SetServices(sandbox::SandboxInterfaceInfo* info) { |
11 if (info) { | 13 if (info) { |
12 broker_services_ = info->broker_services; | 14 broker_services_ = info->broker_services; |
13 target_services_ = info->target_services; | 15 target_services_ = info->target_services; |
14 } | 16 } |
17 // Both interface pointers cannot be non-zero. A process can either | |
18 // be a target or a broker both not both. | |
19 DCHECK(!(target_services_ && broker_services_)); | |
15 } | 20 } |
16 | 21 |
17 bool SandboxInitWrapper::InitializeSandbox(const CommandLine& command_line, | 22 bool SandboxInitWrapper::InitializeSandbox(const CommandLine& command_line, |
18 const std::string& process_type) { | 23 const std::string& process_type) { |
19 if (command_line.HasSwitch(switches::kNoSandbox)) | 24 if (command_line.HasSwitch(switches::kNoSandbox)) |
20 return true; | 25 return true; |
21 if ((process_type == switches::kRendererProcess) || | 26 if ((process_type == switches::kRendererProcess) || |
22 (process_type == switches::kExtensionProcess) || | 27 (process_type == switches::kExtensionProcess) || |
23 (process_type == switches::kWorkerProcess) || | 28 (process_type == switches::kWorkerProcess) || |
24 (process_type == switches::kNaClLoaderProcess) || | 29 (process_type == switches::kNaClLoaderProcess) || |
25 (process_type == switches::kUtilityProcess) || | 30 (process_type == switches::kUtilityProcess) || |
26 (process_type == switches::kPluginProcess && | 31 (process_type == switches::kPluginProcess)) { |
27 command_line.HasSwitch(switches::kSafePlugins))) { | 32 if (target_services_) |
28 if (!target_services_) | 33 return (sandbox::SBOX_ALL_OK == target_services_->Init()); |
rvargas (doing something else)
2011/02/10 00:23:43
Are you counting on other parts of the code to pro
cpu_(ooo_6.6-7.5)
2011/02/10 18:50:51
InitializeSandbox() is called regardless of what p
| |
29 return false; | |
30 target_services_->Init(); | |
31 } | 34 } |
32 return true; | 35 return true; |
33 } | 36 } |
OLD | NEW |