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

Unified Diff: components/ntp_snippets/content_suggestions_provider.h

Issue 2406573002: 📰 Persist category dismissals (Closed)
Patch Set: ready for 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
« no previous file with comments | « components/ntp_snippets/category.cc ('k') | components/ntp_snippets/content_suggestions_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_snippets/content_suggestions_provider.h
diff --git a/components/ntp_snippets/content_suggestions_provider.h b/components/ntp_snippets/content_suggestions_provider.h
index f6741356d66e6cfc0a3773c83c8afe25a6d63d83..476385468b52a38dd219cea5ddcb891af09590fe 100644
--- a/components/ntp_snippets/content_suggestions_provider.h
+++ b/components/ntp_snippets/content_suggestions_provider.h
@@ -5,6 +5,7 @@
#ifndef COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_
#define COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_
+#include <map>
#include <string>
#include <vector>
@@ -35,19 +36,34 @@ class ContentSuggestionsProvider {
// The observer of a provider is notified when new data is available.
class Observer {
public:
+ typedef std::
+ map<Category, std::vector<ContentSuggestion>, Category::CompareByID>
+ SuggestionBatch;
+
// Called when the available content changed.
- // If a provider provides suggestions for multiple categories, this callback
- // is called once per category. The |suggestions| parameter always contains
- // the full list of currently available suggestions for that category, i.e.,
- // an empty list will remove all suggestions from the given category. Note
- // that to clear them from the UI immediately, the provider needs to change
- // the status of the respective category. If the given |category| is not
- // known yet, the calling |provider| will be registered as its provider.
+ // If a provider provides suggestions for multiple categories, it should
+ // use OnNewSuggestionBatch() instead. The |suggestions| parameter always
+ // contains the full list of currently available suggestions for that
+ // category, i.e., an empty list will remove all suggestions from the given
+ // category. Note that to clear them from the UI immediately, the provider
+ // needs to change the status of the respective category. If the given
+ // |category| is not known yet, the calling |provider| will be registered as
+ // its provider.
virtual void OnNewSuggestions(
ContentSuggestionsProvider* provider,
Category category,
std::vector<ContentSuggestion> suggestions) = 0;
+ // Called when the available content for multiple categories changed.
+ // The |suggestions| parameter always contains the full list of currently
+ // available suggestions for that category, i.e., an empty list will remove
+ // all suggestions from the given category. Note that to clear them from the
+ // UI immediately, the provider needs to change the status of the respective
+ // category. If the given |category| is not known yet, the calling
+ // |provider| will be registered as its provider.
+ virtual void OnNewSuggestionBatch(ContentSuggestionsProvider* provider,
tschumann 2016/10/10 16:50:54 Do we really need this batching functionality? Why
dgn 2016/10/10 18:27:59 This is to have the full list of remote categories
dgn 2016/10/10 19:54:53 Actually, I still need the suggestions, or at leas
tschumann 2016/10/10 20:40:23 How important is that cleanup? Does the UI need to
dgn 2016/10/10 21:10:18 The UI does not need to worry about it. The only p
+ SuggestionBatch suggestion_batch) = 0;
+
// Called when the status of a category changed, including when it is added.
// If |new_status| is NOT_PROVIDED, the calling provider must be the one
// that currently provides the |category|, and the category is unregistered
« no previous file with comments | « components/ntp_snippets/category.cc ('k') | components/ntp_snippets/content_suggestions_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698