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

Unified Diff: components/ntp_snippets/offline_pages/recent_tab_suggestions_provider.cc

Issue 2804633003: Add base::FeatureParam<> struct (Closed)
Patch Set: Remove windows-incompatible constexpr Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: components/ntp_snippets/offline_pages/recent_tab_suggestions_provider.cc
diff --git a/components/ntp_snippets/offline_pages/recent_tab_suggestions_provider.cc b/components/ntp_snippets/offline_pages/recent_tab_suggestions_provider.cc
index 43be2a4daa6fc31d291f82b8c6c3692a164520ae..3e9b6c1291edfab60cbc67a178f07299719aa92a 100644
--- a/components/ntp_snippets/offline_pages/recent_tab_suggestions_provider.cc
+++ b/components/ntp_snippets/offline_pages/recent_tab_suggestions_provider.cc
@@ -32,15 +32,8 @@ namespace ntp_snippets {
namespace {
-const int kDefaultMaxSuggestionsCount = 5;
-
-const char* kMaxSuggestionsCountParamName = "recent_tabs_max_count";
-
-int GetMaxSuggestionsCount() {
- return variations::GetVariationParamByFeatureAsInt(
- kRecentOfflineTabSuggestionsFeature, kMaxSuggestionsCountParamName,
- kDefaultMaxSuggestionsCount);
-}
+const base::FeatureParam<int> kMaxSuggestionsCountParam{
+ &kRecentOfflineTabSuggestionsFeature, "recent_tabs_max_count", 5};
struct OrderUIItemsByMostRecentlyCreatedFirst {
bool operator()(const DownloadUIItem* left,
@@ -279,7 +272,8 @@ RecentTabSuggestionsProvider::GetMostRecentlyCreatedWithoutDuplicates(
std::vector<ContentSuggestion> suggestions;
for (const DownloadUIItem* ui_item : ui_items) {
suggestions.push_back(ConvertUIItem(*ui_item));
- if (static_cast<int>(suggestions.size()) == GetMaxSuggestionsCount()) {
+ if (static_cast<int>(suggestions.size()) ==
+ kMaxSuggestionsCountParam.Get()) {
break;
}
}

Powered by Google App Engine
This is Rietveld 408576698