Commit 4bac2cb5 authored by Allan Sandfeld Jensen's avatar Allan Sandfeld Jensen
Browse files

Fix Http User-agent string setting


Chromium has multiple places where it reads the user-agent, we were
only setting one, which appears to no longer be used for most cases.
This instead sets it by using the webcontent user-agent override.

Change-Id: I77d4d0a21424feda7a18140fb72baacdd6f816ca
Reviewed-by: default avatarPierre Rossi <pierre.rossi@theqtcompany.com>
Showing with 2 additions and 0 deletions
......@@ -392,6 +392,7 @@ void WebContentsAdapter::initialize(WebContentsAdapterClient *adapterClient)
// Qt returns a flash time (the whole cycle) in ms, chromium expects just the interval in seconds
const int qtCursorFlashTime = QGuiApplication::styleHints()->cursorFlashTime();
rendererPrefs->caret_blink_interval = 0.5 * static_cast<double>(qtCursorFlashTime) / 1000;
rendererPrefs->user_agent_override = d->browserContextAdapter->httpUserAgent().toStdString();
d->webContents->GetRenderViewHost()->SyncRendererPrefs();
// Create and attach observers to the WebContents.
......@@ -469,6 +470,7 @@ void WebContentsAdapter::load(const QUrl &url)
Q_D(WebContentsAdapter);
content::NavigationController::LoadURLParams params(toGurl(url));
params.transition_type = ui::PageTransitionFromInt(ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR);
params.override_user_agent = content::NavigationController::UA_OVERRIDE_TRUE;
d->webContents->GetController().LoadURLWithParams(params);
d->webContents->Focus();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment