| 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_policy.h" | 5 #include "content/common/sandbox_policy.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/debugger.h" | 10 #include "base/debug/debugger.h" |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 } else if (type_str == switches::kNaClLoaderProcess) { | 395 } else if (type_str == switches::kNaClLoaderProcess) { |
| 396 type = ChildProcessInfo::NACL_LOADER_PROCESS; | 396 type = ChildProcessInfo::NACL_LOADER_PROCESS; |
| 397 } else if (type_str == switches::kUtilityProcess) { | 397 } else if (type_str == switches::kUtilityProcess) { |
| 398 type = ChildProcessInfo::UTILITY_PROCESS; | 398 type = ChildProcessInfo::UTILITY_PROCESS; |
| 399 } else if (type_str == switches::kNaClBrokerProcess) { | 399 } else if (type_str == switches::kNaClBrokerProcess) { |
| 400 type = ChildProcessInfo::NACL_BROKER_PROCESS; | 400 type = ChildProcessInfo::NACL_BROKER_PROCESS; |
| 401 } else if (type_str == switches::kGpuProcess) { | 401 } else if (type_str == switches::kGpuProcess) { |
| 402 type = ChildProcessInfo::GPU_PROCESS; | 402 type = ChildProcessInfo::GPU_PROCESS; |
| 403 } else if (type_str == switches::kPpapiPluginProcess) { | 403 } else if (type_str == switches::kPpapiPluginProcess) { |
| 404 type = ChildProcessInfo::PPAPI_PLUGIN_PROCESS; | 404 type = ChildProcessInfo::PPAPI_PLUGIN_PROCESS; |
| 405 } else if (type_str == switches::kPpapiBrokerProcess) { |
| 406 type = ChildProcessInfo::PPAPI_BROKER_PROCESS; |
| 405 } else { | 407 } else { |
| 406 NOTREACHED(); | 408 NOTREACHED(); |
| 407 return 0; | 409 return 0; |
| 408 } | 410 } |
| 409 | 411 |
| 410 TRACE_EVENT_BEGIN_ETW("StartProcessWithAccess", 0, type_str); | 412 TRACE_EVENT_BEGIN_ETW("StartProcessWithAccess", 0, type_str); |
| 411 | 413 |
| 412 // To decide if the process is going to be sandboxed we have two cases. | 414 // To decide if the process is going to be sandboxed we have two cases. |
| 413 // First case: all process types except the nacl broker, and the plugin | 415 // First case: all process types except the nacl broker, and the plugin |
| 414 // process are sandboxed by default. | 416 // process are sandboxed by default. |
| 415 bool in_sandbox = | 417 bool in_sandbox = |
| 416 (type != ChildProcessInfo::NACL_BROKER_PROCESS) && | 418 (type != ChildProcessInfo::NACL_BROKER_PROCESS) && |
| 417 (type != ChildProcessInfo::PLUGIN_PROCESS); | 419 (type != ChildProcessInfo::PLUGIN_PROCESS) && |
| 420 (type != ChildProcessInfo::PPAPI_BROKER_PROCESS); |
| 418 | 421 |
| 419 // If it is the GPU process then it can be disabled by a command line flag. | 422 // If it is the GPU process then it can be disabled by a command line flag. |
| 420 if ((type == ChildProcessInfo::GPU_PROCESS) && | 423 if ((type == ChildProcessInfo::GPU_PROCESS) && |
| 421 (browser_command_line.HasSwitch(switches::kDisableGpuSandbox))) { | 424 (browser_command_line.HasSwitch(switches::kDisableGpuSandbox))) { |
| 422 in_sandbox = false; | 425 in_sandbox = false; |
| 423 DVLOG(1) << "GPU sandbox is disabled"; | 426 DVLOG(1) << "GPU sandbox is disabled"; |
| 424 } | 427 } |
| 425 | 428 |
| 426 if (browser_command_line.HasSwitch(switches::kNoSandbox) || | 429 if (browser_command_line.HasSwitch(switches::kNoSandbox) || |
| 427 cmd_line->HasSwitch(switches::kNoSandbox)) { | 430 cmd_line->HasSwitch(switches::kNoSandbox)) { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 | 565 |
| 563 // Help the process a little. It can't start the debugger by itself if | 566 // Help the process a little. It can't start the debugger by itself if |
| 564 // the process is in a sandbox. | 567 // the process is in a sandbox. |
| 565 if (child_needs_help) | 568 if (child_needs_help) |
| 566 base::debug::SpawnDebuggerOnProcess(target.dwProcessId); | 569 base::debug::SpawnDebuggerOnProcess(target.dwProcessId); |
| 567 | 570 |
| 568 return process; | 571 return process; |
| 569 } | 572 } |
| 570 | 573 |
| 571 } // namespace sandbox | 574 } // namespace sandbox |
| OLD | NEW |