blob: 0bfba243c32cc6afeead02de2be89011b8804df9 [file] [log] [blame]
[email protected]882f1d562009-11-05 14:04:481// 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
10void SandboxInitWrapper::SetServices(sandbox::SandboxInterfaceInfo* info) {
11 if (info) {
12 broker_services_ = info->broker_services;
13 target_services_ = info->target_services;
14 }
15}
16
17bool 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) ||
[email protected]f30a566d2009-11-13 22:06:4122 (process_type == switches::kExtensionProcess) ||
[email protected]882f1d562009-11-05 14:04:4823 (process_type == switches::kWorkerProcess) ||
[email protected]0b6e0a22010-01-30 00:29:5424 (process_type == switches::kNaClProcess) ||
[email protected]882f1d562009-11-05 14:04:4825 (process_type == switches::kUtilityProcess) ||
26 (process_type == switches::kPluginProcess &&
27 command_line.HasSwitch(switches::kSafePlugins))) {
28 if (!target_services_)
29 return false;
30 target_services_->Init();
31 }
32 return true;
33}