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_OFFLINE_PAGES_RECENT_TAB_SUGGESTIONS_PROVIDER_H_ | 5 #ifndef COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_RECENT_TAB_SUGGESTIONS_PROVIDER_H_ |
6 #define COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_RECENT_TAB_SUGGESTIONS_PROVIDER_H_ | 6 #define COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_RECENT_TAB_SUGGESTIONS_PROVIDER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 // Removes duplicates for the same URL leaving only the most recently created | 92 // Removes duplicates for the same URL leaving only the most recently created |
93 // items, returns at most |GetMaxSuggestionsCount()| ContentSuggestions | 93 // items, returns at most |GetMaxSuggestionsCount()| ContentSuggestions |
94 // corresponding to the remaining items, sorted by creation time (newer | 94 // corresponding to the remaining items, sorted by creation time (newer |
95 // first). | 95 // first). |
96 std::vector<ContentSuggestion> GetMostRecentlyCreatedWithoutDuplicates( | 96 std::vector<ContentSuggestion> GetMostRecentlyCreatedWithoutDuplicates( |
97 std::vector<const offline_pages::OfflinePageItem*> offline_page_items) | 97 std::vector<const offline_pages::OfflinePageItem*> offline_page_items) |
98 const; | 98 const; |
99 | 99 |
100 // Fires the |OnSuggestionInvalidated| event for the suggestion corresponding | 100 // Fires the |OnSuggestionInvalidated| event for the suggestion corresponding |
101 // to the given |offline_id| and clears it from the dismissed IDs list, if | 101 // to the given |offline_id| and deletes it from the dismissed IDs list, if |
102 // necessary. | 102 // necessary. |
103 void InvalidateSuggestion(int64_t offline_id); | 103 void InvalidateSuggestion(int64_t offline_id); |
104 | 104 |
105 // Reads dismissed IDs from Prefs. | 105 // Reads dismissed IDs from Prefs. |
106 std::set<std::string> ReadDismissedIDsFromPrefs() const; | 106 std::set<std::string> ReadDismissedIDsFromPrefs() const; |
107 | 107 |
108 // Writes |dismissed_ids| into Prefs. | 108 // Writes |dismissed_ids| into Prefs. |
109 void StoreDismissedIDsToPrefs(const std::set<std::string>& dismissed_ids); | 109 void StoreDismissedIDsToPrefs(const std::set<std::string>& dismissed_ids); |
110 | 110 |
111 CategoryStatus category_status_; | 111 CategoryStatus category_status_; |
112 const Category provided_category_; | 112 const Category provided_category_; |
113 offline_pages::OfflinePageModel* offline_page_model_; | 113 offline_pages::OfflinePageModel* offline_page_model_; |
114 | 114 |
115 PrefService* pref_service_; | 115 PrefService* pref_service_; |
116 | 116 |
117 base::WeakPtrFactory<RecentTabSuggestionsProvider> weak_ptr_factory_; | 117 base::WeakPtrFactory<RecentTabSuggestionsProvider> weak_ptr_factory_; |
118 | 118 |
119 DISALLOW_COPY_AND_ASSIGN(RecentTabSuggestionsProvider); | 119 DISALLOW_COPY_AND_ASSIGN(RecentTabSuggestionsProvider); |
120 }; | 120 }; |
121 | 121 |
122 } // namespace ntp_snippets | 122 } // namespace ntp_snippets |
123 | 123 |
124 #endif // COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_RECENT_TAB_SUGGESTIONS_PROVIDER
_H_ | 124 #endif // COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_RECENT_TAB_SUGGESTIONS_PROVIDER
_H_ |
OLD | NEW |