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/common/sandbox_init_wrapper.h" | 5 #include "content/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 "content/common/content_switches.h" | 10 #include "content/common/content_switches.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 if (!command_line.HasSwitch(switches::kDisable3DAPIs) && | 27 if (!command_line.HasSwitch(switches::kDisable3DAPIs) && |
28 !command_line.HasSwitch(switches::kDisableExperimentalWebGL) && | 28 !command_line.HasSwitch(switches::kDisableExperimentalWebGL) && |
29 command_line.HasSwitch(switches::kInProcessWebGL)) { | 29 command_line.HasSwitch(switches::kInProcessWebGL)) { |
30 // TODO(kbr): this check seems to be necessary only on this | 30 // TODO(kbr): this check seems to be necessary only on this |
31 // platform because the sandbox is initialized later. Remove | 31 // platform because the sandbox is initialized later. Remove |
32 // this once this flag is removed. | 32 // this once this flag is removed. |
33 return true; | 33 return true; |
34 } else { | 34 } else { |
35 sandbox_process_type = Sandbox::SANDBOX_TYPE_RENDERER; | 35 sandbox_process_type = Sandbox::SANDBOX_TYPE_RENDERER; |
36 } | 36 } |
37 } else if (process_type == switches::kExtensionProcess) { | |
38 // Extension processes are just renderers [they use RenderMain()] with a | |
39 // different set of command line flags. | |
40 // If we ever get here it means something has changed in regards | |
41 // to the extension process mechanics and we should probably reexamine | |
42 // how we sandbox extension processes since they are no longer identical | |
43 // to renderers. | |
44 NOTREACHED(); | |
45 return true; | |
46 } else if (process_type == switches::kUtilityProcess) { | 37 } else if (process_type == switches::kUtilityProcess) { |
47 // Utility process sandbox. | 38 // Utility process sandbox. |
48 sandbox_process_type = Sandbox::SANDBOX_TYPE_UTILITY; | 39 sandbox_process_type = Sandbox::SANDBOX_TYPE_UTILITY; |
49 allowed_dir = | 40 allowed_dir = |
50 command_line.GetSwitchValuePath(switches::kUtilityProcessAllowedDir); | 41 command_line.GetSwitchValuePath(switches::kUtilityProcessAllowedDir); |
51 } else if (process_type == switches::kWorkerProcess) { | 42 } else if (process_type == switches::kWorkerProcess) { |
52 // Worker process sandbox. | 43 // Worker process sandbox. |
53 sandbox_process_type = Sandbox::SANDBOX_TYPE_WORKER; | 44 sandbox_process_type = Sandbox::SANDBOX_TYPE_WORKER; |
54 } else if (process_type == switches::kNaClLoaderProcess) { | 45 } else if (process_type == switches::kNaClLoaderProcess) { |
55 // Native Client sel_ldr (user untrusted code) sandbox. | 46 // Native Client sel_ldr (user untrusted code) sandbox. |
(...skipping 11 matching lines...) Expand all Loading... |
67 NOTREACHED() << "Unknown process type " << process_type; | 58 NOTREACHED() << "Unknown process type " << process_type; |
68 return true; | 59 return true; |
69 } | 60 } |
70 | 61 |
71 // Warm up APIs before turning on the sandbox. | 62 // Warm up APIs before turning on the sandbox. |
72 Sandbox::SandboxWarmup(sandbox_process_type); | 63 Sandbox::SandboxWarmup(sandbox_process_type); |
73 | 64 |
74 // Actually sandbox the process. | 65 // Actually sandbox the process. |
75 return Sandbox::EnableSandbox(sandbox_process_type, allowed_dir); | 66 return Sandbox::EnableSandbox(sandbox_process_type, allowed_dir); |
76 } | 67 } |
OLD | NEW |