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); |
} |