Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: content/public/common/sandboxed_process_launcher_delegate.h

Issue 177863002: Refactor configuration of sandboxes - first steps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nacl sandbox options on Linux Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_PUBLIC_COMMON_SANDBOXED_PROCESS_LAUNCHER_DELEGATE_H_ 5 #ifndef CONTENT_PUBLIC_COMMON_SANDBOXED_PROCESS_LAUNCHER_DELEGATE_H_
6 #define CONTENT_PUBLIC_COMMON_SANDBOXED_PROCESS_LAUNCHER_DELEGATE_H_ 6 #define CONTENT_PUBLIC_COMMON_SANDBOXED_PROCESS_LAUNCHER_DELEGATE_H_
7 7
8 #include "base/environment.h"
8 #include "base/process/process.h" 9 #include "base/process/process.h"
9 10
11 #include "content/common/content_export.h"
12
10 namespace base { 13 namespace base {
11 class FilePath; 14 class FilePath;
12 } 15 }
13 16
14 namespace sandbox { 17 namespace sandbox {
15 class TargetPolicy; 18 class TargetPolicy;
16 } 19 }
17 20
18 namespace content { 21 namespace content {
19 22
20 // Allows a caller of StartSandboxedProcess or 23 // Allows a caller of StartSandboxedProcess or
21 // BrowserChildProcessHost/ChildProcessLauncher to control the sandbox policy, 24 // BrowserChildProcessHost/ChildProcessLauncher to control the sandbox policy,
22 // i.e. to loosen it if needed. 25 // i.e. to loosen it if needed.
23 // The methods below will be called on the PROCESS_LAUNCHER thread. 26 // The methods below will be called on the PROCESS_LAUNCHER thread.
24 class SandboxedProcessLauncherDelegate { 27 class CONTENT_EXPORT SandboxedProcessLauncherDelegate {
25 public: 28 public:
26 virtual ~SandboxedProcessLauncherDelegate() {} 29 virtual ~SandboxedProcessLauncherDelegate() {
30 }
jam 2014/02/26 19:47:52 nit: keep on one line as before, that's the conven
aberent 2014/02/28 08:51:07 Done.
31
32 #if defined(OS_WIN)
33 // Override to return true if the process should be launched as an elevated
34 // process (which implies no sandbox).
35 virtual bool LaunchElevated();
jam 2014/02/26 19:47:52 nit: LaunchElevated could be confused in that cont
aberent 2014/02/28 08:51:07 Done.
27 36
28 // By default, the process is launched sandboxed. Override this method and set 37 // 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 38 // |in_sandbox| to false if this process should be launched without a sandbox
30 // (i.e. through base::LaunchProcess directly). 39 // (i.e. through base::LaunchProcess directly).
31 virtual void ShouldSandbox(bool* in_sandbox) {} 40 virtual void ShouldSandbox(bool* in_sandbox) {}
jam 2014/02/26 22:45:14 oh i forgot to mention, I had added this method th
aberent 2014/02/28 08:51:07 Done.
32 41
33 // Called before the default sandbox is applied. If the default policy is too 42 // 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 43 // restrictive, the caller should set |disable_default_policy| to true and
35 // apply their policy in PreSpawnTarget. |exposed_dir| is used to allow a 44 // apply their policy in PreSpawnTarget. |exposed_dir| is used to allow a
36 //directory through the sandbox. 45 //directory through the sandbox.
37 virtual void PreSandbox(bool* disable_default_policy, 46 virtual void PreSandbox(bool* disable_default_policy,
38 base::FilePath* exposed_dir) {} 47 base::FilePath* exposed_dir) {}
39 48
40 // Called right before spawning the process. 49 // Called right before spawning the process.
41 virtual void PreSpawnTarget(sandbox::TargetPolicy* policy, 50 virtual void PreSpawnTarget(sandbox::TargetPolicy* policy,
42 bool* success) {} 51 bool* success) {}
43 52
44 // Called right after the process is launched, but before its thread is run. 53 // Called right after the process is launched, but before its thread is run.
45 virtual void PostSpawnTarget(base::ProcessHandle process) {} 54 virtual void PostSpawnTarget(base::ProcessHandle process) {}
55
56 #elif defined(OS_POSIX)
57 // Override this to return true to use the setuid sandbox.
58 virtual bool UseZygote();
jam 2014/02/26 19:47:52 nit: ditto re naming, this should be ShouldUseZygo
aberent 2014/02/28 08:51:07 Done.
59
60 // Override this if the process needs a non-empty environment map.
61 virtual base::EnvironmentMap GetEnvironment();
62
63 // Return the File descriptor for the IPC channel.
64 virtual int IpcFd() = 0;
jam 2014/02/26 19:47:52 nit: GetIPCFD
aberent 2014/02/28 08:51:07 Done.
65
66 #endif
46 }; 67 };
47 68
48 } // namespace content 69 } // namespace content
49 70
50 #endif // CONTENT_PUBLIC_COMMON_SANDBOXED_PROCESS_LAUNCHER_DELEGATE_H_ 71 #endif // CONTENT_PUBLIC_COMMON_SANDBOXED_PROCESS_LAUNCHER_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698