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

Side by Side Diff: components/ntp_snippets/features.h

Issue 2804633003: Add base::FeatureParam<> struct (Closed)
Patch Set: rebase Created 3 years, 3 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 #ifndef COMPONENTS_NTP_SNIPPETS_FEATURES_H_ 5 #ifndef COMPONENTS_NTP_SNIPPETS_FEATURES_H_
6 #define COMPONENTS_NTP_SNIPPETS_FEATURES_H_ 6 #define COMPONENTS_NTP_SNIPPETS_FEATURES_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/feature_list.h" 11 #include "base/feature_list.h"
12 #include "base/metrics/field_trial_params.h"
12 #include "components/ntp_snippets/category_rankers/category_ranker.h" 13 #include "components/ntp_snippets/category_rankers/category_ranker.h"
13 #include "components/prefs/pref_service.h" 14 #include "components/prefs/pref_service.h"
14 15
15 namespace base { 16 namespace base {
16 class Clock; 17 class Clock;
17 } 18 }
18 19
19 namespace ntp_snippets { 20 namespace ntp_snippets {
20 21
21 // 22 //
(...skipping 24 matching lines...) Expand all
46 // Feature to allow the new Google favicon server for fetching publisher icons. 47 // Feature to allow the new Google favicon server for fetching publisher icons.
47 extern const base::Feature kPublisherFaviconsFromNewServerFeature; 48 extern const base::Feature kPublisherFaviconsFromNewServerFeature;
48 49
49 // Feature for simple experimental comparision and validation of changes since 50 // Feature for simple experimental comparision and validation of changes since
50 // M58: enabling this brings back the M58 Stable fetching schedule (which is 51 // M58: enabling this brings back the M58 Stable fetching schedule (which is
51 // suitable for Holdback groups). 52 // suitable for Holdback groups).
52 // TODO(jkrcal): Remove when the comparision is done (probably after M62). 53 // TODO(jkrcal): Remove when the comparision is done (probably after M62).
53 extern const base::Feature kRemoteSuggestionsEmulateM58FetchingSchedule; 54 extern const base::Feature kRemoteSuggestionsEmulateM58FetchingSchedule;
54 55
55 // Parameter and its values for the kCategoryRanker feature flag. 56 // Parameter and its values for the kCategoryRanker feature flag.
56 extern const char kCategoryRankerParameter[];
57 extern const char kCategoryRankerConstantRanker[];
58 extern const char kCategoryRankerClickBasedRanker[];
59
60 enum class CategoryRankerChoice { 57 enum class CategoryRankerChoice {
61 CONSTANT, 58 CONSTANT,
62 CLICK_BASED, 59 CLICK_BASED,
63 }; 60 };
64 61 extern const char kCategoryRankerConstantRanker[];
65 // Returns which CategoryRanker to use according to kCategoryRanker feature. 62 extern const char kCategoryRankerClickBasedRanker[];
66 CategoryRankerChoice GetSelectedCategoryRanker(); 63 extern const base::FeatureParam<CategoryRankerChoice> kCategoryRankerParameter;
67 64
68 // Builds a CategoryRanker according to kCategoryRanker feature. 65 // Builds a CategoryRanker according to kCategoryRanker feature.
69 std::unique_ptr<CategoryRanker> BuildSelectedCategoryRanker( 66 std::unique_ptr<CategoryRanker> BuildSelectedCategoryRanker(
70 PrefService* pref_service, 67 PrefService* pref_service,
71 std::unique_ptr<base::Clock> clock); 68 std::unique_ptr<base::Clock> clock);
72 69
73 // Feature to choose a default category order. 70 // Feature to choose a default category order.
74 extern const base::Feature kCategoryOrder; 71 extern const base::Feature kCategoryOrder;
75 72
76 // Parameter and its values for the kCategoryOrder feature flag. 73 // Parameter and its values for the kCategoryOrder feature flag.
77 extern const char kCategoryOrderParameter[];
78 extern const char kCategoryOrderGeneral[];
79 extern const char kCategoryOrderEmergingMarketsOriented[];
80
81 enum class CategoryOrderChoice { 74 enum class CategoryOrderChoice {
82 GENERAL, 75 GENERAL,
83 EMERGING_MARKETS_ORIENTED, 76 EMERGING_MARKETS_ORIENTED,
84 }; 77 };
78 extern const char kCategoryOrderGeneral[];
79 extern const char kCategoryOrderEmergingMarketsOriented[];
80 extern const base::FeatureParam<CategoryOrderChoice> kCategoryOrderParameter;
85 81
86 // Returns which category order to use according to kCategoryOrder feature. 82 // Returns which category order to use according to kCategoryOrder feature.
87 CategoryOrderChoice GetSelectedCategoryOrder(); 83 CategoryOrderChoice GetSelectedCategoryOrder();
88 84
89 // Enables and configures notifications for content suggestions on Android. 85 // Enables and configures notifications for content suggestions on Android.
90 extern const base::Feature kNotificationsFeature; 86 extern const base::Feature kNotificationsFeature;
91 87
92 // An integer. The priority of the notification, ranging from -2 (PRIORITY_MIN) 88 // An integer. The priority of the notification, ranging from -2 (PRIORITY_MIN)
93 // to 2 (PRIORITY_MAX). Vibrates and makes sound if >= 0. 89 // to 2 (PRIORITY_MAX). Vibrates and makes sound if >= 0.
94 extern const char kNotificationsPriorityParam[]; 90 extern const char kNotificationsPriorityParam[];
(...skipping 29 matching lines...) Expand all
124 extern const base::Feature kKeepPrefetchedContentSuggestions; 120 extern const base::Feature kKeepPrefetchedContentSuggestions;
125 121
126 // Whether remote categories (except articles) which are not present in the last 122 // Whether remote categories (except articles) which are not present in the last
127 // fetch response should be deleted. This feature implicitly depends on 123 // fetch response should be deleted. This feature implicitly depends on
128 // kArticleSuggestionsFeature. 124 // kArticleSuggestionsFeature.
129 extern const base::Feature kDeleteRemoteCategoriesNotPresentInLastFetch; 125 extern const base::Feature kDeleteRemoteCategoriesNotPresentInLastFetch;
130 126
131 } // namespace ntp_snippets 127 } // namespace ntp_snippets
132 128
133 #endif // COMPONENTS_NTP_SNIPPETS_FEATURES_H_ 129 #endif // COMPONENTS_NTP_SNIPPETS_FEATURES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698