| 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 #include "content/browser/utility_process_host_impl.h" | 5 #include "content/browser/utility_process_host_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 base::FilePath exposed_files = exposed_dir_.AppendASCII("*"); | 80 base::FilePath exposed_files = exposed_dir_.AppendASCII("*"); |
| 81 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, | 81 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, |
| 82 sandbox::TargetPolicy::FILES_ALLOW_ANY, | 82 sandbox::TargetPolicy::FILES_ALLOW_ANY, |
| 83 exposed_files.value().c_str()); | 83 exposed_files.value().c_str()); |
| 84 return result == sandbox::SBOX_ALL_OK; | 84 return result == sandbox::SBOX_ALL_OK; |
| 85 } | 85 } |
| 86 | 86 |
| 87 #elif defined(OS_POSIX) | 87 #elif defined(OS_POSIX) |
| 88 | 88 |
| 89 bool ShouldUseZygote() override { | 89 ZygoteHandle* GetZygote() override { |
| 90 return !no_sandbox_ && exposed_dir_.empty(); | 90 if (!no_sandbox_ && exposed_dir_.empty()) { |
| 91 static ZygoteHandle zygote; |
| 92 return &zygote; |
| 93 } |
| 94 return nullptr; |
| 91 } | 95 } |
| 92 base::EnvironmentMap GetEnvironment() override { return env_; } | 96 base::EnvironmentMap GetEnvironment() override { return env_; } |
| 93 base::ScopedFD TakeIpcFd() override { return std::move(ipc_fd_); } | 97 base::ScopedFD TakeIpcFd() override { return std::move(ipc_fd_); } |
| 94 #endif // OS_WIN | 98 #endif // OS_WIN |
| 95 | 99 |
| 96 SandboxType GetSandboxType() override { | 100 SandboxType GetSandboxType() override { |
| 97 return SANDBOX_TYPE_UTILITY; | 101 return SANDBOX_TYPE_UTILITY; |
| 98 } | 102 } |
| 99 | 103 |
| 100 private: | 104 private: |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 if (RenderProcessHost::run_renderer_in_process()) | 381 if (RenderProcessHost::run_renderer_in_process()) |
| 378 handle = base::GetCurrentProcessHandle(); | 382 handle = base::GetCurrentProcessHandle(); |
| 379 else | 383 else |
| 380 handle = process_->GetData().handle; | 384 handle = process_->GetData().handle; |
| 381 | 385 |
| 382 mojo_application_host_->Activate(this, handle); | 386 mojo_application_host_->Activate(this, handle); |
| 383 } | 387 } |
| 384 } | 388 } |
| 385 | 389 |
| 386 } // namespace content | 390 } // namespace content |
| OLD | NEW |