| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_SUGGESTIONS_PROVIDER_H_ | 5 #ifndef COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_SUGGESTIONS_PROVIDER_H_ |
| 6 #define COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_SUGGESTIONS_PROVIDER_H_ | 6 #define COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_SUGGESTIONS_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "components/bookmarks/browser/bookmark_model_observer.h" | 12 #include "components/bookmarks/browser/bookmark_model_observer.h" |
| 13 #include "components/keyed_service/core/keyed_service.h" | 13 #include "components/keyed_service/core/keyed_service.h" |
| 14 #include "components/ntp_snippets/category.h" | 14 #include "components/ntp_snippets/category.h" |
| 15 #include "components/ntp_snippets/category_status.h" | 15 #include "components/ntp_snippets/category_status.h" |
| 16 #include "components/ntp_snippets/content_suggestions_provider.h" | 16 #include "components/ntp_snippets/content_suggestions_provider.h" |
| 17 | 17 |
| 18 class PrefRegistrySimple; | |
| 19 class PrefService; | |
| 20 | |
| 21 namespace ntp_snippets { | 18 namespace ntp_snippets { |
| 22 | 19 |
| 23 // Provides content suggestions from the bookmarks model. | 20 // Provides content suggestions from the bookmarks model. |
| 24 class BookmarkSuggestionsProvider : public ContentSuggestionsProvider, | 21 class BookmarkSuggestionsProvider : public ContentSuggestionsProvider, |
| 25 public bookmarks::BookmarkModelObserver { | 22 public bookmarks::BookmarkModelObserver { |
| 26 public: | 23 public: |
| 27 BookmarkSuggestionsProvider(ContentSuggestionsProvider::Observer* observer, | 24 BookmarkSuggestionsProvider(ContentSuggestionsProvider::Observer* observer, |
| 28 bookmarks::BookmarkModel* bookmark_model, | 25 bookmarks::BookmarkModel* bookmark_model); |
| 29 PrefService* pref_service); | |
| 30 ~BookmarkSuggestionsProvider() override; | 26 ~BookmarkSuggestionsProvider() override; |
| 31 | 27 |
| 32 static void RegisterProfilePrefs(PrefRegistrySimple* registry); | |
| 33 | |
| 34 private: | 28 private: |
| 35 // ContentSuggestionsProvider implementation. | 29 // ContentSuggestionsProvider implementation. |
| 36 CategoryStatus GetCategoryStatus(Category category) override; | 30 CategoryStatus GetCategoryStatus(Category category) override; |
| 37 CategoryInfo GetCategoryInfo(Category category) override; | 31 CategoryInfo GetCategoryInfo(Category category) override; |
| 38 void DismissSuggestion(const ContentSuggestion::ID& suggestion_id) override; | 32 void DismissSuggestion(const ContentSuggestion::ID& suggestion_id) override; |
| 39 void FetchSuggestionImage(const ContentSuggestion::ID& suggestion_id, | 33 void FetchSuggestionImage(const ContentSuggestion::ID& suggestion_id, |
| 40 const ImageFetchedCallback& callback) override; | 34 const ImageFetchedCallback& callback) override; |
| 41 void Fetch(const Category& category, | 35 void Fetch(const Category& category, |
| 42 const std::set<std::string>& known_suggestion_ids, | 36 const std::set<std::string>& known_suggestion_ids, |
| 43 const FetchDoneCallback& callback) override; | 37 const FetchDoneCallback& callback) override; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // deciding which bookmarks to suggest. Should we also consider visits on | 106 // deciding which bookmarks to suggest. Should we also consider visits on |
| 113 // desktop platforms? | 107 // desktop platforms? |
| 114 bool consider_bookmark_visits_from_desktop_; | 108 bool consider_bookmark_visits_from_desktop_; |
| 115 | 109 |
| 116 DISALLOW_COPY_AND_ASSIGN(BookmarkSuggestionsProvider); | 110 DISALLOW_COPY_AND_ASSIGN(BookmarkSuggestionsProvider); |
| 117 }; | 111 }; |
| 118 | 112 |
| 119 } // namespace ntp_snippets | 113 } // namespace ntp_snippets |
| 120 | 114 |
| 121 #endif // COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_SUGGESTIONS_PROVIDER_H_ | 115 #endif // COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_SUGGESTIONS_PROVIDER_H_ |
| OLD | NEW |