Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / content / shell / browser / shell_content_browser_client.cc
index 63243b4..21423d2 100644 (file)
@@ -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"
 #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 {
@@ -205,6 +211,9 @@ void ShellContentBrowserClient::AppendExtraCommandLineSwitches(
   if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree))
     command_line->AppendSwitch(switches::kDumpRenderTree);
   if (CommandLine::ForCurrentProcess()->HasSwitch(
+      switches::kEnableFontAntialiasing))
+    command_line->AppendSwitch(switches::kEnableFontAntialiasing);
+  if (CommandLine::ForCurrentProcess()->HasSwitch(
       switches::kExposeInternalsForTesting))
     command_line->AppendSwitch(switches::kExposeInternalsForTesting);
   if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kStableReleaseMode))
@@ -222,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(
@@ -244,12 +260,6 @@ std::string ShellContentBrowserClient::GetDefaultDownloadName() {
   return "download";
 }
 
-bool ShellContentBrowserClient::SupportsBrowserPlugin(
-    content::BrowserContext* browser_context, const GURL& url) {
-  return CommandLine::ForCurrentProcess()->HasSwitch(
-      switches::kEnableBrowserPluginForAllViewTypes);
-}
-
 WebContentsViewDelegate* ShellContentBrowserClient::GetWebContentsViewDelegate(
     WebContents* web_contents) {
 #if !defined(USE_AURA)
@@ -324,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();
 }