Chromium Code Reviews| Index: components/ntp_snippets/remote/scheduling_remote_suggestions_provider.h |
| diff --git a/components/ntp_snippets/remote/scheduling_remote_suggestions_provider.h b/components/ntp_snippets/remote/scheduling_remote_suggestions_provider.h |
| index 5d6981220317f19ead2e6539a16342631376f525..35946a15229d5400bf0026bc03810e7d33574597 100644 |
| --- a/components/ntp_snippets/remote/scheduling_remote_suggestions_provider.h |
| +++ b/components/ntp_snippets/remote/scheduling_remote_suggestions_provider.h |
| @@ -17,6 +17,7 @@ |
| #include "components/ntp_snippets/remote/persistent_scheduler.h" |
| #include "components/ntp_snippets/remote/remote_suggestions_provider.h" |
| #include "components/ntp_snippets/remote/remote_suggestions_scheduler.h" |
| +#include "components/ntp_snippets/remote/request_throttler.h" |
| class PrefRegistrySimple; |
| class PrefService; |
| @@ -146,6 +147,9 @@ class SchedulingRemoteSuggestionsProvider final |
| // Returns whether background fetching (for the given |trigger|) is disabled. |
| bool BackgroundFetchesDisabled(TriggerType trigger) const; |
| + // Returns true if quota is available for another request. |
| + bool DemandQuotaForRequest(bool interactive_request); |
|
tschumann
2017/02/24 10:18:08
nit: would AcquireQuota() be a better name? We hav
jkrcal
2017/02/27 10:26:23
Done.
|
| + |
| // Callback after Fetch is completed. |
| void FetchFinished(const FetchDoneCallback& callback, |
| Status fetch_status, |
| @@ -191,6 +195,11 @@ class SchedulingRemoteSuggestionsProvider final |
| // Used to adapt the schedule based on usage activity of the user. Not owned. |
| const UserClassifier* user_classifier_; |
| + // Request throttlers for limiting requests for different classes of users. |
| + RequestThrottler request_throttler_rare_ntp_user_; |
| + RequestThrottler request_throttler_active_ntp_user_; |
| + RequestThrottler request_throttler_active_suggestions_consumer_; |
| + |
| PrefService* pref_service_; |
| std::unique_ptr<base::Clock> clock_; |
| std::set<SchedulingRemoteSuggestionsProvider::TriggerType> enabled_triggers_; |