| 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" |
| 11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 12 #include "ipc/ipc_platform_file.h" | 12 #include "ipc/ipc_platform_file.h" |
| 13 | 13 |
| 14 #if defined(OS_WIN) | 14 class CommandLine; |
| 15 class FilePath; |
| 16 |
| 15 namespace sandbox { | 17 namespace sandbox { |
| 16 struct SandboxInterfaceInfo; | 18 struct SandboxInterfaceInfo; |
| 17 } | 19 } |
| 18 #elif defined(OS_MACOSX) | |
| 19 class FilePath; | |
| 20 #endif | |
| 21 | 20 |
| 22 namespace content { | 21 namespace content { |
| 23 | 22 |
| 24 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
| 25 | 24 |
| 26 // Initialize the sandbox for renderer, gpu, utility, worker, nacl, and plug-in | 25 // Initialize the sandbox for renderer, gpu, utility, worker, nacl, and plug-in |
| 27 // processes, depending on the command line flags. Although The browser process | 26 // processes, depending on the command line flags. Although The browser process |
| 28 // is not sandboxed, this also needs to be called because it will initialize | 27 // is not sandboxed, this also needs to be called because it will initialize |
| 29 // the broker code. | 28 // the broker code. |
| 30 // Returns true if the sandbox was initialized succesfully, false if an error | 29 // Returns true if the sandbox was initialized succesfully, false if an error |
| (...skipping 14 matching lines...) Expand all Loading... |
| 45 | 44 |
| 46 // Inform the current process's sandbox broker (e.g. the broker for | 45 // Inform the current process's sandbox broker (e.g. the broker for |
| 47 // 32-bit processes) about a process created under a different sandbox | 46 // 32-bit processes) about a process created under a different sandbox |
| 48 // broker (e.g. the broker for 64-bit processes). This allows | 47 // broker (e.g. the broker for 64-bit processes). This allows |
| 49 // BrokerDuplicateHandle() to send handles to a process managed by | 48 // BrokerDuplicateHandle() to send handles to a process managed by |
| 50 // another broker. For example, it allows the 32-bit renderer to send | 49 // another broker. For example, it allows the 32-bit renderer to send |
| 51 // handles to 64-bit NaCl processes. This returns true on success, | 50 // handles to 64-bit NaCl processes. This returns true on success, |
| 52 // false otherwise. | 51 // false otherwise. |
| 53 CONTENT_EXPORT bool BrokerAddTargetPeer(HANDLE peer_process); | 52 CONTENT_EXPORT bool BrokerAddTargetPeer(HANDLE peer_process); |
| 54 | 53 |
| 54 // Starts a sandboxed process with the given directory unsandboxed |
| 55 // and returns a handle to it. |
| 56 CONTENT_EXPORT base::ProcessHandle StartProcessWithAccess( |
| 57 CommandLine* cmd_line, |
| 58 const FilePath& exposed_dir); |
| 59 |
| 55 #elif defined(OS_MACOSX) | 60 #elif defined(OS_MACOSX) |
| 56 | 61 |
| 57 // Initialize the sandbox of the given |sandbox_type|, optionally specifying a | 62 // Initialize the sandbox of the given |sandbox_type|, optionally specifying a |
| 58 // directory to allow access to. Note specifying a directory needs to be | 63 // directory to allow access to. Note specifying a directory needs to be |
| 59 // supported by the sandbox profile associated with the given |sandbox_type|. | 64 // supported by the sandbox profile associated with the given |sandbox_type|. |
| 60 // Valid values for |sandbox_type| are defined either by the enum SandboxType, | 65 // Valid values for |sandbox_type| are defined either by the enum SandboxType, |
| 61 // or by ContentClient::GetSandboxProfileForSandboxType(). | 66 // or by ContentClient::GetSandboxProfileForSandboxType(). |
| 62 // | 67 // |
| 63 // If the |sandbox_type| isn't one of the ones defined by content then the | 68 // If the |sandbox_type| isn't one of the ones defined by content then the |
| 64 // embedder is queried using ContentClient::GetSandboxPolicyForSandboxType(). | 69 // embedder is queried using ContentClient::GetSandboxPolicyForSandboxType(). |
| (...skipping 17 matching lines...) Expand all Loading... |
| 82 // DUPLICATE_SAME_ACCESS flag. On posix it behaves essentially the same as | 87 // DUPLICATE_SAME_ACCESS flag. On posix it behaves essentially the same as |
| 83 // IPC::GetFileHandleForProcess() | 88 // IPC::GetFileHandleForProcess() |
| 84 CONTENT_EXPORT IPC::PlatformFileForTransit BrokerGetFileHandleForProcess( | 89 CONTENT_EXPORT IPC::PlatformFileForTransit BrokerGetFileHandleForProcess( |
| 85 base::PlatformFile handle, | 90 base::PlatformFile handle, |
| 86 base::ProcessId target_process_id, | 91 base::ProcessId target_process_id, |
| 87 bool should_close_source); | 92 bool should_close_source); |
| 88 | 93 |
| 89 } // namespace content | 94 } // namespace content |
| 90 | 95 |
| 91 #endif // CONTENT_PUBLIC_COMMON_SANDBOX_INIT_H_ | 96 #endif // CONTENT_PUBLIC_COMMON_SANDBOX_INIT_H_ |
| OLD | NEW |