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/files/file_path.h" | 8 #include "base/files/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 29 matching lines...) Expand all Loading... |
40 if (process_type.empty()) { | 40 if (process_type.empty()) { |
41 // Browser process isn't sandboxed. | 41 // Browser process isn't sandboxed. |
42 return false; | 42 return false; |
43 } else if (process_type == switches::kRendererProcess) { | 43 } else if (process_type == switches::kRendererProcess) { |
44 *sandbox_type = SANDBOX_TYPE_RENDERER; | 44 *sandbox_type = SANDBOX_TYPE_RENDERER; |
45 } else if (process_type == switches::kUtilityProcess) { | 45 } else if (process_type == switches::kUtilityProcess) { |
46 // Utility process sandbox. | 46 // Utility process sandbox. |
47 *sandbox_type = SANDBOX_TYPE_UTILITY; | 47 *sandbox_type = 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) { | |
51 // Worker process sandbox. | |
52 *sandbox_type = SANDBOX_TYPE_WORKER; | |
53 } else if (process_type == switches::kGpuProcess) { | 50 } else if (process_type == switches::kGpuProcess) { |
54 if (command_line.HasSwitch(switches::kDisableGpuSandbox)) | 51 if (command_line.HasSwitch(switches::kDisableGpuSandbox)) |
55 return false; | 52 return false; |
56 *sandbox_type = SANDBOX_TYPE_GPU; | 53 *sandbox_type = SANDBOX_TYPE_GPU; |
57 } else if ((process_type == switches::kPluginProcess) || | 54 } else if ((process_type == switches::kPluginProcess) || |
58 (process_type == switches::kPpapiBrokerProcess)) { | 55 (process_type == switches::kPpapiBrokerProcess)) { |
59 return false; | 56 return false; |
60 } else if (process_type == switches::kPpapiPluginProcess) { | 57 } else if (process_type == switches::kPpapiPluginProcess) { |
61 *sandbox_type = SANDBOX_TYPE_PPAPI; | 58 *sandbox_type = SANDBOX_TYPE_PPAPI; |
62 } else { | 59 } else { |
(...skipping 10 matching lines...) Expand all Loading... |
73 base::FilePath allowed_dir; | 70 base::FilePath allowed_dir; |
74 if (!GetSandboxTypeFromCommandLine(&sandbox_type, &allowed_dir)) | 71 if (!GetSandboxTypeFromCommandLine(&sandbox_type, &allowed_dir)) |
75 return true; | 72 return true; |
76 return InitializeSandbox(sandbox_type, allowed_dir); | 73 return InitializeSandbox(sandbox_type, allowed_dir); |
77 } | 74 } |
78 | 75 |
79 extern const char kBootstrapPortNameForNPAPIPlugins[] = | 76 extern const char kBootstrapPortNameForNPAPIPlugins[] = |
80 "org.chromium.sandbox.real_bootstrap_server"; | 77 "org.chromium.sandbox.real_bootstrap_server"; |
81 | 78 |
82 } // namespace content | 79 } // namespace content |
OLD | NEW |