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

Unified Diff: components/ntp_snippets/content_suggestions_service.cc

Issue 2438543003: [NTP Snippets] NTPSnippetsService: notify about new suggestions only in changed categories (Closed)
Patch Set: 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/content_suggestions_service.cc
diff --git a/components/ntp_snippets/content_suggestions_service.cc b/components/ntp_snippets/content_suggestions_service.cc
index 169afc154ded3cf2f0e9d32da806c5c97f65360d..eabac44ac042988c458d991c782a934f512a00c3 100644
--- a/components/ntp_snippets/content_suggestions_service.cc
+++ b/components/ntp_snippets/content_suggestions_service.cc
@@ -202,6 +202,10 @@ void ContentSuggestionsService::OnNewSuggestions(
ContentSuggestionsProvider* provider,
Category category,
std::vector<ContentSuggestion> suggestions) {
+ // Providers shouldn't call this when they're in a non-available state.
+ DCHECK(
+ IsCategoryStatusInitOrAvailable(provider->GetCategoryStatus(category)));
+
if (TryRegisterProviderForCategory(provider, category)) {
NotifyCategoryStatusChanged(category);
} else if (IsCategoryDismissed(category)) {

Powered by Google App Engine
This is Rietveld 408576698