summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJüri Valdmann <juri.valdmann@qt.io>2019-11-26 16:58:01 +0100
committerJüri Valdmann <juri.valdmann@qt.io>2019-12-05 10:01:17 +0100
commit8df5daf60b8b7eedf743430f8afbcb99eca27fbc (patch)
tree051db6813f8c1daf40a655728185dca5b75c3d36
parent34d03cc0f3efac0027ae928e2f5b5fe2d9612604 (diff)
Implement proxy config for network service
Change-Id: Iaf0d68394eb0555ee1a14a8b7488567645d0f2df Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--src/core/core_chromium.pri2
-rw-r--r--src/core/login_delegate_qt.cpp6
-rw-r--r--src/core/net/proxy_config_monitor.cpp125
-rw-r--r--src/core/net/proxy_config_monitor.h104
-rw-r--r--src/core/net/proxy_config_service_qt.cpp32
-rw-r--r--src/core/net/proxy_config_service_qt.h12
-rw-r--r--src/core/net/system_network_context_manager.cpp2
-rw-r--r--src/core/net/system_network_context_manager.h4
-rw-r--r--src/core/profile_io_data_qt.cpp20
-rw-r--r--src/core/profile_io_data_qt.h2
10 files changed, 283 insertions, 26 deletions
diff --git a/src/core/core_chromium.pri b/src/core/core_chromium.pri
index bf8e6b71e..09650d20a 100644
--- a/src/core/core_chromium.pri
+++ b/src/core/core_chromium.pri
@@ -85,6 +85,7 @@ SOURCES = \
net/custom_protocol_handler.cpp \
net/custom_url_loader_factory.cpp \
net/network_delegate_qt.cpp \
+ net/proxy_config_monitor.cpp \
net/proxy_config_service_qt.cpp \
net/proxying_url_loader_factory_qt.cpp \
net/proxying_restricted_cookie_manager_qt.cpp \
@@ -227,6 +228,7 @@ HEADERS = \
profile_adapter_client.h \
profile_qt.h \
profile_io_data_qt.h \
+ proxy_config_monitor.h \
proxy_config_service_qt.h \
quota_permission_context_qt.h \
quota_request_controller.h \
diff --git a/src/core/login_delegate_qt.cpp b/src/core/login_delegate_qt.cpp
index f63252112..80e2d9102 100644
--- a/src/core/login_delegate_qt.cpp
+++ b/src/core/login_delegate_qt.cpp
@@ -51,6 +51,8 @@
#include "content/public/browser/resource_dispatcher_host.h"
#include "content/public/browser/resource_request_info.h"
#include "extensions/buildflags/buildflags.h"
+#include "services/network/public/cpp/features.h"
+
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "extensions/browser/info_map.h"
#include "extensions/common/extension.h"
@@ -153,7 +155,9 @@ void LoginDelegateQt::sendAuthToRequester(bool success, const QString &user, con
std::move(m_auth_required_callback).Run(base::nullopt);
}
- destroy();
+ // With network service the auth callback has already deleted us.
+ if (!base::FeatureList::IsEnabled(network::features::kNetworkService))
+ destroy();
}
void LoginDelegateQt::destroy()
diff --git a/src/core/net/proxy_config_monitor.cpp b/src/core/net/proxy_config_monitor.cpp
new file mode 100644
index 000000000..818b6cb7f
--- /dev/null
+++ b/src/core/net/proxy_config_monitor.cpp
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// originally based on chrome/browser/net/proxy_config_monitor.cc
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "profile_qt.h"
+#include "proxy_config_monitor.h"
+#include "proxy_config_service_qt.h"
+
+#include "base/strings/utf_string_conversions.h"
+#include "base/task/post_task.h"
+#include "build/build_config.h"
+#include "components/proxy_config/pref_proxy_config_tracker_impl.h"
+#include "content/public/browser/browser_task_traits.h"
+#include "content/public/browser/browser_thread.h"
+#include "mojo/public/cpp/bindings/associated_interface_ptr.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "net/proxy_resolution/proxy_resolution_service.h"
+#include "services/network/public/mojom/network_context.mojom.h"
+
+#include <utility>
+
+using content::BrowserThread;
+
+ProxyConfigMonitor::ProxyConfigMonitor(PrefService *prefs)
+{
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+
+ proxy_config_service_.reset(
+ new ProxyConfigServiceQt(
+ prefs, base::CreateSingleThreadTaskRunnerWithTraits({ BrowserThread::UI })));
+
+ proxy_config_service_->AddObserver(this);
+}
+
+ProxyConfigMonitor::~ProxyConfigMonitor()
+{
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)
+ || !BrowserThread::IsThreadInitialized(BrowserThread::UI));
+ proxy_config_service_->RemoveObserver(this);
+}
+
+void ProxyConfigMonitor::AddToNetworkContextParams(
+ network::mojom::NetworkContextParams *network_context_params)
+{
+ network::mojom::ProxyConfigClientPtr proxy_config_client;
+ network_context_params->proxy_config_client_request = mojo::MakeRequest(&proxy_config_client);
+ proxy_config_client_set_.AddPtr(std::move(proxy_config_client));
+
+ poller_binding_set_.AddBinding(
+ this, mojo::MakeRequest(&network_context_params->proxy_config_poller_client));
+
+ net::ProxyConfigWithAnnotation proxy_config;
+ net::ProxyConfigService::ConfigAvailability availability =
+ proxy_config_service_->GetLatestProxyConfig(&proxy_config);
+ if (availability != net::ProxyConfigService::CONFIG_PENDING)
+ network_context_params->initial_proxy_config = proxy_config;
+}
+
+void ProxyConfigMonitor::OnProxyConfigChanged(
+ const net::ProxyConfigWithAnnotation &config,
+ net::ProxyConfigService::ConfigAvailability availability)
+{
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)
+ || !BrowserThread::IsThreadInitialized(BrowserThread::UI));
+ proxy_config_client_set_.ForAllPtrs(
+ [config, availability](network::mojom::ProxyConfigClient *proxy_config_client) {
+ switch (availability) {
+ case net::ProxyConfigService::CONFIG_VALID:
+ proxy_config_client->OnProxyConfigUpdated(config);
+ break;
+ case net::ProxyConfigService::CONFIG_UNSET:
+ proxy_config_client->OnProxyConfigUpdated(
+ net::ProxyConfigWithAnnotation::CreateDirect());
+ break;
+ case net::ProxyConfigService::CONFIG_PENDING:
+ NOTREACHED();
+ break;
+ }
+ });
+}
+
+void ProxyConfigMonitor::OnLazyProxyConfigPoll()
+{
+ proxy_config_service_->OnLazyPoll();
+}
diff --git a/src/core/net/proxy_config_monitor.h b/src/core/net/proxy_config_monitor.h
new file mode 100644
index 000000000..23f073a84
--- /dev/null
+++ b/src/core/net/proxy_config_monitor.h
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// originally based on chrome/browser/net/proxy_config_monitor.h
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PROXY_CONFIG_MONITOR_H
+#define PROXY_CONFIG_MONITOR_H
+
+#include <memory>
+#include <string>
+
+#include "base/macros.h"
+#include "build/buildflag.h"
+#include "extensions/buildflags/buildflags.h"
+#include "mojo/public/cpp/bindings/binding_set.h"
+#include "mojo/public/cpp/bindings/interface_ptr_set.h"
+#include "net/proxy_resolution/proxy_config_service.h"
+#include "services/network/public/mojom/network_context.mojom-forward.h"
+#include "services/network/public/mojom/network_service.mojom-forward.h"
+#include "services/network/public/mojom/proxy_config.mojom-forward.h"
+#include "services/network/public/mojom/proxy_config_with_annotation.mojom.h"
+
+namespace net {
+class ProxyConfigWithAnnotation;
+}
+
+class PrefService;
+class ProxyConfigServiceQt;
+
+// Tracks the ProxyConfig to use, and passes any updates to a NetworkContext's
+// ProxyConfigClient. This also responds to errors related to proxy settings
+// from the NetworkContext, and forwards them any listening Chrome extensions
+// associated with the profile.
+class ProxyConfigMonitor : public net::ProxyConfigService::Observer,
+ public network::mojom::ProxyConfigPollerClient
+{
+public:
+ explicit ProxyConfigMonitor(PrefService *prefs = nullptr);
+
+ ~ProxyConfigMonitor() override;
+
+ // Populates proxy-related fields of |network_context_params|. Updated
+ // ProxyConfigs will be sent to a NetworkContext created with those params
+ // whenever the configuration changes. Can be called more than once to inform
+ // multiple NetworkContexts of proxy changes.
+ void AddToNetworkContextParams(network::mojom::NetworkContextParams *network_context_params);
+
+private:
+ // net::ProxyConfigService::Observer implementation:
+ void OnProxyConfigChanged(const net::ProxyConfigWithAnnotation &config,
+ net::ProxyConfigService::ConfigAvailability availability) override;
+
+ // network::mojom::ProxyConfigPollerClient implementation:
+ void OnLazyProxyConfigPoll() override;
+
+ std::unique_ptr<ProxyConfigServiceQt> proxy_config_service_;
+
+ mojo::BindingSet<network::mojom::ProxyConfigPollerClient> poller_binding_set_;
+
+ mojo::InterfacePtrSet<network::mojom::ProxyConfigClient> proxy_config_client_set_;
+
+ DISALLOW_COPY_AND_ASSIGN(ProxyConfigMonitor);
+};
+
+#endif // !PROXY_CONFIG_MONITOR_H
diff --git a/src/core/net/proxy_config_service_qt.cpp b/src/core/net/proxy_config_service_qt.cpp
index 8016c7e83..59884961d 100644
--- a/src/core/net/proxy_config_service_qt.cpp
+++ b/src/core/net/proxy_config_service_qt.cpp
@@ -46,8 +46,9 @@
#include "proxy_config_service_qt.h"
#include "base/bind.h"
-#include "content/public/browser/browser_thread.h"
#include "components/proxy_config/pref_proxy_config_tracker_impl.h"
+#include "content/public/browser/browser_thread.h"
+#include "net/proxy_resolution/proxy_resolution_service.h"
using content::BrowserThread;
@@ -69,34 +70,40 @@ net::ProxyServer ProxyConfigServiceQt::fromQNetworkProxy(const QNetworkProxy &qt
}
}
-ProxyConfigServiceQt::ProxyConfigServiceQt(std::unique_ptr<ProxyConfigService> baseService,
- const net::ProxyConfigWithAnnotation &initialConfig,
- ProxyPrefs::ConfigState initialState)
- : m_baseService(baseService.release())
+ProxyConfigServiceQt::ProxyConfigServiceQt(PrefService *prefService,
+ const scoped_refptr<base::SingleThreadTaskRunner> &taskRunner)
+ : m_baseService(net::ProxyResolutionService::CreateSystemProxyConfigService(taskRunner))
, m_usesSystemConfiguration(false)
, m_registeredObserver(false)
- , m_prefConfig(initialConfig)
- , m_perfState(initialState)
-{}
+ , m_prefState(prefService
+ ? PrefProxyConfigTrackerImpl::ReadPrefConfig(prefService, &m_prefConfig)
+ : ProxyPrefs::CONFIG_UNSET)
+{
+ DETACH_FROM_SEQUENCE(m_sequenceChecker);
+}
ProxyConfigServiceQt::~ProxyConfigServiceQt()
{
+ DCHECK_CALLED_ON_VALID_SEQUENCE(m_sequenceChecker);
if (m_registeredObserver && m_baseService.get())
m_baseService->RemoveObserver(this);
}
void ProxyConfigServiceQt::AddObserver(net::ProxyConfigService::Observer *observer)
{
+ DCHECK_CALLED_ON_VALID_SEQUENCE(m_sequenceChecker);
m_observers.AddObserver(observer);
}
void ProxyConfigServiceQt::RemoveObserver(net::ProxyConfigService::Observer *observer)
{
+ DCHECK_CALLED_ON_VALID_SEQUENCE(m_sequenceChecker);
m_observers.RemoveObserver(observer);
}
net::ProxyConfigService::ConfigAvailability ProxyConfigServiceQt::GetLatestProxyConfig(net::ProxyConfigWithAnnotation *config)
{
+ DCHECK_CALLED_ON_VALID_SEQUENCE(m_sequenceChecker);
m_usesSystemConfiguration = QNetworkProxyFactory::usesSystemConfiguration();
if (m_usesSystemConfiguration) {
// Use Chromium's base service to retrieve system settings
@@ -106,7 +113,7 @@ net::ProxyConfigService::ConfigAvailability ProxyConfigServiceQt::GetLatestProxy
systemAvailability = m_baseService->GetLatestProxyConfig(&systemConfig);
ProxyPrefs::ConfigState configState;
systemAvailability = PrefProxyConfigTrackerImpl::GetEffectiveProxyConfig(
- m_perfState, m_prefConfig, systemAvailability, systemConfig,
+ m_prefState, m_prefConfig, systemAvailability, systemConfig,
false, &configState, config);
RegisterObserver();
return systemAvailability;
@@ -151,7 +158,7 @@ net::ProxyConfigService::ConfigAvailability ProxyConfigServiceQt::GetLatestProxy
void ProxyConfigServiceQt::OnLazyPoll()
{
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CALLED_ON_VALID_SEQUENCE(m_sequenceChecker);
// We need to update if
// - setUseSystemConfiguration() was called in between
@@ -168,7 +175,7 @@ void ProxyConfigServiceQt::OnLazyPoll()
// Called when the base service changed
void ProxyConfigServiceQt::OnProxyConfigChanged(const net::ProxyConfigWithAnnotation &config, ConfigAvailability availability)
{
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CALLED_ON_VALID_SEQUENCE(m_sequenceChecker);
Q_UNUSED(config);
if (!m_usesSystemConfiguration)
@@ -180,6 +187,7 @@ void ProxyConfigServiceQt::OnProxyConfigChanged(const net::ProxyConfigWithAnnota
// Update our observers
void ProxyConfigServiceQt::Update()
{
+ DCHECK_CALLED_ON_VALID_SEQUENCE(m_sequenceChecker);
net::ProxyConfigWithAnnotation actual_config;
ConfigAvailability availability = GetLatestProxyConfig(&actual_config);
if (availability == CONFIG_PENDING)
@@ -193,7 +201,7 @@ void ProxyConfigServiceQt::Update()
// in the constructor.
void ProxyConfigServiceQt::RegisterObserver()
{
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CALLED_ON_VALID_SEQUENCE(m_sequenceChecker);
if (!m_registeredObserver && m_baseService.get()) {
m_baseService->AddObserver(this);
m_registeredObserver = true;
diff --git a/src/core/net/proxy_config_service_qt.h b/src/core/net/proxy_config_service_qt.h
index 4d8619055..c0928bc03 100644
--- a/src/core/net/proxy_config_service_qt.h
+++ b/src/core/net/proxy_config_service_qt.h
@@ -42,6 +42,7 @@
#include "base/memory/ref_counted.h"
#include "base/observer_list.h"
+#include "base/single_thread_task_runner.h"
#include "net/proxy_resolution/proxy_config.h"
#include "net/proxy_resolution/proxy_config_service.h"
@@ -50,6 +51,8 @@
#include <QNetworkProxy>
+class PrefService;
+
class ProxyConfigServiceQt
: public net::ProxyConfigService
, public net::ProxyConfigService::Observer
@@ -57,9 +60,8 @@ class ProxyConfigServiceQt
public:
static net::ProxyServer fromQNetworkProxy(const QNetworkProxy &);
- explicit ProxyConfigServiceQt(std::unique_ptr<ProxyConfigService> baseService,
- const net::ProxyConfigWithAnnotation &initialConfig,
- ProxyPrefs::ConfigState initialState);
+ explicit ProxyConfigServiceQt(PrefService *prefService,
+ const scoped_refptr<base::SingleThreadTaskRunner> &taskRunner);
~ProxyConfigServiceQt() override;
// ProxyConfigService implementation:
@@ -92,7 +94,9 @@ private:
// Configuration as defined by prefs.
net::ProxyConfigWithAnnotation m_prefConfig;
- ProxyPrefs::ConfigState m_perfState;
+ ProxyPrefs::ConfigState m_prefState;
+
+ SEQUENCE_CHECKER(m_sequenceChecker);
DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceQt);
};
diff --git a/src/core/net/system_network_context_manager.cpp b/src/core/net/system_network_context_manager.cpp
index d82187205..cf84b840b 100644
--- a/src/core/net/system_network_context_manager.cpp
+++ b/src/core/net/system_network_context_manager.cpp
@@ -345,7 +345,7 @@ network::mojom::NetworkContextParamsPtr SystemNetworkContextManager::CreateNetwo
network_context_params->primary_network_context = true;
- // proxy_config_monitor_.AddToNetworkContextParams(network_context_params.get());
+ proxy_config_monitor_.AddToNetworkContextParams(network_context_params.get());
return network_context_params;
}
diff --git a/src/core/net/system_network_context_manager.h b/src/core/net/system_network_context_manager.h
index f293b8e12..288af5195 100644
--- a/src/core/net/system_network_context_manager.h
+++ b/src/core/net/system_network_context_manager.h
@@ -58,6 +58,8 @@
#include "services/network/public/mojom/ssl_config.mojom-forward.h"
#include "services/network/public/mojom/url_loader_factory.mojom-forward.h"
+#include "net/proxy_config_monitor.h"
+
namespace network {
namespace mojom {
class URLLoaderFactory;
@@ -177,6 +179,8 @@ private:
scoped_refptr<URLLoaderFactoryForSystem> shared_url_loader_factory_;
network::mojom::URLLoaderFactoryPtr url_loader_factory_;
+ ProxyConfigMonitor proxy_config_monitor_;
+
DISALLOW_COPY_AND_ASSIGN(SystemNetworkContextManager);
};
diff --git a/src/core/profile_io_data_qt.cpp b/src/core/profile_io_data_qt.cpp
index 2d0bee8d5..bf760c53d 100644
--- a/src/core/profile_io_data_qt.cpp
+++ b/src/core/profile_io_data_qt.cpp
@@ -225,6 +225,7 @@ void ProfileIODataQt::shutdownOnUIThread()
#endif
if (m_cookieDelegate)
m_cookieDelegate->unsetMojoCookieManager();
+ m_proxyConfigMonitor.reset();
bool posted = content::BrowserThread::DeleteSoon(content::BrowserThread::IO, FROM_HERE, this);
if (!posted) {
qWarning() << "Could not delete ProfileIODataQt on io thread !";
@@ -293,7 +294,10 @@ void ProfileIODataQt::initializeOnUIThread()
m_protocolHandlerRegistryIOThreadDelegate = protocolHandlerRegistry->io_thread_delegate();
m_cookieDelegate = new CookieMonsterDelegateQt();
m_cookieDelegate->setClient(m_profile->profileAdapter()->cookieStore());
- createProxyConfig();
+ if (base::FeatureList::IsEnabled(network::features::kNetworkService))
+ m_proxyConfigMonitor.reset(new ProxyConfigMonitor(m_profile->GetPrefs()));
+ else
+ createProxyConfig();
}
void ProfileIODataQt::cancelAllUrlRequests()
@@ -649,7 +653,8 @@ void ProfileIODataQt::requestStorageGeneration() {
const std::lock_guard<QRecursiveMutex> lock(m_mutex);
if (m_initialized && !m_updateAllStorage) {
m_updateAllStorage = true;
- createProxyConfig();
+ if (!base::FeatureList::IsEnabled(network::features::kNetworkService))
+ createProxyConfig();
base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO},
base::BindOnce(&ProfileIODataQt::generateAllStorage, m_weakPtr));
}
@@ -658,20 +663,17 @@ void ProfileIODataQt::requestStorageGeneration() {
// TODO(miklocek): mojofy ProxyConfigServiceQt
void ProfileIODataQt::createProxyConfig()
{
+ Q_ASSERT(!base::FeatureList::IsEnabled(network::features::kNetworkService));
Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
const std::lock_guard<QRecursiveMutex> lock(m_mutex);
// We must create the proxy config service on the UI loop on Linux because it
// must synchronously run on the glib message loop. This will be passed to
// the URLRequestContextStorage on the IO thread in GetURLRequestContext().
Q_ASSERT(m_proxyConfigService == 0);
- net::ProxyConfigWithAnnotation initialConfig;
- ProxyPrefs::ConfigState initialConfigState = PrefProxyConfigTrackerImpl::ReadPrefConfig(
- m_profileAdapter->profile()->GetPrefs(), &initialConfig);
m_proxyConfigService =
new ProxyConfigServiceQt(
- net::ProxyResolutionService::CreateSystemProxyConfigService(
- base::CreateSingleThreadTaskRunnerWithTraits({content::BrowserThread::IO})),
- initialConfig, initialConfigState);
+ m_profileAdapter->profile()->GetPrefs(),
+ base::CreateSingleThreadTaskRunnerWithTraits({content::BrowserThread::IO}));
//pass interface to io thread
m_proxyResolverFactoryInterface = ChromeMojoProxyResolverFactory::CreateWithSelfOwnedReceiver();
}
@@ -896,6 +898,8 @@ network::mojom::NetworkContextParamsPtr ProfileIODataQt::CreateNetworkContextPar
m_profile->GetSharedCorsOriginAccessList()->GetOriginAccessList().CreateCorsOriginAccessPatternsList();
}
+ m_proxyConfigMonitor->AddToNetworkContextParams(&*network_context_params);
+
return network_context_params;
}
diff --git a/src/core/profile_io_data_qt.h b/src/core/profile_io_data_qt.h
index 451929afd..882602012 100644
--- a/src/core/profile_io_data_qt.h
+++ b/src/core/profile_io_data_qt.h
@@ -47,6 +47,7 @@
#include "chrome/browser/custom_handlers/protocol_handler_registry.h"
#include "extensions/buildflags/buildflags.h"
#include "mojo/public/cpp/bindings/strong_binding_set.h"
+#include "net/proxy_config_monitor.h"
#include "services/network/cookie_settings.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "services/network/public/mojom/restricted_cookie_manager.mojom.h"
@@ -197,6 +198,7 @@ private:
QPointer<ProfileAdapter> m_profileAdapter; // never dereferenced in IO thread and it is passed by qpointer
ProfileAdapter::PersistentCookiesPolicy m_persistentCookiesPolicy;
mojo::StrongBindingSet<network::mojom::RestrictedCookieManager> m_restrictedCookieManagerBindings;
+ std::unique_ptr<ProxyConfigMonitor> m_proxyConfigMonitor;
#if QT_CONFIG(ssl)
ClientCertificateStoreData *m_clientCertificateStoreData;