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

Unified Diff: components/ntp_snippets/content_suggestions_service.cc

Issue 2422633002: [NTP Snippets] Properly restore the status of restored sections (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 8b1bdc15eae83a3180fece814448f8805d01484f..56497a741f085725b8ad2b232d2c69e70fdf0cdf 100644
--- a/components/ntp_snippets/content_suggestions_service.cc
+++ b/components/ntp_snippets/content_suggestions_service.cc
@@ -192,8 +192,11 @@ void ContentSuggestionsService::OnNewSuggestions(
if (RegisterCategoryIfRequired(provider, category))
NotifyCategoryStatusChanged(category);
- if (!IsCategoryStatusAvailable(provider->GetCategoryStatus(category)))
+ if (!IsCategoryStatusAvailable(provider->GetCategoryStatus(category))) {
+ // A provider shouldn't send us suggestions while it's not available.
+ DCHECK(suggestions.empty());
return;
+ }
suggestions_by_category_[category] = std::move(suggestions);

Powered by Google App Engine
This is Rietveld 408576698