| 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 #if defined(OS_WIN) | |
| 11 | |
| 12 void SandboxInitWrapper::SetServices(sandbox::SandboxInterfaceInfo* info) { | |
| 13 if (info) { | |
| 14 broker_services_ = info->broker_services; | |
| 15 target_services_ = info->target_services; | |
| 16 } | |
| 17 } | |
| 18 | |
| 19 #endif | |
| 20 | |
| 21 void SandboxInitWrapper::InitializeSandbox(const CommandLine& command_line, | |
| 22 const std::string& process_type) { | |
| 23 #if defined(OS_WIN) | |
| 24 if (!target_services_) | |
| 25 return; | |
| 26 #endif | |
| 27 if (!command_line.HasSwitch(switches::kNoSandbox)) { | |
| 28 if ((process_type == switches::kRendererProcess) || | |
| 29 (process_type == switches::kWorkerProcess) || | |
| 30 (process_type == switches::kNaClProcess) || | |
| 31 (process_type == switches::kUtilityProcess) || | |
| 32 (process_type == switches::kPluginProcess && | |
| 33 command_line.HasSwitch(switches::kSafePlugins))) { | |
| 34 #if defined(OS_WIN) | |
| 35 target_services_->Init(); | |
| 36 #elif defined(OS_MACOSX) | |
| 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 | |
| 39 // places. | |
| 40 process_type_ = process_type; | |
| 41 #endif | |
| 42 } | |
| 43 } | |
| 44 } | |
| OLD | NEW |