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 #include "components/ntp_snippets/features.h" | 5 #include "components/ntp_snippets/features.h" |
6 | 6 |
7 #include "base/time/clock.h" | 7 #include "base/time/clock.h" |
8 #include "components/ntp_snippets/category_rankers/click_based_category_ranker.h
" | 8 #include "components/ntp_snippets/category_rankers/click_based_category_ranker.h
" |
9 #include "components/ntp_snippets/category_rankers/constant_category_ranker.h" | 9 #include "components/ntp_snippets/category_rankers/constant_category_ranker.h" |
10 #include "components/variations/variations_associated_data.h" | 10 #include "components/variations/variations_associated_data.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 const char kCategoryRankerConstantRanker[] = "constant"; | 54 const char kCategoryRankerConstantRanker[] = "constant"; |
55 const char kCategoryRankerClickBasedRanker[] = "click_based"; | 55 const char kCategoryRankerClickBasedRanker[] = "click_based"; |
56 | 56 |
57 CategoryRankerChoice GetSelectedCategoryRanker() { | 57 CategoryRankerChoice GetSelectedCategoryRanker() { |
58 std::string category_ranker_value = | 58 std::string category_ranker_value = |
59 variations::GetVariationParamValueByFeature(kCategoryRanker, | 59 variations::GetVariationParamValueByFeature(kCategoryRanker, |
60 kCategoryRankerParameter); | 60 kCategoryRankerParameter); |
61 | 61 |
62 if (category_ranker_value.empty()) { | 62 if (category_ranker_value.empty()) { |
63 // Default, Enabled or Disabled. | 63 // Default, Enabled or Disabled. |
64 return CategoryRankerChoice::CONSTANT; | 64 return CategoryRankerChoice::CLICK_BASED; |
65 } | 65 } |
66 if (category_ranker_value == kCategoryRankerConstantRanker) { | 66 if (category_ranker_value == kCategoryRankerConstantRanker) { |
67 return CategoryRankerChoice::CONSTANT; | 67 return CategoryRankerChoice::CONSTANT; |
68 } | 68 } |
69 if (category_ranker_value == kCategoryRankerClickBasedRanker) { | 69 if (category_ranker_value == kCategoryRankerClickBasedRanker) { |
70 return CategoryRankerChoice::CLICK_BASED; | 70 return CategoryRankerChoice::CLICK_BASED; |
71 } | 71 } |
72 | 72 |
73 NOTREACHED() << "The " << kCategoryRankerParameter << " parameter value is '" | 73 NOTREACHED() << "The " << kCategoryRankerParameter << " parameter value is '" |
74 << category_ranker_value << "'"; | 74 << category_ranker_value << "'"; |
(...skipping 11 matching lines...) Expand all Loading... |
86 return base::MakeUnique<ClickBasedCategoryRanker>(pref_service, | 86 return base::MakeUnique<ClickBasedCategoryRanker>(pref_service, |
87 std::move(clock)); | 87 std::move(clock)); |
88 default: | 88 default: |
89 NOTREACHED() << "The category ranker choice value is " | 89 NOTREACHED() << "The category ranker choice value is " |
90 << static_cast<int>(choice); | 90 << static_cast<int>(choice); |
91 } | 91 } |
92 return nullptr; | 92 return nullptr; |
93 } | 93 } |
94 | 94 |
95 } // namespace ntp_snippets | 95 } // namespace ntp_snippets |
OLD | NEW |