Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: content/common/sandbox_policy.cc

Issue 7084010: Move sandbox_policy to content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/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"
11 #include "base/debug/trace_event.h" 11 #include "base/debug/trace_event.h"
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/process_util.h" 15 #include "base/process_util.h"
16 #include "base/stringprintf.h" 16 #include "base/stringprintf.h"
17 #include "base/string_util.h" 17 #include "base/string_util.h"
18 #include "base/win/windows_version.h" 18 #include "base/win/windows_version.h"
19 #include "content/browser/content_browser_client.h" 19 #include "content/common/content_client.h"
20 #include "content/common/content_switches.h" 20 #include "content/common/content_switches.h"
21 #include "content/common/child_process_info.h" 21 #include "content/common/child_process_info.h"
22 #include "content/common/debug_flags.h" 22 #include "content/common/debug_flags.h"
23 #include "sandbox/src/sandbox.h" 23 #include "sandbox/src/sandbox.h"
24 24
25 static sandbox::BrokerServices* g_broker_services = NULL; 25 static sandbox::BrokerServices* g_broker_services = NULL;
26 26
27 namespace { 27 namespace {
28 28
29 // The DLLs listed here are known (or under strong suspicion) of causing crashes 29 // The DLLs listed here are known (or under strong suspicion) of causing crashes
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 // Using a different prefetch profile per process type will allow Windows 387 // Using a different prefetch profile per process type will allow Windows
388 // to create separate pretetch settings for browser, renderer etc. 388 // to create separate pretetch settings for browser, renderer etc.
389 cmd_line->AppendArg(base::StringPrintf("/prefetch:%d", type)); 389 cmd_line->AppendArg(base::StringPrintf("/prefetch:%d", type));
390 390
391 sandbox::ResultCode result; 391 sandbox::ResultCode result;
392 PROCESS_INFORMATION target = {0}; 392 PROCESS_INFORMATION target = {0};
393 sandbox::TargetPolicy* policy = g_broker_services->CreatePolicy(); 393 sandbox::TargetPolicy* policy = g_broker_services->CreatePolicy();
394 394
395 if (type == ChildProcessInfo::PLUGIN_PROCESS && 395 if (type == ChildProcessInfo::PLUGIN_PROCESS &&
396 !browser_command_line.HasSwitch(switches::kNoSandbox) && 396 !browser_command_line.HasSwitch(switches::kNoSandbox) &&
397 content::GetContentClient()->browser()->SandboxPlugin(cmd_line, policy)) { 397 content::GetContentClient()->SandboxPlugin(cmd_line, policy)) {
398 in_sandbox = true; 398 in_sandbox = true;
399 AddDllEvictionPolicy(policy); 399 AddDllEvictionPolicy(policy);
400 } 400 }
401 401
402 if (!in_sandbox) { 402 if (!in_sandbox) {
403 policy->Release(); 403 policy->Release();
404 base::LaunchApp(*cmd_line, false, false, &process); 404 base::LaunchApp(*cmd_line, false, false, &process);
405 return process; 405 return process;
406 } 406 }
407 407
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 461
462 // Help the process a little. It can't start the debugger by itself if 462 // Help the process a little. It can't start the debugger by itself if
463 // the process is in a sandbox. 463 // the process is in a sandbox.
464 if (child_needs_help) 464 if (child_needs_help)
465 base::debug::SpawnDebuggerOnProcess(target.dwProcessId); 465 base::debug::SpawnDebuggerOnProcess(target.dwProcessId);
466 466
467 return process; 467 return process;
468 } 468 }
469 469
470 } // namespace sandbox 470 } // namespace sandbox
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698