From 164f3839cc24d14590e11f898a39d4b05b90ce51 Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Mon, 2 Dec 2013 18:04:25 +0100 Subject: Use ContentMainDelegateQt also for child processes This will be necessary in order for the render process to load localized strings among other things. Change-Id: Ibb75e49f0bc583c158af61817e5b350f3534ec16 Reviewed-by: Andras Becsi --- src/core/web_engine_context.cpp | 51 +---------------------------------------- 1 file changed, 1 insertion(+), 50 deletions(-) (limited to 'src/core/web_engine_context.cpp') diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index e26027207..dbaa948bf 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -45,10 +45,8 @@ #include "base/command_line.h" #include "base/files/file_path.h" -#include "base/path_service.h" #include "base/run_loop.h" #include "base/threading/thread_restrictions.h" -#include "content/public/app/content_main_delegate.h" #include "content/public/app/content_main_runner.h" #include "content/public/browser/browser_main_runner.h" #include "content/public/common/content_paths.h" @@ -59,6 +57,7 @@ #include "content_browser_client_qt.h" #include "content_client_qt.h" +#include "content_main_delegate_qt.h" #include "type_conversion.h" #include #include @@ -68,55 +67,8 @@ namespace { scoped_refptr sContext; -static QByteArray subProcessPath() { - static bool initialized = false; -#ifdef QTWEBENGINEPROCESS_PATH - static QByteArray processPath(QTWEBENGINEPROCESS_PATH); -#else - static QByteArray processPath; -#endif - if (initialized) - return processPath; - // Allow overriding at runtime for the time being. - const QByteArray fromEnv = qgetenv("QTWEBENGINEPROCESS_PATH"); - if (!fromEnv.isEmpty()) - processPath = fromEnv; - if (processPath.isEmpty()) - qFatal("QTWEBENGINEPROCESS_PATH environment variable not set or empty."); - initialized = true; - return processPath; -} - } // namespace -class ContentMainDelegateQt : public content::ContentMainDelegate -{ -public: - - // This is where the embedder puts all of its startup code that needs to run - // before the sandbox is engaged. - void PreSandboxStartup() Q_DECL_OVERRIDE - { - PathService::Override(base::FILE_EXE, base::FilePath(toFilePathString(subProcessPath()))); - } - - content::ContentBrowserClient* CreateContentBrowserClient() Q_DECL_OVERRIDE - { - m_browserClient.reset(new ContentBrowserClientQt); - return m_browserClient.get(); - } - - bool BasicStartupComplete(int* exit_code) Q_DECL_OVERRIDE - { - SetContentClient(new ContentClientQt); - return false; - } - -private: - scoped_ptr m_browserClient; -}; - - WebEngineContext::~WebEngineContext() { m_runLoop->AfterRun(); @@ -161,7 +113,6 @@ WebEngineContext::WebEngineContext(WebContentsAdapterClient::RenderingMode rende CommandLine* parsedCommandLine = CommandLine::ForCurrentProcess(); parsedCommandLine->AppendSwitchASCII(switches::kUserAgent, webkit_glue::BuildUserAgentFromProduct("QtWebEngine/0.1")); - parsedCommandLine->AppendSwitchASCII(switches::kBrowserSubprocessPath, subProcessPath().constData()); parsedCommandLine->AppendSwitch(switches::kNoSandbox); parsedCommandLine->AppendSwitch(switches::kDisablePlugins); -- cgit v1.2.3