blob: 9dd45ad3f1aa3db07fbe191fb34a0366568fe569 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_PUBLIC_COMMON_SANDBOXED_PROCESS_LAUNCHER_DELEGATE_H_
#define CONTENT_PUBLIC_COMMON_SANDBOXED_PROCESS_LAUNCHER_DELEGATE_H_
#include "base/environment.h"
#include "base/process/process.h"
#include "content/common/content_export.h"
namespace base {
class FilePath;
}
namespace sandbox {
class TargetPolicy;
}
namespace content {
// Allows a caller of StartSandboxedProcess or
// BrowserChildProcessHost/ChildProcessLauncher to control the sandbox policy,
// i.e. to loosen it if needed.
// The methods below will be called on the PROCESS_LAUNCHER thread.
class CONTENT_EXPORT SandboxedProcessLauncherDelegate {
public:
virtual ~SandboxedProcessLauncherDelegate() {}
#if defined(OS_WIN)
// Override to return true if the process should be launched as an elevated
// process (which implies no sandbox).
virtual bool ShouldLaunchElevated();
// By default, the process is launched sandboxed. Override this method to
// return false if the process should be launched without a sandbox
// (i.e. through base::LaunchProcess directly).
virtual bool ShouldSandbox();
// Called before the default sandbox is applied. If the default policy is too
// restrictive, the caller should set |disable_default_policy| to true and
// apply their policy in PreSpawnTarget. |exposed_dir| is used to allow a
//directory through the sandbox.
virtual void PreSandbox(bool* disable_default_policy,
base::FilePath* exposed_dir) {}
// Called right before spawning the process.
virtual void PreSpawnTarget(sandbox::TargetPolicy* policy,
bool* success) {}
// Called right after the process is launched, but before its thread is run.
virtual void PostSpawnTarget(base::ProcessHandle process) {}
#elif defined(OS_POSIX)
// Override this to return true to use the setuid sandbox.
virtual bool ShouldUseZygote();
// Override this if the process needs a non-empty environment map.
virtual base::EnvironmentMap GetEnvironment();
// Return the file descriptor for the IPC channel.
virtual int GetIpcFd() = 0;
#endif
};
} // namespace content
#endif // CONTENT_PUBLIC_COMMON_SANDBOXED_PROCESS_LAUNCHER_DELEGATE_H_
|