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

Unified Diff: content/shell/browser/shell_content_browser_client.cc

Issue 231763003: Support sideloaded fonts via command line option for blink layout_tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: guard for xp Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/shell/browser/shell_content_browser_client.h ('k') | content/shell/common/shell_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « content/shell/browser/shell_content_browser_client.h ('k') | content/shell/common/shell_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698