diff options
Diffstat (limited to 'src')
m--------- | src/3rdparty | 0 | ||||
-rw-r--r-- | src/core/profile_adapter.cpp | 13 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/3rdparty b/src/3rdparty -Subproject 563ed58251011ce1af0fa1e3742fc8f476755f2 +Subproject 07787da493d9a71b994582904a188a53aae9e47 diff --git a/src/core/profile_adapter.cpp b/src/core/profile_adapter.cpp index 7387cc421..e9e2a2c5d 100644 --- a/src/core/profile_adapter.cpp +++ b/src/core/profile_adapter.cpp @@ -352,16 +352,21 @@ QString ProfileAdapter::httpUserAgent() const void ProfileAdapter::setHttpUserAgent(const QString &userAgent) { - if (m_httpUserAgent == userAgent) + const QString httpUserAgent = userAgent.simplified(); + if (m_httpUserAgent == httpUserAgent) return; - m_httpUserAgent = userAgent.simplified(); + m_httpUserAgent = httpUserAgent; + const std::string stdUserAgent = httpUserAgent.toStdString(); std::vector<content::WebContentsImpl *> list = content::WebContentsImpl::GetAllWebContents(); for (content::WebContentsImpl *web_contents : list) if (web_contents->GetBrowserContext() == m_profile.data()) - web_contents->SetUserAgentOverride(m_httpUserAgent.toStdString(), true); + web_contents->SetUserAgentOverride(stdUserAgent, true); - m_profile->m_profileIOData->resetNetworkContext(); + content::BrowserContext::ForEachStoragePartition( + m_profile.get(), base::BindRepeating([](const std::string &user_agent, content::StoragePartition *storage_partition) { + storage_partition->GetNetworkContext()->SetUserAgent(user_agent); + }, stdUserAgent)); } ProfileAdapter::HttpCacheType ProfileAdapter::httpCacheType() const |