diff options
-rw-r--r-- | src/core/qtwebengine.gypi | 4 | ||||
-rw-r--r-- | src/core/web_engine_context.cpp | 8 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/core/qtwebengine.gypi b/src/core/qtwebengine.gypi index a64760fc3..fee9d37dd 100644 --- a/src/core/qtwebengine.gypi +++ b/src/core/qtwebengine.gypi @@ -2,6 +2,9 @@ # This asks gyp to generate a .pri file with linking # information so that qmake can take care of the deployment. 'let_qmake_do_the_linking': 1, + 'variables': { + 'version_script_location%': '<(chromium_src_dir)/chrome/tools/build/version.py', + }, 'dependencies': [ '<(chromium_src_dir)/content/content.gyp:content', '<(chromium_src_dir)/content/content.gyp:content_app_browser', @@ -34,6 +37,7 @@ 'defines': [ '__STDC_CONSTANT_MACROS', '__STDC_FORMAT_MACROS', + 'CHROMIUM_VERSION=\"<!(python <(version_script_location) -f <(chromium_src_dir)/chrome/VERSION -t "@MAJOR@.@MINOR@.@BUILD@.@PATCH@")\"', ], 'msvs_settings': { 'VCLinkerTool': { diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 87a28e9d7..1d4067fda 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -117,6 +117,11 @@ WebContentsAdapterClient::RenderingMode WebEngineContext::renderingMode() : WebContentsAdapterClient::SoftwareRenderingMode; } +#ifndef CHROMIUM_VERSION +#error Chromium version should be defined at gyp-time. Something must have gone wrong +#define CHROMIUM_VERSION // This is solely to keep Qt Creator happy. +#endif + WebEngineContext::WebEngineContext(WebContentsAdapterClient::RenderingMode renderingMode) : m_mainDelegate(new ContentMainDelegateQt) , m_contentRunner(content::ContentMainRunner::Create()) @@ -132,7 +137,8 @@ WebEngineContext::WebEngineContext(WebContentsAdapterClient::RenderingMode rende CommandLine::Init(argv.size(), argv.constData()); CommandLine* parsedCommandLine = CommandLine::ForCurrentProcess(); - parsedCommandLine->AppendSwitchASCII(switches::kUserAgent, webkit_glue::BuildUserAgentFromProduct("QtWebEngine/0.1")); + // Mention the Chromium version we're based on to get passed stupid UA-string-based feature detection (several WebRTC demos need this) + parsedCommandLine->AppendSwitchASCII(switches::kUserAgent, webkit_glue::BuildUserAgentFromProduct("QtWebEngine/0.1 Chrome/" CHROMIUM_VERSION)); parsedCommandLine->AppendSwitchPath(switches::kBrowserSubprocessPath, WebEngineLibraryInfo::getPath(content::CHILD_PROCESS_EXE)); parsedCommandLine->AppendSwitch(switches::kNoSandbox); parsedCommandLine->AppendSwitch(switches::kDisablePlugins); |