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

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

Issue 2804633003: Add base::FeatureParam<> struct (Closed)
Patch Set: rebase Created 3 years, 4 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 ee5680f25384982766db8e3bee0988e98baf6130..4cf488cf46b143ac6f0651795808e0a17ed8567d 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