| 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 5fc9f77a9ebd8ccfe401e24fdeb321d0a2522c32..f233956e8b26c835d0c6ab18d853ef02589d4a88 100644
|
| --- a/components/ntp_snippets/remote/remote_suggestions_provider_impl.h
|
| +++ b/components/ntp_snippets/remote/remote_suggestions_provider_impl.h
|
| @@ -47,6 +47,7 @@ namespace ntp_snippets {
|
|
|
| class CategoryRanker;
|
| class RemoteSuggestionsDatabase;
|
| +class RemoteSuggestionsScheduler;
|
|
|
| // CachedImageFetcher takes care of fetching images from the network and caching
|
| // them in the database.
|
| @@ -137,8 +138,8 @@ class RemoteSuggestionsProviderImpl final : public RemoteSuggestionsProvider {
|
| bool initialized() const { return ready() || state_ == State::DISABLED; }
|
|
|
| // RemoteSuggestionsProvider implementation.
|
| - void SetProviderStatusCallback(
|
| - std::unique_ptr<ProviderStatusCallback> callback) override;
|
| + void SetRemoteSuggestionsScheduler(
|
| + RemoteSuggestionsScheduler* scheduler) override;
|
| void RefetchInTheBackground(
|
| std::unique_ptr<FetchStatusCallback> callback) override;
|
|
|
| @@ -197,11 +198,9 @@ class RemoteSuggestionsProviderImpl final : public RemoteSuggestionsProvider {
|
| friend class RemoteSuggestionsProviderImplTest;
|
|
|
| FRIEND_TEST_ALL_PREFIXES(RemoteSuggestionsProviderImplTest,
|
| - CallsProviderStatusCallbackWhenReady);
|
| + CallsSchedulerOnError);
|
| FRIEND_TEST_ALL_PREFIXES(RemoteSuggestionsProviderImplTest,
|
| - CallsProviderStatusCallbackOnError);
|
| - FRIEND_TEST_ALL_PREFIXES(RemoteSuggestionsProviderImplTest,
|
| - CallsProviderStatusCallbackWhenDisabled);
|
| + CallsSchedulerWhenDisabled);
|
| FRIEND_TEST_ALL_PREFIXES(RemoteSuggestionsProviderImplTest,
|
| ShouldNotCrashWhenCallingEmptyCallback);
|
| FRIEND_TEST_ALL_PREFIXES(RemoteSuggestionsProviderImplTest,
|
| @@ -352,6 +351,9 @@ class RemoteSuggestionsProviderImpl final : public RemoteSuggestionsProvider {
|
| // the file system.
|
| void ClearOrphanedImages();
|
|
|
| + // Clears suggestions because any history item has been removed.
|
| + void ClearAnyHistory();
|
| +
|
| // Clears all stored suggestions and updates the observer.
|
| void NukeAllSuggestions();
|
|
|
| @@ -442,12 +444,12 @@ class RemoteSuggestionsProviderImpl final : public RemoteSuggestionsProvider {
|
| bool fetch_when_ready_interactive_;
|
| std::unique_ptr<FetchStatusCallback> fetch_when_ready_callback_;
|
|
|
| - std::unique_ptr<ProviderStatusCallback> provider_status_callback_;
|
| + RemoteSuggestionsScheduler* remote_suggestions_scheduler_;
|
|
|
| - // Set to true if NukeAllSuggestions is called while the service isn't ready.
|
| + // Set to true if ClearAnyHistory is called while the service isn't ready.
|
| // The nuke will be executed once the service finishes initialization or
|
| // enters the READY state.
|
| - bool nuke_when_initialized_;
|
| + bool clear_any_history_when_initialized_;
|
|
|
| // A clock for getting the time. This allows to inject a clock in tests.
|
| std::unique_ptr<base::Clock> clock_;
|
|
|