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

Unified Diff: components/ntp_snippets/remote/ntp_snippets_service.h

Issue 2466863003: Finalize backend for fetching more NTPSnippets. (Closed)
Patch Set: Known suggestion are now a parameter for Fetch. 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/remote/ntp_snippets_service.h
diff --git a/components/ntp_snippets/remote/ntp_snippets_service.h b/components/ntp_snippets/remote/ntp_snippets_service.h
index a330622b8af979adec4f0490734ba8cad514933e..0bf8891b197badd990b1454745851751a40f50fc 100644
--- a/components/ntp_snippets/remote/ntp_snippets_service.h
+++ b/components/ntp_snippets/remote/ntp_snippets_service.h
@@ -117,8 +117,9 @@ class NTPSnippetsService final : public ContentSuggestionsProvider,
void DismissSuggestion(const ContentSuggestion::ID& suggestion_id) override;
void FetchSuggestionImage(const ContentSuggestion::ID& suggestion_id,
const ImageFetchedCallback& callback) override;
- void FetchMore(const Category& category,
- FetchedMoreCallback callback) override;
+ void Fetch(const Category& category,
+ std::set<std::string> known_suggestion_ids,
+ FetchingCallback callback) override;
void ClearHistory(
base::Time begin,
base::Time end,
@@ -213,7 +214,7 @@ class NTPSnippetsService final : public ContentSuggestionsProvider,
// Callback for the NTPSnippetsFetcher.
void OnFetchFinished(
bool fetched_more,
- FetchedMoreCallback fetched_more_callback,
+ FetchingCallback fetched_more_callback,
NTPSnippetsFetcher::OptionalFetchedCategories fetched_categories);
// Moves all snippets from |to_archive| into the archive of the |category|.
@@ -285,7 +286,7 @@ class NTPSnippetsService final : public ContentSuggestionsProvider,
// Converts the cached snippets in the given |category| to content suggestions
// and passes them to the |callback|.
- void NotifyMoreSuggestions(Category category, FetchedMoreCallback callback);
+ void NotifyMoreSuggestions(Category category, FetchingCallback callback);
// Updates the internal status for |category| to |category_status_| and
// notifies the content suggestions observer if it changed.
@@ -296,19 +297,22 @@ class NTPSnippetsService final : public ContentSuggestionsProvider,
void RestoreCategoriesFromPrefs();
void StoreCategoriesToPrefs();
- // Implementation for |FetchSnippets| and |FetchMore| that calls the snippet
+ // Implementation for |FetchSnippets| and |Fetch| that calls the snippet
// fetcher and replaces or adds the fetched snippets depending on the
// |fetch_more| parameter.
void FetchSnippetsFromHostsImpl(const std::set<std::string>& hosts,
bool interactive_request,
bool fetch_more,
- FetchedMoreCallback fetched_more_callback,
- base::Optional<Category> exclusive_category);
+ std::set<std::string> known_suggestion_ids,
+ base::Optional<Category> exclusive_category,
+ FetchingCallback fetched_more_callback);
- // Returns a set of snippet IDs that should not be fetcheds. These IDs always
+ // Returns a set of snippet IDs that should not be fetched. These IDs always
// include dismissed snippets. If |fetch_more| is set, they include all known
// snippet IDs.
- std::set<std::string> CollectIdsToExclude(bool fetch_more) const;
+ std::set<std::string> CollectIdsToExclude(
+ bool fetch_more,
+ std::set<std::string> additional_ids) const;
void MarkEmptyCategoriesAsLoading();

Powered by Google App Engine
This is Rietveld 408576698