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

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

Issue 2702223004: [Remote suggestions] Move all decisions to fetch to the scheduler (Closed)
Patch Set: Marc's comments Created 3 years, 10 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_provider.h
diff --git a/components/ntp_snippets/remote/remote_suggestions_provider.h b/components/ntp_snippets/remote/remote_suggestions_provider.h
index c9f58c45fb10639a62bdddc4a7131906f75552a7..e94d5e6fc26abfb4990bc7c17767e1e35d9130cb 100644
--- a/components/ntp_snippets/remote/remote_suggestions_provider.h
+++ b/components/ntp_snippets/remote/remote_suggestions_provider.h
@@ -14,19 +14,12 @@
namespace ntp_snippets {
class RemoteSuggestionsFetcher;
+class RemoteSuggestionsScheduler;
// Retrieves fresh content data (articles) from the server, stores them and
// provides them as content suggestions.
class RemoteSuggestionsProvider : public ContentSuggestionsProvider {
public:
- // TODO(jkrcal): Would be nice to get rid of this another level of statuses.
- // Maybe possible while refactoring the RemoteSuggestionsStatusService? (and
- // letting it notify both the SchedulingRemoteSuggestionsProvider and
- // RemoteSuggestionsProviderImpl or just the scheduling one).
- enum class ProviderStatus { ACTIVE, INACTIVE };
- using ProviderStatusCallback =
- base::RepeatingCallback<void(ProviderStatus status)>;
-
// Callback to notify with the result of a fetch.
// TODO(jkrcal): Change to OnceCallback? A OnceCallback does only have a
// move-constructor which seems problematic for google mock.
@@ -34,13 +27,12 @@ class RemoteSuggestionsProvider : public ContentSuggestionsProvider {
~RemoteSuggestionsProvider() override;
- // Set a callback to be notified whenever the status of the provider changes.
- // The initial change is also notified (switching from an initial undecided
- // status). If the callback is set after the first change, it is called back
- // immediately.
- // TODO(treib): Get rid of unique_ptrs to callbacks.
- virtual void SetProviderStatusCallback(
- std::unique_ptr<ProviderStatusCallback> callback) = 0;
+ // Set the scheduler to be notified whenever the provider becomes active /
+ // in-active and whenever history is deleted. The initial change is also
+ // notified (switching from an initial undecided status). If the scheduler is
+ // set after the first change, it is called back immediately.
+ virtual void SetRemoteSuggestionsScheduler(
tschumann 2017/02/24 09:37:12 Completely missed this (and thanks Marc for pointi
jkrcal 2017/02/24 09:47:04 I am puzzled: How is this different from the previ
tschumann 2017/02/24 10:22:59 The main issue was here before (guess we missed th
+ RemoteSuggestionsScheduler* scheduler) = 0;
// Fetches suggestions from the server for all remote categories and replaces
// old suggestions by the new ones. The request to the server is performed as

Powered by Google App Engine
This is Rietveld 408576698