| 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 <cstddef> | |
| 9 | |
| 10 #include "base/environment.h" | 8 #include "base/environment.h" |
| 11 #include "base/files/scoped_file.h" | 9 #include "base/files/scoped_file.h" |
| 12 #include "base/process/process.h" | 10 #include "base/process/process.h" |
| 13 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 14 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 15 #include "content/public/common/sandbox_type.h" | 13 #include "content/public/common/sandbox_type.h" |
| 16 #include "content/public/common/zygote_handle.h" | |
| 17 | 14 |
| 18 namespace base { | 15 namespace base { |
| 19 class FilePath; | 16 class FilePath; |
| 20 } | 17 } |
| 21 | 18 |
| 22 namespace sandbox { | 19 namespace sandbox { |
| 23 class TargetPolicy; | 20 class TargetPolicy; |
| 24 } | 21 } |
| 25 | 22 |
| 26 namespace content { | 23 namespace content { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 47 // AddPolicyForSandboxedProcess. | 44 // AddPolicyForSandboxedProcess. |
| 48 virtual bool DisableDefaultPolicy(); | 45 virtual bool DisableDefaultPolicy(); |
| 49 | 46 |
| 50 // Called right before spawning the process. Returns false on failure. | 47 // Called right before spawning the process. Returns false on failure. |
| 51 virtual bool PreSpawnTarget(sandbox::TargetPolicy* policy); | 48 virtual bool PreSpawnTarget(sandbox::TargetPolicy* policy); |
| 52 | 49 |
| 53 // Called right after the process is launched, but before its thread is run. | 50 // Called right after the process is launched, but before its thread is run. |
| 54 virtual void PostSpawnTarget(base::ProcessHandle process) {} | 51 virtual void PostSpawnTarget(base::ProcessHandle process) {} |
| 55 | 52 |
| 56 #elif defined(OS_POSIX) | 53 #elif defined(OS_POSIX) |
| 57 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) | |
| 58 // Override this to return true to use the setuid sandbox. | 54 // Override this to return true to use the setuid sandbox. |
| 59 virtual ZygoteHandle* GetZygote(); | 55 virtual bool ShouldUseZygote(); |
| 60 #endif // !defined(OS_MACOSX) && !defined(OS_ANDROID) | |
| 61 | 56 |
| 62 // Override this if the process needs a non-empty environment map. | 57 // Override this if the process needs a non-empty environment map. |
| 63 virtual base::EnvironmentMap GetEnvironment(); | 58 virtual base::EnvironmentMap GetEnvironment(); |
| 64 | 59 |
| 65 // Return the file descriptor for the IPC channel. | 60 // Return the file descriptor for the IPC channel. |
| 66 virtual base::ScopedFD TakeIpcFd() = 0; | 61 virtual base::ScopedFD TakeIpcFd() = 0; |
| 67 #endif | 62 #endif |
| 68 | 63 |
| 69 // Returns the SandboxType to enforce on the process, or SANDBOX_TYPE_INVALID | 64 // Returns the SandboxType to enforce on the process, or SANDBOX_TYPE_INVALID |
| 70 // for no sandbox policy. | 65 // for no sandbox policy. |
| 71 virtual SandboxType GetSandboxType(); | 66 virtual SandboxType GetSandboxType(); |
| 72 }; | 67 }; |
| 73 | 68 |
| 74 } // namespace content | 69 } // namespace content |
| 75 | 70 |
| 76 #endif // CONTENT_PUBLIC_COMMON_SANDBOXED_PROCESS_LAUNCHER_DELEGATE_H_ | 71 #endif // CONTENT_PUBLIC_COMMON_SANDBOXED_PROCESS_LAUNCHER_DELEGATE_H_ |
| OLD | NEW |