Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_config.cc |
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.cc |
index 4661367b041e1caa3b7075815377f12e2fb77511..d6476e7401a3b02b436679bdb7f3e5b8141b141a 100644 |
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.cc |
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.cc |
@@ -548,13 +548,10 @@ bool DataReductionProxyConfig::UsingHTTPTunnel( |
return config_values_->UsingHTTPTunnel(proxy_server); |
} |
-// Returns true if the Data Reduction Proxy configuration may be used. |
bool DataReductionProxyConfig::allowed() const { |
return config_values_->allowed(); |
} |
-// Returns true if the Data Reduction Proxy promo may be shown. This is not |
-// tied to whether the Data Reduction Proxy is enabled. |
bool DataReductionProxyConfig::promo_allowed() const { |
return config_values_->promo_allowed(); |
} |
@@ -647,6 +644,25 @@ void DataReductionProxyConfig::HandleSecureProxyCheckResponse( |
secure_proxy_allowed_ = false; |
} |
+bool DataReductionProxyConfig::IsTrustedSpdyProxy( |
+ const net::ProxyServer& trusted_spdy_proxy) const { |
+ DCHECK(thread_checker_.CalledOnValidThread()); |
+ |
+ if (!trusted_spdy_proxy.is_valid() || |
+ !params::IsIncludedInTrustedSpdyProxyFieldTrial()) { |
+ return false; |
+ } |
+ |
+ const std::vector<net::ProxyServer>& proxies_for_http = |
+ config_values_->proxies_for_http(); |
+ // Trusted SPDY proxy should be a valid HTTPS proxy. |
+ if (enabled_by_user_ && proxies_for_http.size() >= 1 && |
bengr
2016/01/26 19:39:55
First, I would flip the logic so you return early
tbansal1
2016/01/27 00:13:33
Done
|
+ proxies_for_http[0].is_valid() && proxies_for_http[0].is_https()) { |
+ return trusted_spdy_proxy == proxies_for_http[0]; |
+ } |
+ return false; |
+} |
+ |
void DataReductionProxyConfig::OnIPAddressChanged() { |
if (enabled_by_user_) { |
DCHECK(config_values_->allowed()); |