diff options
Diffstat (limited to 'src/core/content_browser_client_qt.cpp')
-rw-r--r-- | src/core/content_browser_client_qt.cpp | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index f5f490ccf..0c3acd37b 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -85,6 +85,11 @@ #include "web_engine_context.h" #include "web_engine_library_info.h" +#if defined(Q_OS_LINUX) +#include "global_descriptors_qt.h" +#include "ui/base/resource/resource_bundle.h" +#endif + #if defined(ENABLE_PLUGINS) #include "content/public/browser/browser_ppapi_host.h" #include "ppapi/host/ppapi_host.h" @@ -244,8 +249,9 @@ public: int PreCreateThreads() Q_DECL_OVERRIDE { base::ThreadRestrictions::SetIOAllowed(true); - // Like ChromeBrowserMainExtraPartsAura::PreCreateThreads does. - gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, new DesktopScreenQt); + // Like ChromeBrowserMainExtraPartsViews::PreCreateThreads does. + gfx::Screen::SetScreenInstance(new DesktopScreenQt); + return 0; } @@ -351,7 +357,7 @@ ContentBrowserClientQt *ContentBrowserClientQt::Get() content::BrowserMainParts *ContentBrowserClientQt::CreateBrowserMainParts(const content::MainFunctionParams&) { - m_browserMainParts = new BrowserMainPartsQt; + m_browserMainParts = new BrowserMainPartsQt(); return m_browserMainParts; } @@ -401,11 +407,6 @@ content::AccessTokenStore *ContentBrowserClientQt::CreateAccessTokenStore() return new AccessTokenStoreQt; } -net::URLRequestContextGetter* ContentBrowserClientQt::CreateRequestContext(content::BrowserContext* browser_context, content::ProtocolHandlerMap* protocol_handlers, content::URLRequestInterceptorScopedVector request_interceptors) -{ - return static_cast<BrowserContextQt*>(browser_context)->CreateRequestContext(protocol_handlers, std::move(request_interceptors)); -} - content::QuotaPermissionContext *ContentBrowserClientQt::CreateQuotaPermissionContext() { return new QuotaPermissionContextQt; @@ -461,6 +462,22 @@ void ContentBrowserClientQt::AppendExtraCommandLineSwitches(base::CommandLine* c command_line->AppendSwitchASCII(switches::kLang, GetApplicationLocale()); } +#if defined(Q_OS_LINUX) +void ContentBrowserClientQt::GetAdditionalMappedFilesForChildProcess(const base::CommandLine& command_line, int child_process_id, content::FileDescriptorInfo* mappings) +{ + const std::string &locale = GetApplicationLocale(); + const base::FilePath &locale_file_path = ui::ResourceBundle::GetSharedInstance().GetLocaleFilePath(locale, true); + if (locale_file_path.empty()) + return; + + // Open pak file of the current locale in the Browser process and pass its file descriptor to the sandboxed + // Renderer Process. FileDescriptorInfo is responsible for closing the file descriptor. + int flags = base::File::FLAG_OPEN | base::File::FLAG_READ; + base::File locale_file = base::File(locale_file_path, flags); + mappings->Transfer(kWebEngineLocale, base::ScopedFD(locale_file.TakePlatformFile())); +} +#endif + #if defined(ENABLE_PLUGINS) void ContentBrowserClientQt::DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) { browser_host->GetPpapiHost()->AddHostFactoryFilter( |