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

Side by Side Diff: components/previews/core/previews_experiments.cc

Issue 2640023007: Adds PreviewsType version mechanism for clearing blacklist entries. (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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/previews/core/previews_experiments.h" 5 #include "components/previews/core/previews_experiments.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 bool IsPreviewsTypeEnabled(PreviewsType type) { 172 bool IsPreviewsTypeEnabled(PreviewsType type) {
173 switch (type) { 173 switch (type) {
174 case PreviewsType::OFFLINE: 174 case PreviewsType::OFFLINE:
175 return ParamValue(kOfflinePagesSlowNetwork) == kExperimentEnabled; 175 return ParamValue(kOfflinePagesSlowNetwork) == kExperimentEnabled;
176 default: 176 default:
177 NOTREACHED(); 177 NOTREACHED();
178 return false; 178 return false;
179 } 179 }
180 } 180 }
181 181
182 std::vector<std::pair<PreviewsType, int>>* GetEnabledPreviews() {
183 std::vector<std::pair<PreviewsType, int>>* enabled_previews =
184 new std::vector<std::pair<PreviewsType, int>>();
185
186 // For now, all previews types have version 0.
187 // TODO(dougarnett): Add finch control of version for previews types.
188 if (IsPreviewsTypeEnabled(PreviewsType::OFFLINE)) {
189 enabled_previews->push_back({PreviewsType::OFFLINE, 0});
190 }
191 return enabled_previews;
192 }
193
182 bool EnableOfflinePreviewsForTesting() { 194 bool EnableOfflinePreviewsForTesting() {
183 std::map<std::string, std::string> params; 195 std::map<std::string, std::string> params;
184 params[kOfflinePagesSlowNetwork] = kExperimentEnabled; 196 params[kOfflinePagesSlowNetwork] = kExperimentEnabled;
185 return variations::AssociateVariationParams(kClientSidePreviewsFieldTrial, 197 return variations::AssociateVariationParams(kClientSidePreviewsFieldTrial,
186 kEnabled, params) && 198 kEnabled, params) &&
187 base::FieldTrialList::CreateFieldTrial(kClientSidePreviewsFieldTrial, 199 base::FieldTrialList::CreateFieldTrial(kClientSidePreviewsFieldTrial,
188 kEnabled); 200 kEnabled);
189 } 201 }
190 202
191 } // namespace previews 203 } // namespace previews
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698