treib | ec8f330 | 2016-08-04 11:05:20 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef COMPONENTS_NTP_SNIPPETS_FEATURES_H_ |
| 6 | #define COMPONENTS_NTP_SNIPPETS_FEATURES_H_ |
| 7 | |
vitaliii | a64fb41f | 2017-01-04 07:40:29 | [diff] [blame^] | 8 | #include <memory> |
skym | 9e961db | 2016-09-19 19:02:08 | [diff] [blame] | 9 | #include <string> |
| 10 | |
treib | ec8f330 | 2016-08-04 11:05:20 | [diff] [blame] | 11 | #include "base/feature_list.h" |
vitaliii | a64fb41f | 2017-01-04 07:40:29 | [diff] [blame^] | 12 | #include "components/ntp_snippets/category_rankers/category_ranker.h" |
| 13 | #include "components/prefs/pref_service.h" |
treib | ec8f330 | 2016-08-04 11:05:20 | [diff] [blame] | 14 | |
| 15 | namespace ntp_snippets { |
| 16 | |
pke | c4fe8dd | 2016-08-12 14:34:41 | [diff] [blame] | 17 | // Features to turn individual providers/categories on/off. |
treib | 5bc62a8 | 2016-08-09 11:30:15 | [diff] [blame] | 18 | extern const base::Feature kArticleSuggestionsFeature; |
pke | 2f529e9c | 2016-08-05 11:52:07 | [diff] [blame] | 19 | extern const base::Feature kBookmarkSuggestionsFeature; |
pke | c4fe8dd | 2016-08-12 14:34:41 | [diff] [blame] | 20 | extern const base::Feature kRecentOfflineTabSuggestionsFeature; |
vitaliii | 762478d | 2016-08-17 09:50:57 | [diff] [blame] | 21 | extern const base::Feature kPhysicalWebPageSuggestionsFeature; |
dgn | bb75020 | 2016-10-20 12:39:45 | [diff] [blame] | 22 | extern const base::Feature kForeignSessionsSuggestionsFeature;; |
treib | 5bc62a8 | 2016-08-09 11:30:15 | [diff] [blame] | 23 | |
peconn | 279b4d5 | 2016-08-12 18:42:01 | [diff] [blame] | 24 | // Feature to allow the 'save to offline' option to appear in the snippets |
| 25 | // context menu. |
| 26 | extern const base::Feature kSaveToOfflineFeature; |
| 27 | |
peconn | cde6298d | 2016-10-26 21:46:21 | [diff] [blame] | 28 | // Feature to allow offline badges to appear on snippets. |
| 29 | extern const base::Feature kOfflineBadgeFeature; |
| 30 | |
dgn | bb75020 | 2016-10-20 12:39:45 | [diff] [blame] | 31 | // Feature to allow dismissing sections. |
| 32 | extern const base::Feature kSectionDismissalFeature; |
| 33 | |
treib | 5bc62a8 | 2016-08-09 11:30:15 | [diff] [blame] | 34 | // Global toggle for the whole content suggestions feature. If this is set to |
| 35 | // false, all the per-provider features are ignored. |
treib | ec8f330 | 2016-08-04 11:05:20 | [diff] [blame] | 36 | extern const base::Feature kContentSuggestionsFeature; |
| 37 | |
peconn | 9883eff | 2016-11-04 18:54:18 | [diff] [blame] | 38 | // Feature to allow UI as specified here: https://crbug.com/660837. |
| 39 | extern const base::Feature kIncreasedVisibility; |
| 40 | |
dgn | 5684fd59 | 2016-11-04 15:26:56 | [diff] [blame] | 41 | // Feature to enable the Fetch More action |
| 42 | extern const base::Feature kFetchMoreFeature; |
| 43 | |
mvanouwerkerk | ee93200 | 2016-12-20 17:41:49 | [diff] [blame] | 44 | // Feature to prefer AMP URLs over regular URLs when available. |
| 45 | extern const base::Feature kPreferAmpUrlsFeature; |
| 46 | |
vitaliii | a64fb41f | 2017-01-04 07:40:29 | [diff] [blame^] | 47 | // Feature to choose a category ranker. |
| 48 | extern const base::Feature kCategoryRanker; |
| 49 | |
| 50 | // Parameter for a kCategoryRanker feature flag. |
| 51 | extern const char kCategoryRankerParameter[]; |
| 52 | // Possible values of the parameter above. |
| 53 | extern const char kCategoryRankerConstantRanker[]; |
| 54 | extern const char kCategoryRankerClickBasedRanker[]; |
| 55 | |
| 56 | enum class CategoryRankerChoice { |
| 57 | CONSTANT, |
| 58 | CLICK_BASED, |
| 59 | }; |
| 60 | |
| 61 | // Returns which CategoryRanker to use according to kCategoryRanker feature. |
| 62 | CategoryRankerChoice GetSelectedCategoryRanker(); |
| 63 | |
| 64 | // Builds a CategoryRanker according to kCategoryRanker feature. |
| 65 | std::unique_ptr<CategoryRanker> BuildSelectedCategoryRanker( |
| 66 | PrefService* pref_service); |
| 67 | |
treib | ec8f330 | 2016-08-04 11:05:20 | [diff] [blame] | 68 | } // namespace ntp_snippets |
| 69 | |
| 70 | #endif // COMPONENTS_NTP_SNIPPETS_FEATURES_H_ |