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

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

Issue 2611523004: [Background fetching] Background fetching when opening an NTP. (Closed)
Patch Set: Created 3 years, 12 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 71dd4f8c487c1db86a7047cb25e4d82576a603d7..db3580cf0c2951552515e40929578002875a5b6c 100644
--- a/components/ntp_snippets/remote/scheduling_remote_suggestions_provider.h
+++ b/components/ntp_snippets/remote/scheduling_remote_suggestions_provider.h
@@ -114,20 +114,26 @@ class SchedulingRemoteSuggestionsProvider final
// schedule.
void StopScheduling();
+ // Checks whether it is time to perform a soft background fetch.
+ bool ShouldRefetchInTheBackgroundNow();
+
// Callback after Fetch is completed.
void FetchFinished(const FetchDoneCallback& callback,
- Status status_code,
+ Status fetch_status,
std::vector<ContentSuggestion> suggestions);
+ // Callback after RefetchInTheBackground is completed.
+ void RefetchInTheBackgroundFinished(
+ std::unique_ptr<FetchStatusCallback> callback,
+ Status fetch_status);
+
FetchingSchedule GetDesiredFetchingSchedule() const;
FetchingSchedule GetLastFetchingSchedule() const;
void StoreLastFetchingSchedule(const FetchingSchedule& schedule);
- // Common function to call after each fetch.
- void OnFetchCompleted(Status status);
-
// Applies the provided |schedule|.
- void ApplyFetchingSchedule(const FetchingSchedule& schedule);
+ void ApplyFetchingSchedule(const FetchingSchedule& schedule,
+ bool also_apply_persistent_schedule);
// Interface for doing all the actual work (apart from scheduling).
std::unique_ptr<RemoteSuggestionsProvider> provider_;
@@ -136,6 +142,8 @@ class SchedulingRemoteSuggestionsProvider final
// null.
PersistentScheduler* persistent_scheduler_;
+ bool background_fetch_in_progress_;
+
// Used to adapt the schedule based on usage activity of the user. Not owned.
const UserClassifier* user_classifier_;

Powered by Google App Engine
This is Rietveld 408576698