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

Unified Diff: components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc

Issue 2503273002: Fetch a warmup URL if data reduction proxy is enabled (Closed)
Patch Set: ryansturm comments Created 4 years 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/common/data_reduction_proxy_params.cc
diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc
index f4c28f422b00e62d492e56d0b0bee08e7bda9dcb..84f14ecf4198c00414f0d61c1c203c517ce6ae95 100644
--- a/components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc
+++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc
@@ -33,7 +33,7 @@ const char kCarrierTestOrigin[] =
"http://o-o.preferred.nttdocomodcp-hnd1.proxy-dev.googlezip.net:80";
const char kDefaultFallbackOrigin[] = "compress.googlezip.net:80";
const char kDefaultSecureProxyCheckUrl[] = "http://check.googlezip.net/connect";
-const char kDefaultWarmupUrl[] = "http://www.gstatic.com/generate_204";
+const char kDefaultWarmupUrl[] = "http://check.googlezip.net/generate_204";
const char kAndroidOneIdentifier[] = "sprout";
@@ -138,6 +138,29 @@ bool IsIncludedInTamperDetectionExperiment() {
"TamperDetection_Enabled", base::CompareCase::SENSITIVE);
}
+bool FetchWarmupURLEnabled() {
+ // Fetching of the warmup URL can be enabled only for Enabled* and Control*
+ // groups.
+ if (!base::StartsWith(FieldTrialList::FindFullName(kQuicFieldTrial), kEnabled,
+ base::CompareCase::SENSITIVE) &&
+ !base::StartsWith(FieldTrialList::FindFullName(kQuicFieldTrial), kControl,
+ base::CompareCase::SENSITIVE)) {
+ return false;
+ }
+
+ std::map<std::string, std::string> params;
+ variations::GetVariationParams(GetQuicFieldTrialName(), &params);
+ return GetStringValueForVariationParamWithDefaultValue(
+ params, "enable_warmup", "false") == "true";
+}
+
+GURL GetWarmupURL() {
+ std::map<std::string, std::string> params;
+ variations::GetVariationParams(GetQuicFieldTrialName(), &params);
+ return GURL(GetStringValueForVariationParamWithDefaultValue(
+ params, "warmup_url", kDefaultWarmupUrl));
+}
+
bool IsLoFiOnViaFlags() {
return IsLoFiAlwaysOnViaFlags() || IsLoFiCellularOnlyViaFlags() ||
IsLoFiSlowConnectionsOnlyViaFlags();
@@ -427,8 +450,6 @@ void DataReductionProxyParams::InitWithoutChecks() {
fallback_origin = GetDefaultFallbackOrigin();
if (secure_proxy_check_url.empty())
secure_proxy_check_url = GetDefaultSecureProxyCheckURL();
- if (warmup_url.empty())
- warmup_url = GetDefaultWarmupURL();
origin_ = net::ProxyServer::FromURI(origin, net::ProxyServer::SCHEME_HTTP);
fallback_origin_ =
@@ -439,7 +460,6 @@ void DataReductionProxyParams::InitWithoutChecks() {
proxies_for_http_.push_back(fallback_origin_);
secure_proxy_check_url_ = GURL(secure_proxy_check_url);
- warmup_url_ = GURL(warmup_url);
}
const std::vector<net::ProxyServer>&
@@ -495,8 +515,5 @@ std::string DataReductionProxyParams::GetDefaultSecureProxyCheckURL() const {
return kDefaultSecureProxyCheckUrl;
}
-std::string DataReductionProxyParams::GetDefaultWarmupURL() const {
- return kDefaultWarmupUrl;
-}
} // namespace data_reduction_proxy

Powered by Google App Engine
This is Rietveld 408576698