| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/common/sandbox_init_wrapper.h" | 5 #include "chrome/common/sandbox_init_wrapper.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
| 9 #include "chrome/common/sandbox_mac.h" | 9 #include "chrome/common/sandbox_mac.h" |
| 10 | 10 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 allowed_dir = FilePath::FromWStringHack( | 52 allowed_dir = FilePath::FromWStringHack( |
| 53 command_line.GetSwitchValue(switches::kUtilityProcessAllowedDir)); | 53 command_line.GetSwitchValue(switches::kUtilityProcessAllowedDir)); |
| 54 } else if (process_type == switches::kWorkerProcess) { | 54 } else if (process_type == switches::kWorkerProcess) { |
| 55 // Worker process sandbox. | 55 // Worker process sandbox. |
| 56 sandbox_process_type = sandbox::SANDBOX_TYPE_WORKER; | 56 sandbox_process_type = sandbox::SANDBOX_TYPE_WORKER; |
| 57 } else if (process_type == switches::kNaClLoaderProcess) { | 57 } else if (process_type == switches::kNaClLoaderProcess) { |
| 58 // Native Client sel_ldr (user untrusted code) sandbox. | 58 // Native Client sel_ldr (user untrusted code) sandbox. |
| 59 sandbox_process_type = sandbox::SANDBOX_TYPE_NACL_LOADER; | 59 sandbox_process_type = sandbox::SANDBOX_TYPE_NACL_LOADER; |
| 60 } else if ((process_type == switches::kPluginProcess) || | 60 } else if ((process_type == switches::kPluginProcess) || |
| 61 (process_type == switches::kProfileImportProcess) || | 61 (process_type == switches::kProfileImportProcess) || |
| 62 (process_type == switches::kGpuProcess)) { | 62 (process_type == switches::kGpuProcess) || |
| 63 (process_type == switches::kServiceProcess)) { |
| 63 return true; | 64 return true; |
| 64 } else { | 65 } else { |
| 65 // Failsafe: If you hit an unreached here, is your new process type in need | 66 // Failsafe: If you hit an unreached here, is your new process type in need |
| 66 // of sandboxing? | 67 // of sandboxing? |
| 67 NOTREACHED(); | 68 NOTREACHED(); |
| 68 return true; | 69 return true; |
| 69 } | 70 } |
| 70 | 71 |
| 71 // Warm up APIs before turning on the sandbox. | 72 // Warm up APIs before turning on the sandbox. |
| 72 sandbox::SandboxWarmup(); | 73 sandbox::SandboxWarmup(); |
| 73 | 74 |
| 74 // Actually sandbox the process. | 75 // Actually sandbox the process. |
| 75 return sandbox::EnableSandbox(sandbox_process_type, allowed_dir); | 76 return sandbox::EnableSandbox(sandbox_process_type, allowed_dir); |
| 76 } | 77 } |
| OLD | NEW |