| 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..a48f0f2d3131122f5d5539f1516bf982b11a2c5d 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,13 @@ class NTPSnippetsFetcher : public OAuth2TokenService::Consumer,
|
| // user action. Typically, non-interactive requests are subject to a daily
|
| // quota.
|
| bool interactive_request = false;
|
| +
|
| + // If set, the request is returning this category only; otherwise all
|
| + // available categories are returned.
|
| + base::Optional<Category> exclusive_category;
|
| +
|
| + // The callback to notify when new snippets get fetched.
|
| + SnippetsAvailableCallback snippets_available_callback;
|
| };
|
|
|
| NTPSnippetsFetcher(
|
| @@ -126,12 +133,8 @@ 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().
|
| + // callback that was passed along with the |params|.
|
| //
|
| // 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
|
| @@ -227,6 +230,7 @@ class NTPSnippetsFetcher : public OAuth2TokenService::Consumer,
|
| void FetchFinished(OptionalFetchedCategories fetched_categories,
|
| FetchResult result,
|
| const std::string& extra_message);
|
| + void FilterCategories(OptionalFetchedCategories* fetched) const;
|
|
|
| bool DemandQuotaForRequest(bool interactive_request);
|
|
|
| @@ -270,9 +274,6 @@ class NTPSnippetsFetcher : public OAuth2TokenService::Consumer,
|
| RequestThrottler request_throttler_active_ntp_user_;
|
| RequestThrottler request_throttler_active_suggestions_consumer_;
|
|
|
| - // The callback to notify when new snippets get fetched.
|
| - SnippetsAvailableCallback snippets_available_callback_;
|
| -
|
| // The parameters for the current request.
|
| Params params_;
|
|
|
|
|