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

Unified Diff: chrome/browser/profiles/profile_io_data.cc

Issue 1547273003: Set trusted SPDY proxy dynamically on per-profile basis (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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: chrome/browser/profiles/profile_io_data.cc
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc
index 20d93b9a2c49d8247c1d0c1e70ce7f27e9f92ba4..d544a478bf822026a9208821f3a0821282472c23 100644
--- a/chrome/browser/profiles/profile_io_data.cc
+++ b/chrome/browser/profiles/profile_io_data.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/profiles/profile_io_data.h"
#include <stddef.h>
-#include <string>
#include <utility>
#include "base/bind.h"
@@ -58,6 +57,7 @@
#include "components/content_settings/core/browser/cookie_settings.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/cookie_config/cookie_store_util.h"
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h"
#include "components/dom_distiller/core/url_constants.h"
#include "components/metrics/metrics_pref_names.h"
@@ -74,12 +74,12 @@
#include "net/cert/cert_verifier.h"
#include "net/cert/multi_log_ct_verifier.h"
#include "net/cookies/canonical_cookie.h"
-#include "net/http/http_network_session.h"
#include "net/http/http_transaction_factory.h"
#include "net/http/http_util.h"
#include "net/http/transport_security_persister.h"
#include "net/proxy/proxy_config_service_fixed.h"
#include "net/proxy/proxy_script_fetcher_impl.h"
+#include "net/proxy/proxy_server.h"
#include "net/proxy/proxy_service.h"
#include "net/ssl/channel_id_service.h"
#include "net/ssl/client_cert_store.h"
@@ -1299,6 +1299,8 @@ scoped_ptr<net::HttpNetworkSession> ProfileIOData::CreateHttpNetworkSession(
params.socket_performance_watcher_factory =
io_thread->globals()->network_quality_estimator.get();
}
+ SetTrustedSpdyProxyProvider(profile_params, &params);
+
if (data_reduction_proxy_io_data_.get())
params.proxy_delegate = data_reduction_proxy_io_data_->proxy_delegate();
@@ -1329,3 +1331,36 @@ void ProfileIOData::SetCookieSettingsForTesting(
DCHECK(!cookie_settings_.get());
cookie_settings_ = cookie_settings;
}
+
+void ProfileIOData::SetTrustedSpdyProxyProvider(
+ const ProfileParams& profile_params,
+ net::HttpNetworkSession::Params* params) const {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+
+ if (IsOffTheRecord())
bengr 2016/01/11 22:29:35 Why not implement this method in ProfileImplIOData
tbansal1 2016/01/13 02:11:25 Because, ProfileIOData implements CreateHttpNetwor
+ return;
+
+ IOThread* const io_thread = profile_params.io_thread;
+
+ net::ProxyServer trusted_spdy_proxy;
+
+ // Check if TrustedSpdyProxyProvider is already set.
bengr 2016/01/11 22:29:35 Why are you checking for a global provider first?
tbansal1 2016/01/12 20:50:51 IOThread will set the global provider if a trusted
+ if (io_thread->globals()->trusted_spdy_proxy_provider) {
+ io_thread->globals()->trusted_spdy_proxy_provider->GetTrustedSpdyProxy(
+ &trusted_spdy_proxy);
+ }
+ if (trusted_spdy_proxy.is_valid()) {
+ // TrustedSpdyProxyProvider returns a valid proxy.
+ params->trusted_spdy_proxy_provider =
+ io_thread->globals()->trusted_spdy_proxy_provider->GetWeakPtr();
+ return;
+ }
+
+ // The default implementation did not provide a valid proxy. Query Data
+ // Reduction Proxy.
+ if (data_reduction_proxy_io_data()) {
+ params->trusted_spdy_proxy_provider =
+ data_reduction_proxy_io_data()->config()->GetWeakPtr();
+ return;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698