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

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

Issue 2667243003: Adding a parameter for previews NQE triggering threshold (Closed)
Patch Set: typo 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..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() {
« 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