diff options
Diffstat (limited to 'extensions/shell')
-rw-r--r-- | extensions/shell/browser/shell_content_browser_client.cc | 36 | ||||
-rw-r--r-- | extensions/shell/browser/shell_content_browser_client.h | 5 |
2 files changed, 41 insertions, 0 deletions
diff --git a/extensions/shell/browser/shell_content_browser_client.cc b/extensions/shell/browser/shell_content_browser_client.cc index 4aba570..c5a8c07 100644 --- a/extensions/shell/browser/shell_content_browser_client.cc +++ b/extensions/shell/browser/shell_content_browser_client.cc @@ -40,6 +40,12 @@ #include "content/public/browser/child_process_data.h" #endif +#if defined(OS_WIN) +#include "base/path_service.h" +#include "sandbox/win/src/sandbox_policy.h" +#include "ui/gfx/win/direct_write.h" +#endif + using base::CommandLine; using content::BrowserContext; using content::BrowserThread; @@ -274,6 +280,36 @@ ShellContentBrowserClient::GetDevToolsManagerDelegate() { return new content::ShellDevToolsManagerDelegate(GetBrowserContext()); } +#if defined(OS_WIN) +// TODO(ananta) +// Consolidate the policy code below with similar code in +// content/shell/browser/shell_content_browser_client.h. +void ShellContentBrowserClient::PreSpawnRenderer(sandbox::TargetPolicy* policy, + bool* success) { + // If DirectWrite is enabled then we need to grant access to the + // Windows National Language support directory :- + // c:\windows\globalization\sorting. Not having access to this folder + // causes DirectWrite font cache setup to fail. + if (gfx::win::ShouldUseDirectWrite()) { + base::FilePath windows_root; + PathService::Get(base::DIR_WINDOWS, &windows_root); + base::string16 globalization_path = windows_root.value(); + globalization_path += L"\\Globalization\\Sorting"; + + policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, + sandbox::TargetPolicy::FILES_ALLOW_READONLY, + globalization_path.c_str()); + + // We need to grant access to subdirectories and files within the + // globalization directory. + globalization_path += L"\\*"; + policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, + sandbox::TargetPolicy::FILES_ALLOW_READONLY, + globalization_path.c_str()); + } +} +#endif + ShellBrowserMainParts* ShellContentBrowserClient::CreateShellBrowserMainParts( const content::MainFunctionParams& parameters, ShellBrowserMainDelegate* browser_main_delegate) { diff --git a/extensions/shell/browser/shell_content_browser_client.h b/extensions/shell/browser/shell_content_browser_client.h index f9d813f..44d1113 100644 --- a/extensions/shell/browser/shell_content_browser_client.h +++ b/extensions/shell/browser/shell_content_browser_client.h @@ -67,6 +67,11 @@ class ShellContentBrowserClient : public content::ContentBrowserClient { content::DevToolsManagerDelegate* GetDevToolsManagerDelegate() override; +#if defined(OS_WIN) + void PreSpawnRenderer(sandbox::TargetPolicy* policy, + bool* success) override; +#endif + protected: // Subclasses may wish to provide their own ShellBrowserMainParts. virtual ShellBrowserMainParts* CreateShellBrowserMainParts( |