diff options
author | mpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-15 22:23:43 +0000 |
---|---|---|
committer | mpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-15 22:23:43 +0000 |
commit | 1fca149ca717c64ae05edb534a61a909dc0a6d11 (patch) | |
tree | 6972a9efe49eba842a77cdeb98be8ac2caba8d27 /chrome/browser/sandbox_policy.cc | |
parent | 20a85780ae0ae9b8467b10146044fec8c1144e77 (diff) | |
download | chromium_src-1fca149ca717c64ae05edb534a61a909dc0a6d11.zip chromium_src-1fca149ca717c64ae05edb534a61a909dc0a6d11.tar.gz chromium_src-1fca149ca717c64ae05edb534a61a909dc0a6d11.tar.bz2 |
Introducing the Utility process, which handles the unpacking and verification
of extension packages.
This is a first pass. In the second pass, I will add support for transcoding
the manifest and any images in the browser process.
BUG=11680
Review URL: http://codereview.chromium.org/114027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16198 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sandbox_policy.cc')
-rw-r--r-- | chrome/browser/sandbox_policy.cc | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/chrome/browser/sandbox_policy.cc b/chrome/browser/sandbox_policy.cc index 32c1f44..a50e01b 100644 --- a/chrome/browser/sandbox_policy.cc +++ b/chrome/browser/sandbox_policy.cc @@ -244,7 +244,6 @@ bool ApplyPolicyForUntrustedPlugin(sandbox::TargetPolicy* policy) { sandbox::TargetPolicy::FILES_ALLOW_ANY, policy)) return false; - if (!AddDirectoryAndChildren(base::DIR_APP_DATA, NULL, sandbox::TargetPolicy::FILES_ALLOW_READONLY, policy)) @@ -343,6 +342,11 @@ void AddPolicyForRenderer(HDESK desktop, sandbox::TargetPolicy* policy) { namespace sandbox { base::ProcessHandle StartProcess(CommandLine* cmd_line) { + return StartProcessWithAccess(cmd_line, FilePath()); +} + +base::ProcessHandle StartProcessWithAccess(CommandLine* cmd_line, + const FilePath& exposed_dir) { base::ProcessHandle process = 0; const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); ChildProcessInfo::ProcessType type; @@ -353,6 +357,8 @@ base::ProcessHandle StartProcess(CommandLine* cmd_line) { type = ChildProcessInfo::PLUGIN_PROCESS; } else if (type_str == switches::kWorkerProcess) { type = ChildProcessInfo::WORKER_PROCESS; + } else if (type_str == switches::kUtilityProcess) { + type = ChildProcessInfo::UTILITY_PROCESS; } else { NOTREACHED(); return 0; @@ -395,6 +401,21 @@ base::ProcessHandle StartProcess(CommandLine* cmd_line) { AddPolicyForRenderer(desktop, policy); } + if (!exposed_dir.empty()) { + result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, + sandbox::TargetPolicy::FILES_ALLOW_ANY, + exposed_dir.ToWStringHack().c_str()); + if (result != sandbox::SBOX_ALL_OK) + return 0; + + FilePath exposed_files = exposed_dir.AppendASCII("*"); + result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, + sandbox::TargetPolicy::FILES_ALLOW_ANY, + exposed_files.ToWStringHack().c_str()); + if (result != sandbox::SBOX_ALL_OK) + return 0; + } + if (!AddGenericPolicy(policy)) { NOTREACHED(); if (desktop) |