Chromium Code Reviews| Index: components/ntp_snippets/remote/remote_suggestions_scheduler.h |
| diff --git a/components/ntp_snippets/remote/remote_suggestions_scheduler.h b/components/ntp_snippets/remote/remote_suggestions_scheduler.h |
| index 40eb5fa6bf40a0cf25df1052b9054540472fbe66..149f1b95a22d78c67da08d0b198d22d407c792e3 100644 |
| --- a/components/ntp_snippets/remote/remote_suggestions_scheduler.h |
| +++ b/components/ntp_snippets/remote/remote_suggestions_scheduler.h |
| @@ -9,10 +9,17 @@ |
| namespace ntp_snippets { |
| -// Interface for informing the scheduler. |
| +class RemoteSuggestionsProvider; |
| +struct Status; |
| + |
| +// The scheduler for background fetching of remote suggestions has two callers: |
| +// a) The actual provider that implements the fetching informs the scheduler |
| +// about relevant events and changes in its state. |
| +// b) External parties (such as the UI) that need to inform the scheduler about |
| +// their events. |
| class RemoteSuggestionsScheduler { |
| public: |
| - // Internal triggers to consider fetching content suggestions. |
| + // ***** Internal triggers to consider fetching content suggestions. ***** |
| // Called whenever the remote suggestions provider becomes active (on startup, |
| // or later on). |
| @@ -29,7 +36,18 @@ class RemoteSuggestionsScheduler { |
| // because history gets cleared (and we must not show them any more). |
| virtual void OnHistoryCleared() = 0; |
| - // External triggers to consider fetching content suggestions. |
| + // Returns true if quota is available for another request. |
| + virtual bool AcquireQuotaForInteractiveFetch() = 0; |
| + |
| + // Called whenever the remote suggestions provider finishes an interactive |
| + // fetch (with provided |fetch_status|). |
| + virtual void OnInteractiveFetchFinished(Status fetch_status) = 0; |
| + |
| + // Set the provider that performs background fetching. Should be only called |
| + // by the factory. |
| + virtual void SetProvider(RemoteSuggestionsProvider* provider) = 0; |
|
Marc Treib
2017/03/27 14:27:21
This isn't considered part of the "internal trigge
jkrcal
2017/03/29 10:55:57
Done.
|
| + |
| + // ***** External triggers to consider fetching content suggestions. ***** |
| // Called whenever chrome is started warm or the user switches to Chrome. |
| virtual void OnBrowserForegrounded() = 0; |