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

Unified Diff: components/ntp_snippets/content_suggestions_service.h

Issue 2421463002: FetchMore functionality backend (Closed)
Patch Set: ID set reference, Optional callback, ... (2466863003 comments). Created 4 years, 1 month 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.h
diff --git a/components/ntp_snippets/content_suggestions_service.h b/components/ntp_snippets/content_suggestions_service.h
index be34e7290c43a0f9f3db422e13111c16b0fee6c6..9fc1b92d78cf42a3f2f33e5ddccfa51065e2f9f5 100644
--- a/components/ntp_snippets/content_suggestions_service.h
+++ b/components/ntp_snippets/content_suggestions_service.h
@@ -34,6 +34,7 @@ class Image;
namespace ntp_snippets {
class NTPSnippetsService;
+class NTPSnippetsFetcher;
// Retrieves suggestions from a number of ContentSuggestionsProviders and serves
// them grouped into categories. There can be at most one provider per category.
@@ -41,9 +42,12 @@ class ContentSuggestionsService : public KeyedService,
public ContentSuggestionsProvider::Observer,
public history::HistoryServiceObserver {
public:
+ // TODO(treib): All these should probably be OnceCallback.
using ImageFetchedCallback = base::Callback<void(const gfx::Image&)>;
using DismissedSuggestionsCallback = base::Callback<void(
std::vector<ContentSuggestion> dismissed_suggestions)>;
+ using FetchingCallback =
+ base::Callback<void(std::vector<ContentSuggestion> suggestions)>;
class Observer {
public:
@@ -135,6 +139,13 @@ class ContentSuggestionsService : public KeyedService,
// Returns whether |category| is dismissed.
bool IsCategoryDismissed(Category category) const;
+ // Fetches additional contents for the given |category|. If the fetch was
+ // completed, the given |callback| is called with the updated content.
+ // This includes new and old data.
+ void Fetch(const Category& category,
+ const std::set<std::string>& known_suggestion_ids,
+ const FetchingCallback& callback);
+
// Observer accessors.
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);

Powered by Google App Engine
This is Rietveld 408576698