Index: components/previews/core/previews_experiments.cc |
diff --git a/components/previews/core/previews_experiments.cc b/components/previews/core/previews_experiments.cc |
index 3806bc9c8e8f6084023175e7ff2c222bed53c99f..df82562047688db80168d1a5b2f118a1c217dce1 100644 |
--- a/components/previews/core/previews_experiments.cc |
+++ b/components/previews/core/previews_experiments.cc |
@@ -64,6 +64,12 @@ const char kSingleOptOutDurationInSeconds[] = |
const char kOfflinePreviewFreshnessDurationInDays[] = |
"offline_preview_freshness_duration_in_days"; |
+// The threshold of EffectiveConnectionType above which previews will not be |
+// served. |
+// See net/nqe/effective_connection_type.h for mapping from string to value. |
+const char kEffectiveConnectionTypeThreshold[] = |
+ "max_allowed_effective_connection_type"; |
+ |
// The string that corresponds to enabled for the variation param experiments. |
const char kExperimentEnabled[] = "true"; |
@@ -158,6 +164,16 @@ base::TimeDelta OfflinePreviewFreshnessDuration() { |
return base::TimeDelta::FromDays(duration); |
} |
+net::EffectiveConnectionType EffectiveConnectionTypeThreshold() { |
+ std::string param_value = ParamValue(kEffectiveConnectionTypeThreshold); |
+ net::EffectiveConnectionType effective_connection_type; |
+ if (!net::GetEffectiveConnectionTypeForName(param_value, |
+ &effective_connection_type)) { |
+ effective_connection_type = net::EFFECTIVE_CONNECTION_TYPE_SLOW_2G; |
+ } |
+ return effective_connection_type; |
+} |
+ |
} // namespace params |
bool IsIncludedInClientSidePreviewsExperimentsFieldTrial() { |