| Index: components/ntp_snippets/content_suggestions_service.h
|
| diff --git a/components/ntp_snippets/content_suggestions_service.h b/components/ntp_snippets/content_suggestions_service.h
|
| index ccd3c6a009ed128dfb73f8e8122f46c03042f8cb..c4fca54a7c4b4c22bbf4bc4b9cd33b98fde18344 100644
|
| --- a/components/ntp_snippets/content_suggestions_service.h
|
| +++ b/components/ntp_snippets/content_suggestions_service.h
|
| @@ -13,7 +13,10 @@
|
| #include "base/callback_forward.h"
|
| #include "base/observer_list.h"
|
| #include "base/optional.h"
|
| +#include "base/scoped_observer.h"
|
| #include "base/time/time.h"
|
| +#include "components/history/core/browser/history_service.h"
|
| +#include "components/history/core/browser/history_service_observer.h"
|
| #include "components/keyed_service/core/keyed_service.h"
|
| #include "components/ntp_snippets/category_factory.h"
|
| #include "components/ntp_snippets/category_status.h"
|
| @@ -30,7 +33,8 @@ class NTPSnippetsService;
|
| // Retrieves suggestions from a number of ContentSuggestionsProviders and serves
|
| // them grouped into categories. There can be at most one provider per category.
|
| class ContentSuggestionsService : public KeyedService,
|
| - public ContentSuggestionsProvider::Observer {
|
| + public ContentSuggestionsProvider::Observer,
|
| + public history::HistoryServiceObserver {
|
| public:
|
| using ImageFetchedCallback =
|
| base::Callback<void(const std::string& suggestion_id, const gfx::Image&)>;
|
| @@ -77,7 +81,8 @@ class ContentSuggestionsService : public KeyedService,
|
| DISABLED,
|
| };
|
|
|
| - ContentSuggestionsService(State state);
|
| + ContentSuggestionsService(State state,
|
| + history::HistoryService* history_service);
|
| ~ContentSuggestionsService() override;
|
|
|
| // Inherited from KeyedService.
|
| @@ -182,6 +187,15 @@ class ContentSuggestionsService : public KeyedService,
|
| Category category,
|
| const std::string& suggestion_id) override;
|
|
|
| + // history::HistoryServiceObserver implementation.
|
| + void OnURLsDeleted(history::HistoryService* history_service,
|
| + bool all_history,
|
| + bool expired,
|
| + const history::URLRows& deleted_rows,
|
| + const std::set<GURL>& favicon_urls) override;
|
| + void HistoryServiceBeingDeleted(
|
| + history::HistoryService* history_service) override;
|
| +
|
| // Registers the given |provider| for the given |category|, unless it is
|
| // already registered. Returns true if the category was newly registered or
|
| // false if it was present before.
|
| @@ -232,6 +246,11 @@ class ContentSuggestionsService : public KeyedService,
|
| // suggestion.
|
| std::map<std::string, Category> id_category_map_;
|
|
|
| + // Observer for the HistoryService. All providers are notified when history is
|
| + // deleted.
|
| + ScopedObserver<history::HistoryService, history::HistoryServiceObserver>
|
| + history_service_observer_;
|
| +
|
| base::ObserverList<Observer> observers_;
|
|
|
| const std::vector<ContentSuggestion> no_suggestions_;
|
|
|