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