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

Unified Diff: components/ntp_snippets/content_suggestions_service.cc

Issue 2225753003: Revert of Add per-section clearing and dismissed suggestions to snippets-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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/content_suggestions_service.cc
diff --git a/components/ntp_snippets/content_suggestions_service.cc b/components/ntp_snippets/content_suggestions_service.cc
index 5d39f48383fccc79f83a78e3147e8094a295a787..43ee91ef2542ea02ef3d1af0723761ffe8b84ee5 100644
--- a/components/ntp_snippets/content_suggestions_service.cc
+++ b/components/ntp_snippets/content_suggestions_service.cc
@@ -79,42 +79,19 @@
callback);
}
-void ContentSuggestionsService::ClearAllCachedSuggestionsForDebugging() {
+void ContentSuggestionsService::ClearCachedSuggestionsForDebugging() {
suggestions_by_category_.clear();
id_category_map_.clear();
- for (const auto& category_provider_pair : providers_by_category_) {
- category_provider_pair.second->ClearCachedSuggestionsForDebugging(
- category_provider_pair.first);
+ for (auto& category_provider_pair : providers_by_category_) {
+ category_provider_pair.second->ClearCachedSuggestionsForDebugging();
}
FOR_EACH_OBSERVER(Observer, observers_, OnNewSuggestions());
}
-void ContentSuggestionsService::ClearCachedSuggestionsForDebugging(
- Category category) {
- for (const ContentSuggestion& suggestion :
- suggestions_by_category_[category]) {
- id_category_map_.erase(suggestion.id());
- }
- suggestions_by_category_[category].clear();
- auto iterator = providers_by_category_.find(category);
- if (iterator != providers_by_category_.end())
- iterator->second->ClearCachedSuggestionsForDebugging(category);
-}
-
-std::vector<ContentSuggestion>
-ContentSuggestionsService::GetDismissedSuggestionsForDebugging(
- Category category) {
- auto iterator = providers_by_category_.find(category);
- if (iterator == providers_by_category_.end())
- return std::vector<ContentSuggestion>();
- return iterator->second->GetDismissedSuggestionsForDebugging(category);
-}
-
-void ContentSuggestionsService::ClearDismissedSuggestionsForDebugging(
- Category category) {
- auto iterator = providers_by_category_.find(category);
- if (iterator != providers_by_category_.end())
- iterator->second->ClearDismissedSuggestionsForDebugging(category);
+void ContentSuggestionsService::ClearDismissedSuggestionsForDebugging() {
+ for (auto& category_provider_pair : providers_by_category_) {
+ category_provider_pair.second->ClearDismissedSuggestionsForDebugging();
+ }
}
void ContentSuggestionsService::DismissSuggestion(
« no previous file with comments | « components/ntp_snippets/content_suggestions_service.h ('k') | components/ntp_snippets/content_suggestions_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698