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..31bf388a455c272dacc7adb84b8b9e7f94021fb5 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 int 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); |
+ int effective_type_value; |
+ if (!base::StringToInt(param_value, &effective_type_value)) { |
tbansal1
2017/02/02 00:13:40
You may want to use this function:
https://cs.chro
RyanSturm
2017/02/02 00:22:28
Done. Thanks.
|
+ effective_type_value = |
tbansal1
2017/02/02 00:13:40
Instead of 2 static casts, may be just return E_C_
RyanSturm
2017/02/02 00:22:28
Acknowledged.
|
+ static_cast<int>(net::EFFECTIVE_CONNECTION_TYPE_SLOW_2G); |
+ } |
+ return static_cast<net::EffectiveConnectionType>(effective_type_value); |
+} |
+ |
} // namespace params |
bool IsIncludedInClientSidePreviewsExperimentsFieldTrial() { |