| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/public/common/sandbox_init.h" | 5 #include "content/public/common/sandbox_init.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "content/common/sandbox_mac.h" | 10 #include "content/common/sandbox_mac.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 command_line.GetSwitchValuePath(switches::kUtilityProcessAllowedDir); | 45 command_line.GetSwitchValuePath(switches::kUtilityProcessAllowedDir); |
| 46 } else if (process_type == switches::kWorkerProcess) { | 46 } else if (process_type == switches::kWorkerProcess) { |
| 47 // Worker process sandbox. | 47 // Worker process sandbox. |
| 48 sandbox_process_type = Sandbox::SANDBOX_TYPE_WORKER; | 48 sandbox_process_type = Sandbox::SANDBOX_TYPE_WORKER; |
| 49 } else if (process_type == switches::kNaClLoaderProcess) { | 49 } else if (process_type == switches::kNaClLoaderProcess) { |
| 50 // Native Client sel_ldr (user untrusted code) sandbox. | 50 // Native Client sel_ldr (user untrusted code) sandbox. |
| 51 sandbox_process_type = Sandbox::SANDBOX_TYPE_NACL_LOADER; | 51 sandbox_process_type = Sandbox::SANDBOX_TYPE_NACL_LOADER; |
| 52 } else if (process_type == switches::kGpuProcess) { | 52 } else if (process_type == switches::kGpuProcess) { |
| 53 sandbox_process_type = Sandbox::SANDBOX_TYPE_GPU; | 53 sandbox_process_type = Sandbox::SANDBOX_TYPE_GPU; |
| 54 } else if ((process_type == switches::kPluginProcess) || | 54 } else if ((process_type == switches::kPluginProcess) || |
| 55 (process_type == switches::kServiceProcess)) { | 55 (process_type == switches::kServiceProcess) || |
| 56 (process_type == switches::kPpapiBrokerProcess)) { |
| 56 return true; | 57 return true; |
| 57 } else if (process_type == switches::kPpapiPluginProcess) { | 58 } else if (process_type == switches::kPpapiPluginProcess) { |
| 58 sandbox_process_type = Sandbox::SANDBOX_TYPE_PPAPI; | 59 sandbox_process_type = Sandbox::SANDBOX_TYPE_PPAPI; |
| 59 } else { | 60 } else { |
| 60 // Failsafe: If you hit an unreached here, is your new process type in need | 61 // Failsafe: If you hit an unreached here, is your new process type in need |
| 61 // of sandboxing? | 62 // of sandboxing? |
| 62 NOTREACHED() << "Unknown process type " << process_type; | 63 NOTREACHED() << "Unknown process type " << process_type; |
| 63 return true; | 64 return true; |
| 64 } | 65 } |
| 65 | 66 |
| 66 // Warm up APIs before turning on the sandbox. | 67 // Warm up APIs before turning on the sandbox. |
| 67 Sandbox::SandboxWarmup(sandbox_process_type); | 68 Sandbox::SandboxWarmup(sandbox_process_type); |
| 68 | 69 |
| 69 // Actually sandbox the process. | 70 // Actually sandbox the process. |
| 70 return Sandbox::EnableSandbox(sandbox_process_type, allowed_dir); | 71 return Sandbox::EnableSandbox(sandbox_process_type, allowed_dir); |
| 71 } | 72 } |
| 72 | 73 |
| 73 } // namespace content | 74 } // namespace content |
| OLD | NEW |