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

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

Issue 2854893003: Adding an Android about:flags feature for offline previews (Closed)
Patch Set: rebase on enums.xml Created 3 years, 7 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 e8d738aa60a6b5fb0c735ab700faf301582065a2..546457dc95fc2f9750387d86f4dd426664364afd 100644
--- a/components/previews/core/previews_experiments.cc
+++ b/components/previews/core/previews_experiments.cc
@@ -6,11 +6,13 @@
#include <string>
+#include "base/feature_list.h"
#include "base/logging.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/field_trial_params.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
+#include "components/previews/core/previews_features.h"
namespace previews {
@@ -75,6 +77,15 @@ net::EffectiveConnectionType GetParamValueAsECT(
return value;
}
+bool IsIncludedInClientSidePreviewsExperimentsFieldTrial() {
+ // By convention, an experiment in the client-side previews study enables use
+ // of at least one client-side previews optimization if its name begins with
+ // "Enabled."
+ return base::StartsWith(
+ base::FieldTrialList::FindFullName(kClientSidePreviewsFieldTrial),
+ kEnabled, base::CompareCase::SENSITIVE);
+}
+
} // namespace
namespace params {
@@ -136,10 +147,11 @@ net::EffectiveConnectionType EffectiveConnectionTypeThresholdForOffline() {
bool IsOfflinePreviewsEnabled() {
// Check if "show_offline_pages" is set to "true".
- return IsIncludedInClientSidePreviewsExperimentsFieldTrial() &&
- base::GetFieldTrialParamValue(kClientSidePreviewsFieldTrial,
- kOfflinePagesSlowNetwork) ==
- kExperimentEnabled;
+ return base::FeatureList::IsEnabled(features::kOfflinePreviews) ||
+ (IsIncludedInClientSidePreviewsExperimentsFieldTrial() &&
+ base::GetFieldTrialParamValue(kClientSidePreviewsFieldTrial,
+ kOfflinePagesSlowNetwork) ==
+ kExperimentEnabled);
}
int OfflinePreviewsVersion() {
@@ -164,13 +176,4 @@ net::EffectiveConnectionType EffectiveConnectionTypeThresholdForClientLoFi() {
} // namespace params
-bool IsIncludedInClientSidePreviewsExperimentsFieldTrial() {
- // By convention, an experiment in the client-side previews study enables use
- // of at least one client-side previews optimization if its name begins with
- // "Enabled."
- return base::StartsWith(
- base::FieldTrialList::FindFullName(kClientSidePreviewsFieldTrial),
- kEnabled, base::CompareCase::SENSITIVE);
-}
-
} // namespace previews
« 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