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

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

Issue 2774663002: [Remote suggestions] Refactor the scheduler (Closed)
Patch Set: Marc's nits #2 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_provider_impl.h
diff --git a/components/ntp_snippets/remote/remote_suggestions_provider_impl.h b/components/ntp_snippets/remote/remote_suggestions_provider_impl.h
index 5fca11d2103be28dcaa92a55e2ba43b01bc7fcbf..710231b132701e0d1821baebc71f900460da011c 100644
--- a/components/ntp_snippets/remote/remote_suggestions_provider_impl.h
+++ b/components/ntp_snippets/remote/remote_suggestions_provider_impl.h
@@ -117,6 +117,7 @@ class RemoteSuggestionsProviderImpl final : public RemoteSuggestionsProvider {
PrefService* pref_service,
const std::string& application_language_code,
CategoryRanker* category_ranker,
+ RemoteSuggestionsScheduler* scheduler,
std::unique_ptr<RemoteSuggestionsFetcher> suggestions_fetcher,
std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher,
std::unique_ptr<RemoteSuggestionsDatabase> database,
@@ -135,12 +136,6 @@ class RemoteSuggestionsProviderImpl final : public RemoteSuggestionsProvider {
// false, some calls may trigger DCHECKs.
bool initialized() const { return ready() || state_ == State::DISABLED; }
- // 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.
- void SetRemoteSuggestionsScheduler(RemoteSuggestionsScheduler* scheduler);
-
// RemoteSuggestionsProvider implementation.
void RefetchInTheBackground(
std::unique_ptr<FetchStatusCallback> callback) override;
@@ -430,6 +425,9 @@ class RemoteSuggestionsProviderImpl final : public RemoteSuggestionsProvider {
// Ranker that orders the categories. Not owned.
CategoryRanker* category_ranker_;
+ // Scheduler to inform about scheduling-related events. Not owned.
+ RemoteSuggestionsScheduler* remote_suggestions_scheduler_;
+
// The suggestions fetcher.
std::unique_ptr<RemoteSuggestionsFetcher> suggestions_fetcher_;
@@ -452,8 +450,6 @@ class RemoteSuggestionsProviderImpl final : public RemoteSuggestionsProvider {
bool fetch_when_ready_interactive_;
std::unique_ptr<FetchStatusCallback> fetch_when_ready_callback_;
- RemoteSuggestionsScheduler* remote_suggestions_scheduler_;
-
// Set to true if ClearHistoryDependentState is called while the service isn't
// ready. The nuke will be executed once the service finishes initialization
// or enters the READY state.

Powered by Google App Engine
This is Rietveld 408576698