summaryrefslogtreecommitdiffstats
path: root/src/core/web_engine_context.cpp
diff options
context:
space:
mode:
authorPierre Rossi <pierre.rossi@digia.com>2013-12-02 18:04:25 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-03 11:56:56 +0100
commit164f3839cc24d14590e11f898a39d4b05b90ce51 (patch)
tree1e3a72c9d7cff5629f533f2b408f488118709cef /src/core/web_engine_context.cpp
parent32fffe6b2f8a5e44b6f8d3056104c2010726037c (diff)
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 <andras.becsi@digia.com>
Diffstat (limited to 'src/core/web_engine_context.cpp')
-rw-r--r--src/core/web_engine_context.cpp51
1 files changed, 1 insertions, 50 deletions
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 <QGuiApplication>
#include <QStringList>
@@ -68,55 +67,8 @@ namespace {
scoped_refptr<WebEngineContext> 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<ContentBrowserClientQt> 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);