Index: components/ntp_snippets/reading_list/reading_list_suggestions_provider.h |
diff --git a/components/ntp_snippets/reading_list/reading_list_suggestions_provider.h b/components/ntp_snippets/reading_list/reading_list_suggestions_provider.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..107d0b9ecf1140a11f3956d03063dec7eb0311b0 |
--- /dev/null |
+++ b/components/ntp_snippets/reading_list/reading_list_suggestions_provider.h |
@@ -0,0 +1,66 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef COMPONENTS_NTP_SNIPPETS_READING_LIST_READING_LIST_SUGGESTIONS_PROVIDER_H_ |
+#define COMPONENTS_NTP_SNIPPETS_READING_LIST_READING_LIST_SUGGESTIONS_PROVIDER_H_ |
+ |
+#include <set> |
+#include <string> |
+ |
+#include "components/ntp_snippets/callbacks.h" |
+#include "components/ntp_snippets/category.h" |
+#include "components/ntp_snippets/category_info.h" |
+#include "components/ntp_snippets/category_status.h" |
+#include "components/ntp_snippets/content_suggestion.h" |
+#include "components/ntp_snippets/content_suggestions_provider.h" |
+#include "components/reading_list/core/reading_list_model_observer.h" |
+ |
+class ReadingListModel; |
+ |
+namespace ntp_snippets { |
+ |
+// Provides content suggestions from the Reading List. |
+class ReadingListSuggestionsProvider : public ContentSuggestionsProvider, |
+ public ReadingListModelObserver { |
+ public: |
+ ReadingListSuggestionsProvider(ContentSuggestionsProvider::Observer* observer, |
+ ReadingListModel* reading_list_model); |
+ ~ReadingListSuggestionsProvider() override; |
+ |
+ // ContentSuggestionsProvider implementation. |
+ CategoryStatus GetCategoryStatus(Category category) override; |
+ CategoryInfo GetCategoryInfo(Category category) override; |
+ void DismissSuggestion(const ContentSuggestion::ID& suggestion_id) override; |
+ void FetchSuggestionImage(const ContentSuggestion::ID& suggestion_id, |
+ const ImageFetchedCallback& callback) override; |
+ void Fetch(const Category& category, |
+ const std::set<std::string>& known_suggestion_ids, |
+ const FetchDoneCallback& callback) override; |
+ void ClearHistory( |
+ base::Time begin, |
+ base::Time end, |
+ const base::Callback<bool(const GURL& url)>& filter) override; |
+ void ClearCachedSuggestions(Category category) override; |
+ void GetDismissedSuggestionsForDebugging( |
+ Category category, |
+ const DismissedSuggestionsCallback& callback) override; |
+ void ClearDismissedSuggestionsForDebugging(Category category) override; |
+ |
+ // ReadingListModelObserver implementation. |
+ void ReadingListModelLoaded(const ReadingListModel* model) override; |
+ |
+ private: |
+ void FetchReadingListInternal(); |
+ |
+ CategoryStatus category_status_; |
+ const Category provided_category_; |
+ |
+ ReadingListModel* reading_list_model_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ReadingListSuggestionsProvider); |
+}; |
+ |
+} // namespace ntp_snippets |
+ |
+#endif // COMPONENTS_NTP_SNIPPETS_READING_LIST_READING_LIST_SUGGESTIONS_PROVIDER_H_ |