electron/patches/common/chromium/proxy_config_monitor.patch

92 lines
3.5 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: deepak1556 <hop2deep@gmail.com>
Date: Thu, 18 Oct 2018 17:07:12 -0700
Subject: proxy_config_monitor.patch
Allow monitoring proxy config changes for a pref service.
diff --git a/chrome/browser/net/proxy_config_monitor.cc b/chrome/browser/net/proxy_config_monitor.cc
index 90a8b0895f10d59ade41cf156e3887c526123b29..26c1bc0e5859e832d03be7215d067312e2d691c0 100644
--- a/chrome/browser/net/proxy_config_monitor.cc
+++ b/chrome/browser/net/proxy_config_monitor.cc
@@ -5,9 +5,13 @@
#include "chrome/browser/net/proxy_config_monitor.h"
#include "build/build_config.h"
+#if 0
#include "chrome/browser/browser_process.h"
+#endif
#include "chrome/browser/net/proxy_service_factory.h"
+#if 0
#include "chrome/browser/profiles/profile.h"
+#endif
#include "components/proxy_config/pref_proxy_config_tracker_impl.h"
#include "content/public/browser/browser_thread.h"
#include "mojo/public/cpp/bindings/associated_interface_ptr.h"
@@ -15,7 +19,7 @@
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#endif // defined(OS_CHROMEOS)
-
+#if 0
ProxyConfigMonitor::ProxyConfigMonitor(Profile* profile) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(profile);
@@ -41,14 +45,13 @@ ProxyConfigMonitor::ProxyConfigMonitor(Profile* profile) {
proxy_config_service_->AddObserver(this);
}
+#endif
-ProxyConfigMonitor::ProxyConfigMonitor() {
+ProxyConfigMonitor::ProxyConfigMonitor(PrefService* local_prefs) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
-
pref_proxy_config_tracker_.reset(
ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState(
- g_browser_process->local_state()));
-
+ local_prefs));
proxy_config_service_ = ProxyServiceFactory::CreateProxyConfigService(
pref_proxy_config_tracker_.get());
diff --git a/chrome/browser/net/proxy_config_monitor.h b/chrome/browser/net/proxy_config_monitor.h
index b783ab18d2d77cb2d443eed36a508f1eac77c04d..4475b58756dbf686cf78f6e317e55bc1df783e8d 100644
--- a/chrome/browser/net/proxy_config_monitor.h
+++ b/chrome/browser/net/proxy_config_monitor.h
@@ -20,22 +20,24 @@ class ProxyConfigWithAnnotation;
class Profile;
class PrefProxyConfigTracker;
+class PrefService;
// Tracks the ProxyConfig to use, and passes any updates to a NetworkContext's
// ProxyConfigClient.
class ProxyConfigMonitor : public net::ProxyConfigService::Observer,
public network::mojom::ProxyConfigPollerClient {
public:
+#if 0
// Creates a ProxyConfigMonitor that gets proxy settings from |profile| and
// watches for changes. The created ProxyConfigMonitor must be destroyed
// before |profile|.
explicit ProxyConfigMonitor(Profile* profile);
-
+#endif
// Creates a ProxyConfigMonitor that gets proxy settings from the
// BrowserProcess's |local_state_|, for use with NetworkContexts not
// assocaited with a profile. Must be destroyed before the BrowserProcess's
// |local_state_|.
- ProxyConfigMonitor();
+ explicit ProxyConfigMonitor(PrefService* local_prefs);
~ProxyConfigMonitor() override;
@@ -63,7 +65,6 @@ class ProxyConfigMonitor : public net::ProxyConfigService::Observer,
std::unique_ptr<net::ProxyConfigService> proxy_config_service_;
// Monitors global and Profile prefs related to proxy configuration.
std::unique_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
-
mojo::BindingSet<network::mojom::ProxyConfigPollerClient> binding_set_;
mojo::InterfacePtrSet<network::mojom::ProxyConfigClient>