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 | 10 |
11 #include "components/bookmarks/browser/bookmark_model_observer.h" | 11 #include "components/bookmarks/browser/bookmark_model_observer.h" |
12 #include "components/keyed_service/core/keyed_service.h" | 12 #include "components/keyed_service/core/keyed_service.h" |
13 #include "components/ntp_snippets/category.h" | 13 #include "components/ntp_snippets/category.h" |
14 #include "components/ntp_snippets/category_status.h" | 14 #include "components/ntp_snippets/category_status.h" |
15 #include "components/ntp_snippets/content_suggestions_provider.h" | 15 #include "components/ntp_snippets/content_suggestions_provider.h" |
16 | 16 |
17 class PrefRegistrySimple; | |
18 class PrefService; | |
19 | |
17 namespace gfx { | 20 namespace gfx { |
18 class Image; | 21 class Image; |
19 } | 22 } |
20 | 23 |
21 namespace ntp_snippets { | 24 namespace ntp_snippets { |
22 | 25 |
23 // Provides content suggestions from the bookmarks model. | 26 // Provides content suggestions from the bookmarks model. |
24 class BookmarkSuggestionsProvider : public ContentSuggestionsProvider, | 27 class BookmarkSuggestionsProvider : public ContentSuggestionsProvider, |
25 public bookmarks::BookmarkModelObserver { | 28 public bookmarks::BookmarkModelObserver { |
26 public: | 29 public: |
27 BookmarkSuggestionsProvider(ContentSuggestionsProvider::Observer* observer, | 30 BookmarkSuggestionsProvider(ContentSuggestionsProvider::Observer* observer, |
28 CategoryFactory* category_factory, | 31 CategoryFactory* category_factory, |
29 bookmarks::BookmarkModel* bookmark_model); | 32 bookmarks::BookmarkModel* bookmark_model, |
33 PrefService* pref_service); | |
30 ~BookmarkSuggestionsProvider() override; | 34 ~BookmarkSuggestionsProvider() override; |
31 | 35 |
36 static void RegisterProfilePrefs(PrefRegistrySimple* registry); | |
37 | |
32 private: | 38 private: |
33 // ContentSuggestionsProvider implementation. | 39 // ContentSuggestionsProvider implementation. |
34 std::vector<Category> GetProvidedCategories() override; | 40 std::vector<Category> GetProvidedCategories() override; |
35 CategoryStatus GetCategoryStatus(Category category) override; | 41 CategoryStatus GetCategoryStatus(Category category) override; |
36 CategoryInfo GetCategoryInfo(Category category) override; | 42 CategoryInfo GetCategoryInfo(Category category) override; |
37 void DismissSuggestion(const std::string& suggestion_id) override; | 43 void DismissSuggestion(const std::string& suggestion_id) override; |
38 void FetchSuggestionImage(const std::string& suggestion_id, | 44 void FetchSuggestionImage(const std::string& suggestion_id, |
39 const ImageFetchedCallback& callback) override; | 45 const ImageFetchedCallback& callback) override; |
40 void ClearCachedSuggestionsForDebugging(Category category) override; | 46 void ClearCachedSuggestionsForDebugging(Category category) override; |
41 std::vector<ContentSuggestion> GetDismissedSuggestionsForDebugging( | 47 std::vector<ContentSuggestion> GetDismissedSuggestionsForDebugging( |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 void NotifyStatusChanged(CategoryStatus new_status); | 98 void NotifyStatusChanged(CategoryStatus new_status); |
93 | 99 |
94 CategoryStatus category_status_; | 100 CategoryStatus category_status_; |
95 const Category provided_category_; | 101 const Category provided_category_; |
96 bookmarks::BookmarkModel* bookmark_model_; | 102 bookmarks::BookmarkModel* bookmark_model_; |
97 bool fetch_requested_; | 103 bool fetch_requested_; |
98 | 104 |
99 base::Time node_to_change_last_visit_date_; | 105 base::Time node_to_change_last_visit_date_; |
100 base::Time end_of_list_last_visit_date_; | 106 base::Time end_of_list_last_visit_date_; |
101 | 107 |
108 // TODO(jkrcal): Remove this and the pref when it's not needed anymore. | |
Marc Treib
2016/08/19 11:41:12
s/when it's not needed anymore/after M55/
Be as sp
Philipp Keck
2016/08/19 12:49:52
Done.
| |
109 // For six weeks after first installing M54, this is true and the | |
110 // fallback implemented in BookmarkLastVisitUtils is activated. | |
111 bool creation_date_fallback_; | |
112 | |
102 DISALLOW_COPY_AND_ASSIGN(BookmarkSuggestionsProvider); | 113 DISALLOW_COPY_AND_ASSIGN(BookmarkSuggestionsProvider); |
103 }; | 114 }; |
104 | 115 |
105 } // namespace ntp_snippets | 116 } // namespace ntp_snippets |
106 | 117 |
107 #endif // COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_SUGGESTIONS_PROVIDER_H_ | 118 #endif // COMPONENTS_NTP_SNIPPETS_BOOKMARKS_BOOKMARK_SUGGESTIONS_PROVIDER_H_ |
OLD | NEW |