| 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 <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 // Features to turn individual providers/categories on/off. | 22 // Features to turn individual providers/categories on/off. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 32 // Feature to prefer AMP URLs over regular URLs when available. | 33 // Feature to prefer AMP URLs over regular URLs when available. |
| 33 extern const base::Feature kPreferAmpUrlsFeature; | 34 extern const base::Feature kPreferAmpUrlsFeature; |
| 34 | 35 |
| 35 // Feature to choose a category ranker. | 36 // Feature to choose a category ranker. |
| 36 extern const base::Feature kCategoryRanker; | 37 extern const base::Feature kCategoryRanker; |
| 37 | 38 |
| 38 // Feature to allow the new Google favicon server for fetching publisher icons. | 39 // Feature to allow the new Google favicon server for fetching publisher icons. |
| 39 extern const base::Feature kPublisherFaviconsFromNewServerFeature; | 40 extern const base::Feature kPublisherFaviconsFromNewServerFeature; |
| 40 | 41 |
| 41 // Parameter and its values for the kCategoryRanker feature flag. | 42 // Parameter and its values for the kCategoryRanker feature flag. |
| 42 extern const char kCategoryRankerParameter[]; | |
| 43 extern const char kCategoryRankerConstantRanker[]; | |
| 44 extern const char kCategoryRankerClickBasedRanker[]; | |
| 45 | |
| 46 enum class CategoryRankerChoice { | 43 enum class CategoryRankerChoice { |
| 47 CONSTANT, | 44 CONSTANT, |
| 48 CLICK_BASED, | 45 CLICK_BASED, |
| 49 }; | 46 }; |
| 50 | 47 extern const char kCategoryRankerConstantRanker[]; |
| 51 // Returns which CategoryRanker to use according to kCategoryRanker feature. | 48 extern const char kCategoryRankerClickBasedRanker[]; |
| 52 CategoryRankerChoice GetSelectedCategoryRanker(); | 49 extern const base::FeatureParam<CategoryRankerChoice> kCategoryRankerParameter; |
| 53 | 50 |
| 54 // Builds a CategoryRanker according to kCategoryRanker feature. | 51 // Builds a CategoryRanker according to kCategoryRanker feature. |
| 55 std::unique_ptr<CategoryRanker> BuildSelectedCategoryRanker( | 52 std::unique_ptr<CategoryRanker> BuildSelectedCategoryRanker( |
| 56 PrefService* pref_service, | 53 PrefService* pref_service, |
| 57 std::unique_ptr<base::Clock> clock); | 54 std::unique_ptr<base::Clock> clock); |
| 58 | 55 |
| 59 // Feature to choose a default category order. | 56 // Feature to choose a default category order. |
| 60 extern const base::Feature kCategoryOrder; | 57 extern const base::Feature kCategoryOrder; |
| 61 | 58 |
| 62 // Parameter and its values for the kCategoryOrder feature flag. | 59 // Parameter and its values for the kCategoryOrder feature flag. |
| 63 extern const char kCategoryOrderParameter[]; | |
| 64 extern const char kCategoryOrderGeneral[]; | |
| 65 extern const char kCategoryOrderEmergingMarketsOriented[]; | |
| 66 | |
| 67 enum class CategoryOrderChoice { | 60 enum class CategoryOrderChoice { |
| 68 GENERAL, | 61 GENERAL, |
| 69 EMERGING_MARKETS_ORIENTED, | 62 EMERGING_MARKETS_ORIENTED, |
| 70 }; | 63 }; |
| 64 extern const char kCategoryOrderGeneral[]; |
| 65 extern const char kCategoryOrderEmergingMarketsOriented[]; |
| 66 extern const base::FeatureParam<CategoryOrderChoice> kCategoryOrderParameter; |
| 71 | 67 |
| 72 // Returns which category order to use according to kCategoryOrder feature. | 68 // Returns which category order to use according to kCategoryOrder feature. |
| 73 CategoryOrderChoice GetSelectedCategoryOrder(); | 69 CategoryOrderChoice GetSelectedCategoryOrder(); |
| 74 | 70 |
| 75 } // namespace ntp_snippets | 71 } // namespace ntp_snippets |
| 76 | 72 |
| 77 #endif // COMPONENTS_NTP_SNIPPETS_FEATURES_H_ | 73 #endif // COMPONENTS_NTP_SNIPPETS_FEATURES_H_ |
| OLD | NEW |