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

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

Issue 2774663002: [Remote suggestions] Refactor the scheduler (Closed)
Patch Set: Fix iOS compile Created 3 years, 9 months 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/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..147d22357d07f930100d7221913f05ae6abecff6 100644
--- a/components/ntp_snippets/remote/remote_suggestions_scheduler.h
+++ b/components/ntp_snippets/remote/remote_suggestions_scheduler.h
@@ -6,6 +6,7 @@
#define COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_SCHEDULER_H_
#include "base/macros.h"
+#include "components/ntp_snippets/remote/remote_suggestions_provider.h"
Marc Treib 2017/03/27 11:31:00 I think this can just be forward declared.
jkrcal 2017/03/27 14:09:31 Done.
namespace ntp_snippets {
@@ -29,6 +30,13 @@ class RemoteSuggestionsScheduler {
// because history gets cleared (and we must not show them any more).
virtual void OnHistoryCleared() = 0;
+ // 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;
Marc Treib 2017/03/27 11:31:00 #include for Status?
jkrcal 2017/03/27 14:09:31 I forward-declared it.
+
// External triggers to consider fetching content suggestions.
// Called whenever chrome is started warm or the user switches to Chrome.
@@ -47,6 +55,14 @@ class RemoteSuggestionsScheduler {
// Force rescheduling of fetching.
virtual void RescheduleFetching() = 0;
+
+ void set_provider(RemoteSuggestionsProvider* provider) {
+ provider_ = provider;
+ };
+
+ protected:
+ // Interface for doing all the actual work (apart from scheduling).
+ RemoteSuggestionsProvider* provider_;
Marc Treib 2017/03/27 11:31:00 Maybe move this out of the interface and into the
jkrcal 2017/03/27 14:09:31 Moved out.
};
} // namespace ntp_snippets

Powered by Google App Engine
This is Rietveld 408576698