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

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

Issue 2640023007: Adds PreviewsType version mechanism for clearing blacklist entries. (Closed)
Patch Set: Removed std::move 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::unique_ptr<std::vector<std::pair<PreviewsType, int>>>
183 GetEnabledPreviews() {
184 std::unique_ptr<std::vector<std::pair<PreviewsType, int>>> enabled_previews(
185 new std::vector<std::pair<PreviewsType, int>>());
186
187 // For now, all previews types have version 0.
188 // TODO(dougarnett): Add finch control of version for previews types.
RyanSturm 2017/01/25 23:17:53 I'd add the offline previews field trial support i
dougarnett 2017/01/26 00:48:26 Add param but followed current naming style. Pleas
189 if (IsPreviewsTypeEnabled(PreviewsType::OFFLINE)) {
190 enabled_previews->push_back({PreviewsType::OFFLINE, 0});
191 }
192 return enabled_previews;
193 }
194
182 bool EnableOfflinePreviewsForTesting() { 195 bool EnableOfflinePreviewsForTesting() {
183 std::map<std::string, std::string> params; 196 std::map<std::string, std::string> params;
184 params[kOfflinePagesSlowNetwork] = kExperimentEnabled; 197 params[kOfflinePagesSlowNetwork] = kExperimentEnabled;
185 return variations::AssociateVariationParams(kClientSidePreviewsFieldTrial, 198 return variations::AssociateVariationParams(kClientSidePreviewsFieldTrial,
186 kEnabled, params) && 199 kEnabled, params) &&
187 base::FieldTrialList::CreateFieldTrial(kClientSidePreviewsFieldTrial, 200 base::FieldTrialList::CreateFieldTrial(kClientSidePreviewsFieldTrial,
188 kEnabled); 201 kEnabled);
189 } 202 }
190 203
191 } // namespace previews 204 } // namespace previews
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698