OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/common/sandbox_init_wrapper.h" |
| 6 |
| 7 #include "base/command_line.h" |
| 8 #include "chrome/common/chrome_switches.h" |
| 9 |
| 10 void SandboxInitWrapper::SetServices(sandbox::SandboxInterfaceInfo* info) { |
| 11 if (info) { |
| 12 broker_services_ = info->broker_services; |
| 13 target_services_ = info->target_services; |
| 14 } |
| 15 } |
| 16 |
| 17 bool SandboxInitWrapper::InitializeSandbox(const CommandLine& command_line, |
| 18 const std::string& process_type) { |
| 19 if (command_line.HasSwitch(switches::kNoSandbox)) |
| 20 return true; |
| 21 if ((process_type == switches::kRendererProcess) || |
| 22 (process_type == switches::kWorkerProcess) || |
| 23 (process_type == switches::kNaClProcess) || |
| 24 (process_type == switches::kUtilityProcess) || |
| 25 (process_type == switches::kPluginProcess && |
| 26 command_line.HasSwitch(switches::kSafePlugins))) { |
| 27 if (!target_services_) |
| 28 return false; |
| 29 target_services_->Init(); |
| 30 } |
| 31 return true; |
| 32 } |
OLD | NEW |