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_SANDBOX_INIT_H_ | 5 #ifndef CONTENT_PUBLIC_COMMON_SANDBOX_INIT_H_ |
6 #define CONTENT_PUBLIC_COMMON_SANDBOX_INIT_H_ | 6 #define CONTENT_PUBLIC_COMMON_SANDBOX_INIT_H_ |
7 | 7 |
8 #include "base/files/scoped_file.h" | 8 #include "base/files/scoped_file.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/shared_memory.h" |
10 #include "base/process/process.h" | 11 #include "base/process/process.h" |
| 12 #include "base/process/process_handle.h" |
11 #include "build/build_config.h" | 13 #include "build/build_config.h" |
12 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
13 | 15 |
14 namespace base { | 16 namespace base { |
15 class CommandLine; | 17 class CommandLine; |
16 class FilePath; | 18 class FilePath; |
17 } | 19 } |
18 | 20 |
19 namespace sandbox { | 21 namespace sandbox { |
20 namespace bpf_dsl { | 22 namespace bpf_dsl { |
21 class Policy; | 23 class Policy; |
22 } | 24 } |
23 struct SandboxInterfaceInfo; | 25 struct SandboxInterfaceInfo; |
24 } | 26 } |
25 | 27 |
26 namespace content { | 28 namespace content { |
27 class SandboxedProcessLauncherDelegate; | 29 class SandboxedProcessLauncherDelegate; |
28 | 30 |
| 31 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 32 // This function allows a sandboxed process to duplicate a SharedMemoryHandle |
| 33 // to itself or to another process. The duplicated SharedMemoryHandle has the |
| 34 // same access rights as the original. Returns true on success, false |
| 35 // otherwise. |
| 36 CONTENT_EXPORT bool BrokerDuplicateSharedMemoryHandle( |
| 37 const base::SharedMemoryHandle& source_handle, |
| 38 base::ProcessId target_process_id, |
| 39 base::SharedMemoryHandle* target_handle); |
| 40 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
| 41 |
29 #if defined(OS_WIN) | 42 #if defined(OS_WIN) |
30 | 43 |
31 // Initialize the sandbox for renderer, gpu, utility, worker, nacl, and plugin | 44 // Initialize the sandbox for renderer, gpu, utility, worker, nacl, and plugin |
32 // processes, depending on the command line flags. Although The browser process | 45 // processes, depending on the command line flags. Although The browser process |
33 // is not sandboxed, this also needs to be called because it will initialize | 46 // is not sandboxed, this also needs to be called because it will initialize |
34 // the broker code. | 47 // the broker code. |
35 // Returns true if the sandbox was initialized succesfully, false if an error | 48 // Returns true if the sandbox was initialized succesfully, false if an error |
36 // occurred. If process_type isn't one that needs sandboxing true is always | 49 // occurred. If process_type isn't one that needs sandboxing true is always |
37 // returned. | 50 // returned. |
38 CONTENT_EXPORT bool InitializeSandbox( | 51 CONTENT_EXPORT bool InitializeSandbox( |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 109 |
97 // Return a "baseline" policy. This is used by a SandboxInitializerDelegate to | 110 // Return a "baseline" policy. This is used by a SandboxInitializerDelegate to |
98 // implement a policy that is derived from the baseline. | 111 // implement a policy that is derived from the baseline. |
99 CONTENT_EXPORT scoped_ptr<sandbox::bpf_dsl::Policy> | 112 CONTENT_EXPORT scoped_ptr<sandbox::bpf_dsl::Policy> |
100 GetBPFSandboxBaselinePolicy(); | 113 GetBPFSandboxBaselinePolicy(); |
101 #endif // defined(OS_LINUX) || defined(OS_NACL_NONSFI) | 114 #endif // defined(OS_LINUX) || defined(OS_NACL_NONSFI) |
102 | 115 |
103 } // namespace content | 116 } // namespace content |
104 | 117 |
105 #endif // CONTENT_PUBLIC_COMMON_SANDBOX_INIT_H_ | 118 #endif // CONTENT_PUBLIC_COMMON_SANDBOX_INIT_H_ |
OLD | NEW |