OLD | NEW |
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/environment.h" |
9 #include "base/files/scoped_file.h" | 9 #include "base/files/scoped_file.h" |
10 #include "base/process/process.h" | 10 #include "base/process/process.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 #if defined(OS_WIN) | 32 #if defined(OS_WIN) |
33 // Override to return true if the process should be launched as an elevated | 33 // Override to return true if the process should be launched as an elevated |
34 // process (which implies no sandbox). | 34 // process (which implies no sandbox). |
35 virtual bool ShouldLaunchElevated(); | 35 virtual bool ShouldLaunchElevated(); |
36 | 36 |
37 // By default, the process is launched sandboxed. Override this method to | 37 // By default, the process is launched sandboxed. Override this method to |
38 // return false if the process should be launched without a sandbox | 38 // return false if the process should be launched without a sandbox |
39 // (i.e. through base::LaunchProcess directly). | 39 // (i.e. through base::LaunchProcess directly). |
40 virtual bool ShouldSandbox(); | 40 virtual bool ShouldSandbox(); |
41 | 41 |
42 // Called before the default sandbox is applied. If the default policy is too | 42 // Whether to disable the default policy specified in |
43 // restrictive, the caller should set |disable_default_policy| to true and | 43 // AddPolicyForSandboxedProcess. |
44 // apply their policy in PreSpawnTarget. |exposed_dir| is used to allow a | 44 virtual bool DisableDefaultPolicy(); |
45 //directory through the sandbox. | |
46 virtual void PreSandbox(bool* disable_default_policy, | |
47 base::FilePath* exposed_dir) {} | |
48 | 45 |
49 // Called right before spawning the process. | 46 // Called right before spawning the process. Returns false on failure. |
50 virtual void PreSpawnTarget(sandbox::TargetPolicy* policy, | 47 virtual bool PreSpawnTarget(sandbox::TargetPolicy* policy); |
51 bool* success) {} | |
52 | 48 |
53 // Called right after the process is launched, but before its thread is run. | 49 // Called right after the process is launched, but before its thread is run. |
54 virtual void PostSpawnTarget(base::ProcessHandle process) {} | 50 virtual void PostSpawnTarget(base::ProcessHandle process) {} |
55 | 51 |
56 #elif defined(OS_POSIX) | 52 #elif defined(OS_POSIX) |
57 // Override this to return true to use the setuid sandbox. | 53 // Override this to return true to use the setuid sandbox. |
58 virtual bool ShouldUseZygote(); | 54 virtual bool ShouldUseZygote(); |
59 | 55 |
60 // Override this if the process needs a non-empty environment map. | 56 // Override this if the process needs a non-empty environment map. |
61 virtual base::EnvironmentMap GetEnvironment(); | 57 virtual base::EnvironmentMap GetEnvironment(); |
62 | 58 |
63 // Return the file descriptor for the IPC channel. | 59 // Return the file descriptor for the IPC channel. |
64 virtual base::ScopedFD TakeIpcFd() = 0; | 60 virtual base::ScopedFD TakeIpcFd() = 0; |
65 #endif | 61 #endif |
66 | 62 |
67 // Returns the SandboxType to enforce on the process, or SANDBOX_TYPE_INVALID | 63 // Returns the SandboxType to enforce on the process, or SANDBOX_TYPE_INVALID |
68 // for no sandbox policy. | 64 // for no sandbox policy. |
69 virtual SandboxType GetSandboxType(); | 65 virtual SandboxType GetSandboxType(); |
70 }; | 66 }; |
71 | 67 |
72 } // namespace content | 68 } // namespace content |
73 | 69 |
74 #endif // CONTENT_PUBLIC_COMMON_SANDBOXED_PROCESS_LAUNCHER_DELEGATE_H_ | 70 #endif // CONTENT_PUBLIC_COMMON_SANDBOXED_PROCESS_LAUNCHER_DELEGATE_H_ |
OLD | NEW |