| 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/logging.h" | 8 #include "base/logging.h" |
| 9 #include "content/common/content_switches.h" | 9 #include "content/common/content_switches.h" |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 target_services_ = info->target_services; | 26 target_services_ = info->target_services; |
| 27 DCHECK(!(target_services_ && broker_services_)); | 27 DCHECK(!(target_services_ && broker_services_)); |
| 28 } | 28 } |
| 29 } | 29 } |
| 30 | 30 |
| 31 bool SandboxInitWrapper::InitializeSandbox(const CommandLine& command_line, | 31 bool SandboxInitWrapper::InitializeSandbox(const CommandLine& command_line, |
| 32 const std::string& process_type) { | 32 const std::string& process_type) { |
| 33 if (command_line.HasSwitch(switches::kNoSandbox)) | 33 if (command_line.HasSwitch(switches::kNoSandbox)) |
| 34 return true; | 34 return true; |
| 35 if ((process_type == switches::kRendererProcess) || | 35 if ((process_type == switches::kRendererProcess) || |
| 36 (process_type == switches::kExtensionProcess) || | |
| 37 (process_type == switches::kWorkerProcess) || | 36 (process_type == switches::kWorkerProcess) || |
| 38 (process_type == switches::kNaClLoaderProcess) || | 37 (process_type == switches::kNaClLoaderProcess) || |
| 39 (process_type == switches::kUtilityProcess)) { | 38 (process_type == switches::kUtilityProcess)) { |
| 40 // The above five process types must be sandboxed unless --no-sandbox | 39 // The above five process types must be sandboxed unless --no-sandbox |
| 41 // is present in the command line. | 40 // is present in the command line. |
| 42 if (!target_services_) | 41 if (!target_services_) |
| 43 return false; | 42 return false; |
| 44 } else { | 43 } else { |
| 45 // Other process types might or might not be sandboxed. | 44 // Other process types might or might not be sandboxed. |
| 46 // TODO(cpu): clean this mess. | 45 // TODO(cpu): clean this mess. |
| 47 if (!target_services_) | 46 if (!target_services_) |
| 48 return true; | 47 return true; |
| 49 } | 48 } |
| 50 return (sandbox::SBOX_ALL_OK == target_services_->Init()); | 49 return (sandbox::SBOX_ALL_OK == target_services_->Init()); |
| 51 } | 50 } |
| OLD | NEW |