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

Unified Diff: components/ntp_snippets/content_suggestions_service.cc

Issue 2400783003: Ntp: show AllDismissedItem when all sections have been dismissed. (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 f52a9809d09dcae42dbad4cd9a62ff9598870423..6bc5b5eff789b5907f7a7be4494ec15b20617a5a 100644
--- a/components/ntp_snippets/content_suggestions_service.cc
+++ b/components/ntp_snippets/content_suggestions_service.cc
@@ -150,11 +150,18 @@ void ContentSuggestionsService::DismissCategory(Category category) {
if (providers_it == providers_by_category_.end())
return;
+ dismissed_providers_by_category_[providers_it->first] = providers_it->second;
providers_by_category_.erase(providers_it);
categories_.erase(
std::find(categories_.begin(), categories_.end(), category));
}
+void ContentSuggestionsService::RestoreDismissedCategories() {
+ for (const auto& it : dismissed_providers_by_category_)
Marc Treib 2016/10/07 11:40:13 nit: Please give |it| another name, it's not an it
Michael van Ouwerkerk 2016/10/10 16:19:32 Done.
+ RegisterCategoryIfRequired(it.second, it.first);
+ dismissed_providers_by_category_.clear();
+}
+
void ContentSuggestionsService::AddObserver(Observer* observer) {
observers_.AddObserver(observer);
}

Powered by Google App Engine
This is Rietveld 408576698