Index: content/common/sandbox_win.cc |
diff --git a/content/common/sandbox_win.cc b/content/common/sandbox_win.cc |
index aea586054e51329e97627abc203ac3cfdb7f2b06..f8ce64292ff28e1a9bbaa166b5433a9036b68ca4 100644 |
--- a/content/common/sandbox_win.cc |
+++ b/content/common/sandbox_win.cc |
@@ -571,6 +571,16 @@ bool InitTargetServices(sandbox::TargetServices* target_services) { |
return sandbox::SBOX_ALL_OK == result; |
} |
+bool ShouldUseDirectWrite() { |
+ // If the flag is currently on, and we're on Win7 or above, we enable |
+ // DirectWrite. Skia does not require the additions to DirectWrite |
+ // in QFE 2670838, so a Win7 check is sufficient. We don't not currently |
+ // attempt to support Vista, where SP2 and the Platform Update are required. |
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
+ return command_line.HasSwitch(switches::kEnableDirectWrite) && |
+ base::win::GetVersion() >= base::win::VERSION_WIN7; |
+} |
+ |
base::ProcessHandle StartSandboxedProcess( |
SandboxedProcessLauncherDelegate* delegate, |
CommandLine* cmd_line) { |
@@ -637,7 +647,19 @@ base::ProcessHandle StartSandboxedProcess( |
if (!disable_default_policy && !AddPolicyForSandboxedProcess(policy)) |
return 0; |
- if (type_str != switches::kRendererProcess) { |
+ if (type_str == switches::kRendererProcess) { |
+ if (ShouldUseDirectWrite()) { |
+ AddDirectory(base::DIR_WINDOWS_FONTS, |
+ NULL, |
+ true, |
+ sandbox::TargetPolicy::FILES_ALLOW_READONLY, |
+ policy); |
+ // We do not automatically propagate this from the browser command line, |
+ // and instead only add it when we're actually setting up the sandbox to |
+ // work with DirectWrite. |
+ cmd_line->AppendSwitch(switches::kEnableDirectWrite); |
+ } |
+ } else { |
// Hack for Google Desktop crash. Trick GD into not injecting its DLL into |
// this subprocess. See |
// http://code.google.com/p/chromium/issues/detail?id=25580 |