#include "content/common/sandbox_win.h"
#include "content/public/common/sandbox_init.h"
#elif defined(OS_MACOSX)
+#include "content/browser/bootstrap_sandbox_mac.h"
#include "content/browser/mach_broker_mac.h"
+#include "sandbox/mac/bootstrap_sandbox.h"
#elif defined(OS_ANDROID)
#include "base/android/jni_android.h"
#include "content/browser/android/child_process_launcher_android.h"
void Launch(
SandboxedProcessLauncherDelegate* delegate,
- CommandLine* cmd_line,
+ base::CommandLine* cmd_line,
int child_process_id,
Client* client) {
client_ = client;
BrowserThread::ID client_thread_id,
int child_process_id,
SandboxedProcessLauncherDelegate* delegate,
- CommandLine* cmd_line) {
+ base::CommandLine* cmd_line) {
scoped_ptr<SandboxedProcessLauncherDelegate> delegate_deleter(delegate);
#if defined(OS_WIN)
bool launch_elevated = delegate->ShouldLaunchElevated();
base::EnvironmentMap env = delegate->GetEnvironment();
int ipcfd = delegate->GetIpcFd();
#endif
- scoped_ptr<CommandLine> cmd_line_deleter(cmd_line);
+ scoped_ptr<base::CommandLine> cmd_line_deleter(cmd_line);
base::TimeTicks begin_launch_time = base::TimeTicks::Now();
#if defined(OS_WIN)
// Make sure the MachBroker is running, and inform it to expect a
// check-in from the new process.
broker->EnsureRunning();
+
+ const int bootstrap_sandbox_policy = delegate->GetSandboxType();
+ if (ShouldEnableBootstrapSandbox() &&
+ bootstrap_sandbox_policy != SANDBOX_TYPE_INVALID) {
+ options.replacement_bootstrap_name =
+ GetBootstrapSandbox()->server_bootstrap_name();
+ GetBootstrapSandbox()->PrepareToForkWithPolicy(
+ bootstrap_sandbox_policy);
+ }
#endif // defined(OS_MACOSX)
bool launched = base::LaunchProcess(*cmd_line, options, &handle);
+ if (!launched)
+ handle = base::kNullProcessHandle;
#if defined(OS_MACOSX)
+ if (ShouldEnableBootstrapSandbox() &&
+ bootstrap_sandbox_policy != SANDBOX_TYPE_INVALID) {
+ GetBootstrapSandbox()->FinishedFork(handle);
+ }
+
if (launched)
broker->AddPlaceholderForPid(handle);
// messasge be processed on the broker's thread.
broker->GetLock().Release();
#endif // defined(OS_MACOSX)
-
- if (!launched)
- handle = base::kNullProcessHandle;
}
#endif // else defined(OS_POSIX)
#if !defined(OS_ANDROID)
ChildProcessLauncher::ChildProcessLauncher(
SandboxedProcessLauncherDelegate* delegate,
- CommandLine* cmd_line,
+ base::CommandLine* cmd_line,
int child_process_id,
Client* client) {
context_ = new Context();
void ChildProcessLauncher::SetProcessBackgrounded(bool background) {
BrowserThread::PostTask(
- BrowserThread::PROCESS_LAUNCHER, FROM_HERE,
- base::Bind(
- &ChildProcessLauncher::Context::SetProcessBackgrounded,
- GetHandle(), background));
+ BrowserThread::PROCESS_LAUNCHER, FROM_HERE,
+ base::Bind(
+ &ChildProcessLauncher::Context::SetProcessBackgrounded,
+ GetHandle(), background));
}
void ChildProcessLauncher::SetTerminateChildOnShutdown(