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

Unified Diff: components/ntp_snippets/offline_pages/offline_page_suggestions_provider.h

Issue 2251743002: Refactor OfflinePageSuggestionsProvider dismissed ID handling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@offlinedelete
Patch Set: Rebase Created 4 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/ntp_snippets/offline_pages/offline_page_suggestions_provider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_snippets/offline_pages/offline_page_suggestions_provider.h
diff --git a/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.h b/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.h
index 862ea5df5bf032c8acad706891b47ddd29395e71..35b6161385dcc72c1aef887cb2d605d98c772c21 100644
--- a/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.h
+++ b/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.h
@@ -89,12 +89,20 @@ class OfflinePageSuggestionsProvider
std::vector<const offline_pages::OfflinePageItem*> offline_page_items)
const;
- // Reads dismissed IDs from the pref with name |pref_name|.
- std::set<std::string> ReadDismissedIDsFromPrefs(
- const std::string& pref_name) const;
+ // Fires the |OnSuggestionInvalidated| event for the suggestion corresponding
+ // to the given |offline_id| and clears it from the dismissed IDs list, if
+ // necessary.
+ void InvalidateSuggestion(Category category, int64_t offline_id);
- // Writes |dismissed_ids| to the pref with name |pref_name|.
- void StoreDismissedIDsToPrefs(const std::string& pref_name,
+ // Gets the preference name for storing the list of dismissed suggestion IDs
+ // for the given |category|.
+ std::string GetDismissedPref(Category category) const;
+
+ // Reads dismissed IDs for the given |category|.
+ std::set<std::string> ReadDismissedIDsFromPrefs(Category category) const;
+
+ // Writes |dismissed_ids| for the given |category|.
+ void StoreDismissedIDsToPrefs(Category category,
const std::set<std::string>& dismissed_ids);
CategoryStatus recent_tabs_status_;
@@ -107,9 +115,6 @@ class OfflinePageSuggestionsProvider
PrefService* pref_service_;
- std::set<std::string> dismissed_recent_tab_ids_;
- std::set<std::string> dismissed_download_ids_;
-
// Whether the Download Manager UI is enabled, in which case the More button
// for the Downloads section can redirect there.
const bool download_manager_ui_enabled_;
« no previous file with comments | « no previous file | components/ntp_snippets/offline_pages/offline_page_suggestions_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698