Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: components/ntp_snippets/offline_pages/recent_tab_suggestions_provider.h

Issue 2560783002: [NTP::PhysicalWeb] Implement suggestion dismissal. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 // Removes duplicates for the same URL leaving only the most recently created 90 // Removes duplicates for the same URL leaving only the most recently created
91 // items, returns at most |GetMaxSuggestionsCount()| ContentSuggestions 91 // items, returns at most |GetMaxSuggestionsCount()| ContentSuggestions
92 // corresponding to the remaining items, sorted by creation time (newer 92 // corresponding to the remaining items, sorted by creation time (newer
93 // first). 93 // first).
94 std::vector<ContentSuggestion> GetMostRecentlyCreatedWithoutDuplicates( 94 std::vector<ContentSuggestion> GetMostRecentlyCreatedWithoutDuplicates(
95 std::vector<const offline_pages::OfflinePageItem*> offline_page_items) 95 std::vector<const offline_pages::OfflinePageItem*> offline_page_items)
96 const; 96 const;
97 97
98 // Fires the |OnSuggestionInvalidated| event for the suggestion corresponding 98 // Fires the |OnSuggestionInvalidated| event for the suggestion corresponding
99 // to the given |offline_id| and clears it from the dismissed IDs list, if 99 // to the given |offline_id| and deletes it from the dismissed IDs list, if
100 // necessary. 100 // necessary.
101 void InvalidateSuggestion(int64_t offline_id); 101 void InvalidateSuggestion(int64_t offline_id);
102 102
103 // Reads dismissed IDs from Prefs. 103 // Reads dismissed IDs from Prefs.
104 std::set<std::string> ReadDismissedIDsFromPrefs() const; 104 std::set<std::string> ReadDismissedIDsFromPrefs() const;
105 105
106 // Writes |dismissed_ids| into Prefs. 106 // Writes |dismissed_ids| into Prefs.
107 void StoreDismissedIDsToPrefs(const std::set<std::string>& dismissed_ids); 107 void StoreDismissedIDsToPrefs(const std::set<std::string>& dismissed_ids);
108 108
109 CategoryStatus category_status_; 109 CategoryStatus category_status_;
110 const Category provided_category_; 110 const Category provided_category_;
111 offline_pages::OfflinePageModel* offline_page_model_; 111 offline_pages::OfflinePageModel* offline_page_model_;
112 112
113 PrefService* pref_service_; 113 PrefService* pref_service_;
114 114
115 base::WeakPtrFactory<RecentTabSuggestionsProvider> weak_ptr_factory_; 115 base::WeakPtrFactory<RecentTabSuggestionsProvider> weak_ptr_factory_;
116 116
117 DISALLOW_COPY_AND_ASSIGN(RecentTabSuggestionsProvider); 117 DISALLOW_COPY_AND_ASSIGN(RecentTabSuggestionsProvider);
118 }; 118 };
119 119
120 } // namespace ntp_snippets 120 } // namespace ntp_snippets
121 121
122 #endif // COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_RECENT_TAB_SUGGESTIONS_PROVIDER _H_ 122 #endif // COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_RECENT_TAB_SUGGESTIONS_PROVIDER _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698