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

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

Issue 2599293002: [NTP::SectionOrder] Implement click counts decay. (Closed)
Patch Set: ios factory. Created 3 years, 11 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
« no previous file with comments | « components/ntp_snippets/features.h ('k') | components/ntp_snippets/pref_names.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "components/ntp_snippets/features.h" 5 #include "components/ntp_snippets/features.h"
6 6
7 #include "base/time/clock.h"
7 #include "components/ntp_snippets/category_rankers/click_based_category_ranker.h " 8 #include "components/ntp_snippets/category_rankers/click_based_category_ranker.h "
8 #include "components/ntp_snippets/category_rankers/constant_category_ranker.h" 9 #include "components/ntp_snippets/category_rankers/constant_category_ranker.h"
9 #include "components/variations/variations_associated_data.h" 10 #include "components/variations/variations_associated_data.h"
10 11
11 namespace ntp_snippets { 12 namespace ntp_snippets {
12 13
13 const base::Feature kArticleSuggestionsFeature{ 14 const base::Feature kArticleSuggestionsFeature{
14 "NTPArticleSuggestions", base::FEATURE_ENABLED_BY_DEFAULT}; 15 "NTPArticleSuggestions", base::FEATURE_ENABLED_BY_DEFAULT};
15 16
16 const base::Feature kBookmarkSuggestionsFeature{ 17 const base::Feature kBookmarkSuggestionsFeature{
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 if (category_ranker_value == kCategoryRankerClickBasedRanker) { 69 if (category_ranker_value == kCategoryRankerClickBasedRanker) {
69 return CategoryRankerChoice::CLICK_BASED; 70 return CategoryRankerChoice::CLICK_BASED;
70 } 71 }
71 72
72 NOTREACHED() << "The " << kCategoryRankerParameter << " parameter value is '" 73 NOTREACHED() << "The " << kCategoryRankerParameter << " parameter value is '"
73 << category_ranker_value << "'"; 74 << category_ranker_value << "'";
74 return CategoryRankerChoice::CONSTANT; 75 return CategoryRankerChoice::CONSTANT;
75 } 76 }
76 77
77 std::unique_ptr<CategoryRanker> BuildSelectedCategoryRanker( 78 std::unique_ptr<CategoryRanker> BuildSelectedCategoryRanker(
78 PrefService* pref_service) { 79 PrefService* pref_service,
80 std::unique_ptr<base::Clock> clock) {
79 CategoryRankerChoice choice = ntp_snippets::GetSelectedCategoryRanker(); 81 CategoryRankerChoice choice = ntp_snippets::GetSelectedCategoryRanker();
80 switch (choice) { 82 switch (choice) {
81 case CategoryRankerChoice::CONSTANT: 83 case CategoryRankerChoice::CONSTANT:
82 return base::MakeUnique<ConstantCategoryRanker>(); 84 return base::MakeUnique<ConstantCategoryRanker>();
83 case CategoryRankerChoice::CLICK_BASED: 85 case CategoryRankerChoice::CLICK_BASED:
84 return base::MakeUnique<ClickBasedCategoryRanker>(pref_service); 86 return base::MakeUnique<ClickBasedCategoryRanker>(pref_service,
87 std::move(clock));
85 default: 88 default:
86 NOTREACHED() << "The category ranker choice value is " 89 NOTREACHED() << "The category ranker choice value is "
87 << static_cast<int>(choice); 90 << static_cast<int>(choice);
88 } 91 }
89 return nullptr; 92 return nullptr;
90 } 93 }
91 94
92 } // namespace ntp_snippets 95 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « components/ntp_snippets/features.h ('k') | components/ntp_snippets/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698