OLD | NEW |
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 <string> | 9 #include <string> |
9 | 10 |
10 #include "base/feature_list.h" | 11 #include "base/feature_list.h" |
| 12 #include "components/ntp_snippets/category_rankers/category_ranker.h" |
| 13 #include "components/prefs/pref_service.h" |
11 | 14 |
12 namespace ntp_snippets { | 15 namespace ntp_snippets { |
13 | 16 |
14 // Features to turn individual providers/categories on/off. | 17 // Features to turn individual providers/categories on/off. |
15 extern const base::Feature kArticleSuggestionsFeature; | 18 extern const base::Feature kArticleSuggestionsFeature; |
16 extern const base::Feature kBookmarkSuggestionsFeature; | 19 extern const base::Feature kBookmarkSuggestionsFeature; |
17 extern const base::Feature kRecentOfflineTabSuggestionsFeature; | 20 extern const base::Feature kRecentOfflineTabSuggestionsFeature; |
18 extern const base::Feature kPhysicalWebPageSuggestionsFeature; | 21 extern const base::Feature kPhysicalWebPageSuggestionsFeature; |
19 extern const base::Feature kForeignSessionsSuggestionsFeature;; | 22 extern const base::Feature kForeignSessionsSuggestionsFeature;; |
20 | 23 |
(...skipping 13 matching lines...) Expand all Loading... |
34 | 37 |
35 // Feature to allow UI as specified here: https://crbug.com/660837. | 38 // Feature to allow UI as specified here: https://crbug.com/660837. |
36 extern const base::Feature kIncreasedVisibility; | 39 extern const base::Feature kIncreasedVisibility; |
37 | 40 |
38 // Feature to enable the Fetch More action | 41 // Feature to enable the Fetch More action |
39 extern const base::Feature kFetchMoreFeature; | 42 extern const base::Feature kFetchMoreFeature; |
40 | 43 |
41 // Feature to prefer AMP URLs over regular URLs when available. | 44 // Feature to prefer AMP URLs over regular URLs when available. |
42 extern const base::Feature kPreferAmpUrlsFeature; | 45 extern const base::Feature kPreferAmpUrlsFeature; |
43 | 46 |
| 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 |
44 } // namespace ntp_snippets | 68 } // namespace ntp_snippets |
45 | 69 |
46 #endif // COMPONENTS_NTP_SNIPPETS_FEATURES_H_ | 70 #endif // COMPONENTS_NTP_SNIPPETS_FEATURES_H_ |
OLD | NEW |