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

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

Issue 2447163004: [NTP Snippets] Pass "no suggestions" message from the backend to the UI (Closed)
Patch Set: review Created 4 years, 2 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 777e2a32254203dc78b58159c1def5634bc66d1a..cb248aa047927e6fa65d223db8d2a6d91c061e9d 100644
--- a/components/ntp_snippets/offline_pages/recent_tab_suggestions_provider.cc
+++ b/components/ntp_snippets/offline_pages/recent_tab_suggestions_provider.cc
@@ -73,18 +73,15 @@ CategoryStatus RecentTabSuggestionsProvider::GetCategoryStatus(
}
CategoryInfo RecentTabSuggestionsProvider::GetCategoryInfo(Category category) {
- if (category == provided_category_) {
- return CategoryInfo(l10n_util::GetStringUTF16(
- IDS_NTP_RECENT_TAB_SUGGESTIONS_SECTION_HEADER),
- ContentSuggestionsCardLayout::MINIMAL_CARD,
- /*has_more_button=*/false,
- /*show_if_empty=*/false);
- }
- NOTREACHED() << "Unknown category " << category.id();
- return CategoryInfo(base::string16(),
- ContentSuggestionsCardLayout::MINIMAL_CARD,
- /*has_more_button=*/false,
- /*show_if_empty=*/false);
+ DCHECK_EQ(provided_category_, category);
+ return CategoryInfo(
+ l10n_util::GetStringUTF16(IDS_NTP_RECENT_TAB_SUGGESTIONS_SECTION_HEADER),
+ ContentSuggestionsCardLayout::MINIMAL_CARD,
+ /*has_more_button=*/false,
+ /*show_if_empty=*/false,
+ l10n_util::GetStringUTF16(IDS_NTP_SUGGESTIONS_SECTION_EMPTY));
+ // TODO(vitaliii): Replace IDS_NTP_SUGGESTIONS_SECTION_EMPTY with a
+ // category-specific string.
}
void RecentTabSuggestionsProvider::DismissSuggestion(

Powered by Google App Engine
This is Rietveld 408576698