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

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

Issue 2433793003: Generalize Previews Type code (Closed)
Patch Set: tbansal comment Created 4 years, 2 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 afd1fff87f1ee8db5d3751c94b842d02c69d94ed..fa1fd2fe1b34e867f6a96c8b45adf8e846c5251e 100644
--- a/components/previews/core/previews_experiments.cc
+++ b/components/previews/core/previews_experiments.cc
@@ -1,19 +1,20 @@
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/previews/core/previews_experiments.h"
#include <map>
#include <string>
+#include "base/logging.h"
#include "base/metrics/field_trial.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "components/variations/variations_associated_data.h"
namespace previews {
namespace {
// The group of client-side previews experiments.
@@ -103,22 +104,28 @@ base::TimeDelta BlackListDuration() {
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);
}
-bool IsOfflinePreviewsEnabled() {
- return ParamValue(kOfflinePagesSlowNetwork) == kExperimentEnabled;
+bool IsPreviewsTypeEnabled(PreviewsType type) {
+ switch (type) {
+ case PreviewsType::OFFLINE:
+ return ParamValue(kOfflinePagesSlowNetwork) == kExperimentEnabled;
+ default:
+ NOTREACHED();
+ return false;
+ }
}
bool EnableOfflinePreviewsForTesting() {
std::map<std::string, std::string> params;
params[kOfflinePagesSlowNetwork] = kExperimentEnabled;
return variations::AssociateVariationParams(kClientSidePreviewsFieldTrial,
kEnabled, params) &&
base::FieldTrialList::CreateFieldTrial(kClientSidePreviewsFieldTrial,
kEnabled);
}
« 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