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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate.cc

Issue 2453973003: Add a QUIC proxy server to the list of QUIC servers supported at start up (Closed)
Patch Set: Created 4 years, 2 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: components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate.cc
index b6b8f379ce37dca3bb79d6e9b0397783a82315e6..72f9c2f76425813ce5effd7baab3485e36ff0eb3 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate.cc
@@ -18,11 +18,14 @@
#include "net/base/url_util.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_response_headers.h"
-#include "net/proxy/proxy_server.h"
#include "net/proxy/proxy_service.h"
namespace data_reduction_proxy {
+namespace {
+static const char kDataReductionCoreProxy[] = "proxy.googlezip.net";
+}
+
DataReductionProxyDelegate::DataReductionProxyDelegate(
DataReductionProxyConfig* config,
const DataReductionProxyConfigurator* configurator,
@@ -145,13 +148,36 @@ void DataReductionProxyDelegate::OnAlternativeProxyBroken(
1);
}
+net::ProxyServer DataReductionProxyDelegate::GetDefaultAlternativeProxy()
+ const {
+ if (!params::IsZeroRttQuicEnabled())
+ return net::ProxyServer();
+
+ if (alternative_proxies_broken_) {
+ RecordGetDefaultAlternativeProxy(DEFAULT_ALTERNATIVE_PROXY_STATUS_BROKEN);
+ return net::ProxyServer();
+ }
+
+ net::ProxyServer proxy_server(
+ net::ProxyServer::SCHEME_QUIC,
+ net::HostPortPair(kDataReductionCoreProxy, 443));
+ if (!config_ || !config_->IsDataReductionProxy(proxy_server, NULL)) {
+ RecordGetDefaultAlternativeProxy(
+ DEFAULT_ALTERNATIVE_PROXY_STATUS_UNAVAILABLE);
+ return net::ProxyServer();
+ }
+
+ RecordGetDefaultAlternativeProxy(DEFAULT_ALTERNATIVE_PROXY_STATUS_AVAILABLE);
+ return proxy_server;
+}
+
bool DataReductionProxyDelegate::SupportsQUIC(
const net::ProxyServer& proxy_server) const {
// Enable QUIC for whitelisted proxies.
// TODO(tbansal): Use client config service to control this whitelist.
return proxy_server ==
- net::ProxyServer::FromURI("proxy.googlezip.net:443",
- net::ProxyServer::SCHEME_HTTPS);
+ net::ProxyServer(net::ProxyServer::SCHEME_HTTPS,
+ net::HostPortPair(kDataReductionCoreProxy, 443));
}
void DataReductionProxyDelegate::RecordQuicProxyStatus(
@@ -160,6 +186,12 @@ void DataReductionProxyDelegate::RecordQuicProxyStatus(
QUIC_PROXY_STATUS_BOUNDARY);
}
+void DataReductionProxyDelegate::RecordGetDefaultAlternativeProxy(
+ DefaultAlternativeProxyStatus status) const {
+ UMA_HISTOGRAM_ENUMERATION("DataReductionProxy.Quic.DefaultAlternativeProxy",
+ status, DEFAULT_ALTERNATIVE_PROXY_STATUS_BOUNDARY);
+}
+
void OnResolveProxyHandler(const GURL& url,
const std::string& method,
const net::ProxyConfig& data_reduction_proxy_config,

Powered by Google App Engine
This is Rietveld 408576698