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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/process.h" | 9 #include "base/process.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 // This is a restricted version of Windows' DuplicateHandle() function | 35 // This is a restricted version of Windows' DuplicateHandle() function |
36 // that works inside the sandbox and can send handles but not retrieve | 36 // that works inside the sandbox and can send handles but not retrieve |
37 // them. Unlike DuplicateHandle(), it takes a process ID rather than | 37 // them. Unlike DuplicateHandle(), it takes a process ID rather than |
38 // a process handle. It returns true on success, false otherwise. | 38 // a process handle. It returns true on success, false otherwise. |
39 CONTENT_EXPORT bool BrokerDuplicateHandle(HANDLE source_handle, | 39 CONTENT_EXPORT bool BrokerDuplicateHandle(HANDLE source_handle, |
40 DWORD target_process_id, | 40 DWORD target_process_id, |
41 HANDLE* target_handle, | 41 HANDLE* target_handle, |
42 DWORD desired_access, | 42 DWORD desired_access, |
43 DWORD options); | 43 DWORD options); |
44 | 44 |
| 45 // Inform the current process's sandbox broker (e.g. the broker for |
| 46 // 32-bit processes) about a process created under a different sandbox |
| 47 // broker (e.g. the broker for 64-bit processes). This allows |
| 48 // BrokerDuplicateHandle() to send handles to a process managed by |
| 49 // another broker. For example, it allows the 32-bit renderer to send |
| 50 // handles to 64-bit NaCl processes. This returns true on success, |
| 51 // false otherwise. |
| 52 CONTENT_EXPORT bool BrokerAddTargetPeer(HANDLE peer_process); |
| 53 |
45 #elif defined(OS_MACOSX) | 54 #elif defined(OS_MACOSX) |
46 | 55 |
47 // Initialize the sandbox of the given |sandbox_type|, optionally specifying a | 56 // Initialize the sandbox of the given |sandbox_type|, optionally specifying a |
48 // directory to allow access to. Note specifying a directory needs to be | 57 // directory to allow access to. Note specifying a directory needs to be |
49 // supported by the sandbox profile associated with the given |sandbox_type|. | 58 // supported by the sandbox profile associated with the given |sandbox_type|. |
50 // Valid values for |sandbox_type| are defined either by the enum SandboxType, | 59 // Valid values for |sandbox_type| are defined either by the enum SandboxType, |
51 // or by ContentClient::GetSandboxProfileForSandboxType(). | 60 // or by ContentClient::GetSandboxProfileForSandboxType(). |
52 // | 61 // |
53 // If the |sandbox_type| isn't one of the ones defined by content then the | 62 // If the |sandbox_type| isn't one of the ones defined by content then the |
54 // embedder is queried using ContentClient::GetSandboxPolicyForSandboxType(). | 63 // embedder is queried using ContentClient::GetSandboxPolicyForSandboxType(). |
55 // The embedder can use values for |sandbox_type| starting from | 64 // The embedder can use values for |sandbox_type| starting from |
56 // content::sandbox::SANDBOX_PROCESS_TYPE_AFTER_LAST_TYPE. | 65 // content::sandbox::SANDBOX_PROCESS_TYPE_AFTER_LAST_TYPE. |
57 // | 66 // |
58 // Returns true if the sandbox was initialized succesfully, false if an error | 67 // Returns true if the sandbox was initialized succesfully, false if an error |
59 // occurred. If process_type isn't one that needs sandboxing, no action is | 68 // occurred. If process_type isn't one that needs sandboxing, no action is |
60 // taken and true is always returned. | 69 // taken and true is always returned. |
61 CONTENT_EXPORT bool InitializeSandbox(int sandbox_type, | 70 CONTENT_EXPORT bool InitializeSandbox(int sandbox_type, |
62 const FilePath& allowed_path); | 71 const FilePath& allowed_path); |
63 | 72 |
64 #elif defined(OS_LINUX) | 73 #elif defined(OS_LINUX) |
65 | 74 |
66 CONTENT_EXPORT void InitializeSandbox(); | 75 CONTENT_EXPORT void InitializeSandbox(); |
67 | 76 |
68 #endif | 77 #endif |
69 | 78 |
70 } // namespace content | 79 } // namespace content |
71 | 80 |
72 #endif // CONTENT_PUBLIC_COMMON_SANDBOX_INIT_H_ | 81 #endif // CONTENT_PUBLIC_COMMON_SANDBOX_INIT_H_ |
OLD | NEW |