| 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 23 matching lines...) Expand all Loading... |
| 34 } else if (process_type == switches::kUtilityProcess) { | 34 } else if (process_type == switches::kUtilityProcess) { |
| 35 // Utility process sandbox. | 35 // Utility process sandbox. |
| 36 sandbox_process_type = sandbox::SANDBOX_TYPE_UTILITY; | 36 sandbox_process_type = sandbox::SANDBOX_TYPE_UTILITY; |
| 37 allowed_dir = FilePath::FromWStringHack( | 37 allowed_dir = FilePath::FromWStringHack( |
| 38 command_line.GetSwitchValue(switches::kUtilityProcessAllowedDir)); | 38 command_line.GetSwitchValue(switches::kUtilityProcessAllowedDir)); |
| 39 } else if (process_type == switches::kWorkerProcess) { | 39 } else if (process_type == switches::kWorkerProcess) { |
| 40 // Worker process sandbox. | 40 // Worker process sandbox. |
| 41 sandbox_process_type = sandbox::SANDBOX_TYPE_WORKER; | 41 sandbox_process_type = sandbox::SANDBOX_TYPE_WORKER; |
| 42 } else if ((process_type == switches::kNaClLoaderProcess) || | 42 } else if ((process_type == switches::kNaClLoaderProcess) || |
| 43 (process_type == switches::kPluginProcess) || | 43 (process_type == switches::kPluginProcess) || |
| 44 (process_type == switches::kProfileImportProcess)) { | 44 (process_type == switches::kProfileImportProcess) || |
| 45 (process_type == switches::kGpuProcess)) { |
| 45 return true; | 46 return true; |
| 46 } else { | 47 } else { |
| 47 // Failsafe: If you hit an unreached here, is your new process type in need | 48 // Failsafe: If you hit an unreached here, is your new process type in need |
| 48 // of sandboxing? | 49 // of sandboxing? |
| 49 NOTREACHED(); | 50 NOTREACHED(); |
| 50 return true; | 51 return true; |
| 51 } | 52 } |
| 52 | 53 |
| 53 // Warm up APIs before turning on the sandbox. | 54 // Warm up APIs before turning on the sandbox. |
| 54 sandbox::SandboxWarmup(); | 55 sandbox::SandboxWarmup(); |
| 55 | 56 |
| 56 // Actually sandbox the process. | 57 // Actually sandbox the process. |
| 57 return sandbox::EnableSandbox(sandbox_process_type, allowed_dir); | 58 return sandbox::EnableSandbox(sandbox_process_type, allowed_dir); |
| 58 } | 59 } |
| OLD | NEW |