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

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

Issue 2166363003: Offline pages using NQE 2G Slow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clarifying comment Created 4 years, 5 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/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 eb7dc11d5d69c55f1dad0fa19f40807b98bab816..73c86afd0aa0bf1fd5b2fc560ace6c235ac2f11c 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
@@ -48,20 +48,27 @@ const char kClientConfigURL[] =
"https://datasaver.googleapis.com/v1/clientConfigs";
// Default URL for sending pageload metrics.
const char kPingbackURL[] =
"https://datasaver.googleapis.com/v1/metrics:recordPageloadMetrics";
// The name of the server side experiment field trial.
const char kServerExperimentsFieldTrial[] =
"DataReductionProxyServerExperiments";
+// The group of client side experiments.
+const char kClientSideExperimentsFieldTrial[] =
+ "DataReductionProxyClientSideExperimentsFieldTrial";
+
+// Allow offline pages to show for prohibitively slow networks.
+const char kOfflinePagesSlowNetwork[] = "OfflinePages";
+
bool IsIncludedInFieldTrial(const std::string& name) {
return base::StartsWith(FieldTrialList::FindFullName(name), kEnabled,
base::CompareCase::SENSITIVE);
}
} // namespace
namespace data_reduction_proxy {
namespace params {
@@ -111,20 +118,27 @@ bool IsIncludedInLoFiPreviewFieldTrial() {
kPreview, base::CompareCase::SENSITIVE);
}
bool IsIncludedInServerExperimentsFieldTrial() {
return !base::CommandLine::ForCurrentProcess()->HasSwitch(
data_reduction_proxy::switches::
kDataReductionProxyServerExperimentsDisabled) &&
FieldTrialList::FindFullName(kServerExperimentsFieldTrial)
.find(kDisabled) != 0;
}
+
+bool IsIncludedInOfflinePagesSlowConnectionFieldTrial() {
+ return IsIncludedInFieldTrial(kClientSideExperimentsFieldTrial) &&
+ FieldTrialList::FindFullName(kClientSideExperimentsFieldTrial)
tbansal1 2016/07/25 21:35:26 Instead of checking the group name, I think you sh
RyanSturm 2016/07/26 19:48:11 Done.
+ .find(kOfflinePagesSlowNetwork) != std::string::npos;
+}
+
bool IsIncludedInTamperDetectionExperiment() {
return IsIncludedInServerExperimentsFieldTrial() &&
base::StartsWith(
FieldTrialList::FindFullName(kServerExperimentsFieldTrial),
"TamperDetection_Enabled", base::CompareCase::SENSITIVE);
}
bool IsLoFiOnViaFlags() {
return IsLoFiAlwaysOnViaFlags() || IsLoFiCellularOnlyViaFlags() ||
IsLoFiSlowConnectionsOnlyViaFlags();

Powered by Google App Engine
This is Rietveld 408576698