Index: content/shell/browser/shell_content_browser_client.cc |
diff --git a/content/shell/browser/shell_content_browser_client.cc b/content/shell/browser/shell_content_browser_client.cc |
index 288b274456e67688907c8d67020d4151c6fdc5e2..d4394f3ef5b12bbd2557cced12490f4b99ae8f05 100644 |
--- a/content/shell/browser/shell_content_browser_client.cc |
+++ b/content/shell/browser/shell_content_browser_client.cc |
@@ -9,6 +9,7 @@ |
#include "base/file_util.h" |
#include "base/files/file.h" |
#include "base/path_service.h" |
+#include "base/strings/utf_string_conversions.h" |
#include "content/public/browser/render_process_host.h" |
#include "content/public/browser/resource_dispatcher_host.h" |
#include "content/public/browser/storage_partition.h" |
@@ -47,6 +48,11 @@ |
#include "content/public/common/content_descriptors.h" |
#endif |
+#if defined(OS_WIN) |
+#include "content/common/sandbox_win.h" |
+#include "sandbox/win/src/sandbox.h" |
+#endif |
+ |
namespace content { |
namespace { |
@@ -225,6 +231,13 @@ void ShellContentBrowserClient::AppendExtraCommandLineSwitches( |
if (CommandLine::ForCurrentProcess()->HasSwitch( |
switches::kEnableLeakDetection)) |
command_line->AppendSwitch(switches::kEnableLeakDetection); |
+ if (CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kRegisterFontFiles)) { |
+ command_line->AppendSwitchASCII( |
+ switches::kRegisterFontFiles, |
+ CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
+ switches::kRegisterFontFiles)); |
+ } |
} |
void ShellContentBrowserClient::OverrideWebkitPrefs( |
@@ -321,6 +334,22 @@ void ShellContentBrowserClient::GetAdditionalMappedFilesForChildProcess( |
} |
#endif // defined(OS_POSIX) && !defined(OS_MACOSX) |
+#if defined(OS_WIN) |
+void ShellContentBrowserClient::PreSpawnRenderer(sandbox::TargetPolicy* policy, |
+ bool* success) { |
+ // Add sideloaded font files for testing. See also DIR_WINDOWS_FONTS |
+ // addition in |StartSandboxedProcess|. |
+ std::vector<std::string> font_files = GetSideloadFontFiles(); |
+ for (std::vector<std::string>::const_iterator i(font_files.begin()); |
+ i != font_files.end(); |
+ ++i) { |
+ policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, |
+ sandbox::TargetPolicy::FILES_ALLOW_READONLY, |
+ base::UTF8ToWide(*i).c_str()); |
+ } |
+} |
+#endif // OS_WIN |
+ |
ShellBrowserContext* ShellContentBrowserClient::browser_context() { |
return shell_browser_main_parts_->browser_context(); |
} |