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

Unified Diff: components/previews/core/previews_experiments.cc

Issue 2667243003: Adding a parameter for previews NQE triggering threshold (Closed)
Patch Set: Created 3 years, 11 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/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() {
« no previous file with comments | « components/previews/core/previews_experiments.h ('k') | components/previews/core/previews_experiments_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698