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

Unified Diff: components/ntp_snippets/remote/ntp_snippets_fetcher.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/remote/ntp_snippets_fetcher.h
diff --git a/components/ntp_snippets/remote/ntp_snippets_fetcher.h b/components/ntp_snippets/remote/ntp_snippets_fetcher.h
index ce40c5539207362b11a8693ce4f235ef76aad2c8..382021f575dd5400895e922280ec47ec5a3d513c 100644
--- a/components/ntp_snippets/remote/ntp_snippets_fetcher.h
+++ b/components/ntp_snippets/remote/ntp_snippets_fetcher.h
@@ -65,7 +65,7 @@ class NTPSnippetsFetcher : public OAuth2TokenService::Consumer,
// occur, |snippets| contains no value (no actual vector in base::Optional).
// Error details can be retrieved using last_status().
using SnippetsAvailableCallback =
- base::Callback<void(OptionalFetchedCategories fetched_categories)>;
+ base::OnceCallback<void(OptionalFetchedCategories fetched_categories)>;
// Enumeration listing all possible outcomes for fetch attempts. Used for UMA
// histograms, so do not change existing values. Insert new values at the end,
@@ -112,6 +112,9 @@ class NTPSnippetsFetcher : public OAuth2TokenService::Consumer,
// user action. Typically, non-interactive requests are subject to a daily
// quota.
bool interactive_request = false;
+
+ // If set, only return results for this category.
+ base::Optional<Category> exclusive_category;
};
NTPSnippetsFetcher(
@@ -126,17 +129,13 @@ class NTPSnippetsFetcher : public OAuth2TokenService::Consumer,
const UserClassifier* user_classifier);
~NTPSnippetsFetcher() override;
- // Set a callback that is called when a new set of snippets are downloaded,
- // overriding any previously set callback.
- void SetCallback(const SnippetsAvailableCallback& callback);
-
// Initiates a fetch from the server. When done (successfully or not), calls
// the subscriber of SetCallback().
//
// If an ongoing fetch exists, it will be silently abandoned and a new one
// started, without triggering an additional callback (i.e. the callback will
// only be called once).
- void FetchSnippets(const Params& params);
+ void FetchSnippets(const Params& params, SnippetsAvailableCallback callback);
// Debug string representing the status/result of the last fetch attempt.
const std::string& last_status() const { return last_status_; }
@@ -227,6 +226,7 @@ class NTPSnippetsFetcher : public OAuth2TokenService::Consumer,
void FetchFinished(OptionalFetchedCategories fetched_categories,
FetchResult result,
const std::string& extra_message);
+ void FilterCategories(FetchedCategoriesVector* categories);
bool DemandQuotaForRequest(bool interactive_request);

Powered by Google App Engine
This is Rietveld 408576698