Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: chromecast/browser/cast_browser_process.cc

Issue 2647323010: [Chromecast] Add proxy server support to chromecast (Closed)
Patch Set: Fix unittest failure Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chromecast/browser/cast_browser_process.cc
diff --git a/chromecast/browser/cast_browser_process.cc b/chromecast/browser/cast_browser_process.cc
index cf7101aab315a05cd2c52005d003c15de9ff24af..f27a061788106489b53dac7865c29ccccba088ad 100644
--- a/chromecast/browser/cast_browser_process.cc
+++ b/chromecast/browser/cast_browser_process.cc
@@ -16,6 +16,9 @@
#include "chromecast/net/connectivity_checker.h"
#include "chromecast/service/cast_service.h"
#include "components/prefs/pref_service.h"
+#include "components/proxy_config/pref_proxy_config_tracker_impl.h"
+#include "content/public/browser/browser_thread.h"
+#include "net/proxy/proxy_service.h"
#if defined(OS_ANDROID)
#include "components/crash/content/browser/crash_dump_manager_android.h"
@@ -47,6 +50,11 @@ CastBrowserProcess::CastBrowserProcess()
CastBrowserProcess::~CastBrowserProcess() {
DCHECK_EQ(g_instance, this);
+ pref_proxy_config_tracker_impl_->DetachFromPrefService();
+ connectivity_checker_->DetachFromPrefService();
+
+ content::BrowserThread::GetTaskRunnerForThread(content::BrowserThread::IO)
+ ->DeleteSoon(FROM_HERE, proxy_service_.release());
if (pref_service_)
pref_service_->CommitPendingWrite();
g_instance = NULL;
@@ -94,6 +102,20 @@ void CastBrowserProcess::SetPrefService(
std::unique_ptr<PrefService> pref_service) {
DCHECK(!pref_service_);
pref_service_.swap(pref_service);
+
+ pref_proxy_config_tracker_impl_ =
wzhong 2017/02/07 15:56:02 I'd rather you have a separate function SetPrefPro
almasrymina 2017/02/08 00:48:03 Removed with new approach.
+ base::MakeUnique<PrefProxyConfigTrackerImpl>(
+ pref_service_.get(), content::BrowserThread::GetTaskRunnerForThread(
+ content::BrowserThread::IO));
+}
+
+void CastBrowserProcess::SetProxyService() {
+ std::unique_ptr<net::ProxyConfigService> proxy_config_service =
+ pref_proxy_config_tracker_impl_->CreateTrackingProxyConfigService(
+ nullptr);
+
+ proxy_service_ = net::ProxyService::CreateUsingSystemProxyResolver(
+ std::move(proxy_config_service), 0, nullptr);
}
void CastBrowserProcess::SetRemoteDebuggingServer(

Powered by Google App Engine
This is Rietveld 408576698