| 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_mac.h" | 5 #include "content/common/sandbox_init_mac.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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 *sandbox_type = SANDBOX_TYPE_RENDERER; | 46 *sandbox_type = SANDBOX_TYPE_RENDERER; |
| 47 } else if (process_type == switches::kUtilityProcess) { | 47 } else if (process_type == switches::kUtilityProcess) { |
| 48 // Utility process sandbox. | 48 // Utility process sandbox. |
| 49 *sandbox_type = SANDBOX_TYPE_UTILITY; | 49 *sandbox_type = SANDBOX_TYPE_UTILITY; |
| 50 *allowed_dir = | 50 *allowed_dir = |
| 51 command_line.GetSwitchValuePath(switches::kUtilityProcessAllowedDir); | 51 command_line.GetSwitchValuePath(switches::kUtilityProcessAllowedDir); |
| 52 } else if (process_type == switches::kGpuProcess) { | 52 } else if (process_type == switches::kGpuProcess) { |
| 53 if (command_line.HasSwitch(switches::kDisableGpuSandbox)) | 53 if (command_line.HasSwitch(switches::kDisableGpuSandbox)) |
| 54 return false; | 54 return false; |
| 55 *sandbox_type = SANDBOX_TYPE_GPU; | 55 *sandbox_type = SANDBOX_TYPE_GPU; |
| 56 } else if ((process_type == switches::kPluginProcess) || | 56 } else if (process_type == switches::kPpapiBrokerProcess) { |
| 57 (process_type == switches::kPpapiBrokerProcess)) { | |
| 58 return false; | 57 return false; |
| 59 } else if (process_type == switches::kPpapiPluginProcess) { | 58 } else if (process_type == switches::kPpapiPluginProcess) { |
| 60 *sandbox_type = SANDBOX_TYPE_PPAPI; | 59 *sandbox_type = SANDBOX_TYPE_PPAPI; |
| 61 } else { | 60 } else { |
| 62 // This is a process which we don't know about, i.e. an embedder-defined | 61 // This is a process which we don't know about, i.e. an embedder-defined |
| 63 // process. If the embedder wants it sandboxed, they have a chance to return | 62 // process. If the embedder wants it sandboxed, they have a chance to return |
| 64 // the sandbox profile in ContentClient::GetSandboxProfileForSandboxType. | 63 // the sandbox profile in ContentClient::GetSandboxProfileForSandboxType. |
| 65 return false; | 64 return false; |
| 66 } | 65 } |
| 67 return true; | 66 return true; |
| 68 } | 67 } |
| 69 | 68 |
| 70 bool InitializeSandbox() { | 69 bool InitializeSandbox() { |
| 71 int sandbox_type = 0; | 70 int sandbox_type = 0; |
| 72 base::FilePath allowed_dir; | 71 base::FilePath allowed_dir; |
| 73 if (!GetSandboxTypeFromCommandLine(&sandbox_type, &allowed_dir)) | 72 if (!GetSandboxTypeFromCommandLine(&sandbox_type, &allowed_dir)) |
| 74 return true; | 73 return true; |
| 75 return InitializeSandbox(sandbox_type, allowed_dir); | 74 return InitializeSandbox(sandbox_type, allowed_dir); |
| 76 } | 75 } |
| 77 | 76 |
| 78 } // namespace content | 77 } // namespace content |
| OLD | NEW |