1 // Copyright (c) 2012 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.
5 #ifndef CONTENT_PUBLIC_COMMON_SANDBOXED_PROCESS_LAUNCHER_DELEGATE_H_
6 #define CONTENT_PUBLIC_COMMON_SANDBOXED_PROCESS_LAUNCHER_DELEGATE_H_
8 #include "base/process/process.h"
20 // Allows a caller of StartSandboxedProcess or
21 // BrowserChildProcessHost/ChildProcessLauncher to control the sandbox policy,
22 // i.e. to loosen it if needed.
23 // The methods below will be called on the PROCESS_LAUNCHER thread.
24 class SandboxedProcessLauncherDelegate {
26 virtual ~SandboxedProcessLauncherDelegate() {}
28 // By default, the process is launched sandboxed. Override this method and set
29 // |in_sandbox| to false if this process should be launched without a sandbox
30 // (i.e. through base::LaunchProcess directly).
31 virtual void ShouldSandbox(bool* in_sandbox) {}
33 // Called before the default sandbox is applied. If the default policy is too
34 // restrictive, the caller should set |disable_default_policy| to true and
35 // apply their policy in PreSpawnTarget. |exposed_dir| is used to allow a
36 //directory through the sandbox.
37 virtual void PreSandbox(bool* disable_default_policy,
38 base::FilePath* exposed_dir) {}
40 // Called right before spawning the process.
41 virtual void PreSpawnTarget(sandbox::TargetPolicy* policy,
44 // Called right after the process is launched, but before its thread is run.
45 virtual void PostSpawnTarget(base::ProcessHandle process) {}
48 } // namespace content
50 #endif // CONTENT_PUBLIC_COMMON_SANDBOXED_PROCESS_LAUNCHER_DELEGATE_H_