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

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

Issue 2702223004: [Remote suggestions] Move all decisions to fetch to the scheduler (Closed)
Patch Set: Tim's comments #3 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/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 d0639cbdb97fc33a99b1ea3babd86b20dd5102ae..db89d7429cba62b80f8d2b4a7fb762e96fd6c6ec 100644
--- a/components/ntp_snippets/remote/scheduling_remote_suggestions_provider.h
+++ b/components/ntp_snippets/remote/scheduling_remote_suggestions_provider.h
@@ -68,6 +68,10 @@ class SchedulingRemoteSuggestionsProvider final
static void RegisterProfilePrefs(PrefRegistrySimple* registry);
// RemoteSuggestionsScheduler implementation.
+ void OnProviderActivated() override;
+ void OnProviderInactivated() override;
+ void OnSuggestionsCleared() override;
+ void OnHistoryCleared() override;
void RescheduleFetching() override;
void OnPersistentSchedulerWakeUp() override;
void OnBrowserForegrounded() override;
@@ -75,8 +79,8 @@ class SchedulingRemoteSuggestionsProvider final
void OnNTPOpened() override;
// RemoteSuggestionsProvider implementation.
- void SetProviderStatusCallback(
- std::unique_ptr<ProviderStatusCallback> callback) override;
+ void SetRemoteSuggestionsScheduler(
+ RemoteSuggestionsScheduler* scheduler) override;
void RefetchInTheBackground(
std::unique_ptr<FetchStatusCallback> callback) override;
const RemoteSuggestionsFetcher* suggestions_fetcher_for_debugging()
@@ -119,10 +123,6 @@ class SchedulingRemoteSuggestionsProvider final
enum class TriggerType;
- // Callback that is notified whenever the status of |provider_| changes.
- void OnProviderStatusChanged(
- RemoteSuggestionsProvider::ProviderStatus status);
-
// After the call, updates will be scheduled in the future. Idempotent, can be
// run any time later without impacting the current schedule.
// If you want to enforce rescheduling, call Unschedule() and then Schedule().
@@ -156,6 +156,10 @@ class SchedulingRemoteSuggestionsProvider final
// Common function to call after a fetch of any type is finished.
void OnFetchCompleted(Status fetch_status);
+ // Clears the time of the last fetch so that the provider is ready to make a
+ // soft fetch at any later time (upon a trigger).
+ void ClearLastFetchAttemptTime();
+
FetchingSchedule GetDesiredFetchingSchedule() const;
// Load and store |schedule_|.
@@ -188,6 +192,8 @@ class SchedulingRemoteSuggestionsProvider final
std::unique_ptr<base::Clock> clock_;
std::set<SchedulingRemoteSuggestionsProvider::TriggerType> enabled_triggers_;
+ base::Time background_fetches_allowed_after_;
+
DISALLOW_COPY_AND_ASSIGN(SchedulingRemoteSuggestionsProvider);
};

Powered by Google App Engine
This is Rietveld 408576698