diff options
author | Pierre Rossi <pierre.rossi@digia.com> | 2014-04-01 16:39:33 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-02 00:08:04 +0200 |
commit | 770b2f68e72ce2b78ddb7dc272b9d455e5ba59b9 (patch) | |
tree | 4c78b6c258f0f6dc9694abc46f5b9a0b90fa60f1 /src/core | |
parent | c5431da0b11b2b73abee62751565a7d20757040f (diff) |
Add Chrome version to our user agent string
Some websites still rely on user agent strings to detect available
features in 2014 apparently.
Change-Id: If7240be15d6bfb24618bea0d45ed8dc0d7392af4
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'src/core')
-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); |