Chromium Code Reviews| Index: chrome/browser/chrome_browser_main_win.cc |
| =================================================================== |
| --- chrome/browser/chrome_browser_main_win.cc (revision 188735) |
| +++ chrome/browser/chrome_browser_main_win.cc (working copy) |
| @@ -42,10 +42,12 @@ |
| #include "chrome/installer/util/l10n_string_util.h" |
| #include "chrome/installer/util/shell_util.h" |
| #include "content/public/common/main_function_params.h" |
| +#include "content/public/common/sandbox_init.h" |
| #include "grit/app_locale_settings.h" |
| #include "grit/chromium_strings.h" |
| #include "grit/generated_resources.h" |
| #include "installer_util_strings/installer_util_strings.h" |
| +#include "sandbox/win/src/sandbox_policy.h" |
| #include "ui/base/l10n/l10n_util.h" |
| #include "ui/base/l10n/l10n_util_win.h" |
| #include "ui/base/ui_base_switches.h" |
| @@ -86,6 +88,31 @@ |
| virtual string16 GetLocalizedString(int installer_string_id) OVERRIDE; |
| }; |
|
cpu_(ooo_6.6-7.5)
2013/03/18 19:46:26
this function looks really ugly here, isn't a bett
jam
2013/03/18 19:50:19
I agree this is a bit of an odd function. I think
|
| +void AddNaClPolicyCallback(CommandLine* cmd_line, |
| + sandbox::TargetPolicy* policy) { |
| + if (cmd_line->GetSwitchValueASCII(switches::kProcessType) != |
| + switches::kRendererProcess) { |
| + return; |
| + } |
| + |
| + // This code is duplicated in nacl_exe_win_64.cc. |
| + // Allow the server side of a pipe restricted to the "chrome.nacl." |
| + // namespace so that it cannot impersonate other system or other chrome |
| + // service pipes. |
| + sandbox::ResultCode result = policy->AddRule( |
| + sandbox::TargetPolicy::SUBSYS_NAMED_PIPES, |
| + sandbox::TargetPolicy::NAMEDPIPES_ALLOW_ANY, |
| + L"\\\\.\\pipe\\chrome.nacl.*"); |
| + CHECK(result == sandbox::SBOX_ALL_OK); |
| + |
| + // Renderers need to send named pipe handles and shared memory |
| + // segment handles to NaCl loader processes. |
| + result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_HANDLES, |
| + sandbox::TargetPolicy::HANDLES_DUP_ANY, |
| + L"File"); |
| + CHECK(result == sandbox::SBOX_ALL_OK); |
| +} |
| + |
| } // namespace |
| void RecordBreakpadStatusUMA(MetricsService* metrics) { |
| @@ -215,6 +242,9 @@ |
| tsf_message_filter.PassAs<MessageLoopForUI::MessageFilter>()); |
| } |
| } |
| + |
| + content::SetSandboxedProcessStartingCallback( |
| + base::Bind(AddNaClPolicyCallback)); |
| } |
| void ChromeBrowserMainPartsWin::PreMainMessageLoopRun() { |