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

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

Issue 2626433005: [Background fetching] Configure and report fetching triggers (Closed)
Patch Set: Tim's comments #2 Created 3 years, 11 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
« no previous file with comments | « no previous file | components/ntp_snippets/remote/scheduling_remote_suggestions_provider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f9a74cc71ea94bd76cfd844208d4c5935da29ea2..053c9c51261335f12d1ee8355b4b1d2fad62a489 100644
--- a/components/ntp_snippets/remote/scheduling_remote_suggestions_provider.h
+++ b/components/ntp_snippets/remote/scheduling_remote_suggestions_provider.h
@@ -116,6 +116,8 @@ class SchedulingRemoteSuggestionsProvider final
base::TimeDelta interval_soft_on_usage_event;
};
+ enum class TriggerType;
+
// Callback that is notified whenever the status of |provider_| changes.
void OnProviderStatusChanged(
RemoteSuggestionsProvider::ProviderStatus status);
@@ -130,10 +132,16 @@ class SchedulingRemoteSuggestionsProvider final
// schedule.
void StopScheduling();
+ // Trigger a background refetch for the given |trigger| if enabled.
+ void RefetchInTheBackgroundIfEnabled(TriggerType trigger);
+
// Checks whether it is time to perform a soft background fetch, according to
// |schedule|.
bool ShouldRefetchInTheBackgroundNow();
+ // Returns whether background fetching (for the given |trigger|) is disabled.
+ bool BackgroundFetchesDisabled(TriggerType trigger) const;
+
// Callback after Fetch is completed.
void FetchFinished(const FetchDoneCallback& callback,
Status fetch_status,
@@ -152,11 +160,16 @@ class SchedulingRemoteSuggestionsProvider final
// Load and store |schedule_|.
void LoadLastFetchingSchedule();
void StoreFetchingSchedule();
- bool BackgroundFetchesDisabled() const;
// Applies the persistent schedule given by |schedule_|.
void ApplyPersistentFetchingSchedule();
+ // Gets enabled trigger types from the variation parameter.
+ std::set<TriggerType> GetEnabledTriggerTypes();
+
+ // Gets trigger types enabled by default.
+ std::set<TriggerType> GetDefaultEnabledTriggerTypes();
+
// Interface for doing all the actual work (apart from scheduling).
std::unique_ptr<RemoteSuggestionsProvider> provider_;
@@ -172,6 +185,7 @@ class SchedulingRemoteSuggestionsProvider final
PrefService* pref_service_;
std::unique_ptr<base::Clock> clock_;
+ std::set<SchedulingRemoteSuggestionsProvider::TriggerType> enabled_triggers_;
DISALLOW_COPY_AND_ASSIGN(SchedulingRemoteSuggestionsProvider);
};
« no previous file with comments | « no previous file | components/ntp_snippets/remote/scheduling_remote_suggestions_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698