Index: chromecast/browser/url_request_context_factory.cc |
diff --git a/chromecast/browser/url_request_context_factory.cc b/chromecast/browser/url_request_context_factory.cc |
index f9119ad611cbc88d7ef9c5a46993f54370d1952e..d267f20efe5085c98405adb90c657d1b398af281 100644 |
--- a/chromecast/browser/url_request_context_factory.cc |
+++ b/chromecast/browser/url_request_context_factory.cc |
@@ -4,6 +4,7 @@ |
#include "chromecast/browser/url_request_context_factory.h" |
+#include <algorithm> |
#include <utility> |
#include "base/command_line.h" |
@@ -12,8 +13,10 @@ |
#include "base/memory/ptr_util.h" |
#include "base/threading/worker_pool.h" |
#include "chromecast/base/chromecast_switches.h" |
+#include "chromecast/browser/cast_browser_process.h" |
#include "chromecast/browser/cast_http_user_agent_settings.h" |
#include "chromecast/browser/cast_network_delegate.h" |
+#include "components/proxy_config/pref_proxy_config_tracker_impl.h" |
#include "content/public/browser/browser_context.h" |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/cookie_store_factory.h" |
@@ -169,6 +172,7 @@ URLRequestContextFactory::URLRequestContextFactory() |
enable_quic_(true) {} |
URLRequestContextFactory::~URLRequestContextFactory() { |
+ pref_proxy_config_tracker_impl_->DetachFromPrefService(); |
} |
void URLRequestContextFactory::InitializeOnUIThread(net::NetLog* net_log) { |
@@ -180,12 +184,17 @@ void URLRequestContextFactory::InitializeOnUIThread(net::NetLog* net_log) { |
// Proxy config service should be initialized in UI thread, since |
// ProxyConfigServiceDelegate on Android expects UI thread. |
- proxy_config_service_ = net::ProxyService::CreateSystemProxyConfigService( |
- content::BrowserThread::GetTaskRunnerForThread( |
- content::BrowserThread::IO), |
- content::BrowserThread::GetTaskRunnerForThread( |
- content::BrowserThread::FILE)); |
- |
+ pref_proxy_config_tracker_impl_ = |
+ base::WrapUnique<PrefProxyConfigTrackerImpl>( |
+ new PrefProxyConfigTrackerImpl( |
+ CastBrowserProcess::GetInstance()->pref_service(), |
+ content::BrowserThread::GetTaskRunnerForThread( |
+ content::BrowserThread::IO))); |
+ |
+ proxy_config_service_ = |
+ pref_proxy_config_tracker_impl_->CreateTrackingProxyConfigService( |
+ nullptr); |
+ DCHECK(proxy_config_service_.get()); |
net_log_ = net_log; |
} |