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

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: Fire OnSuggestionInvalidated even if previously dismissed 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
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..bcce11d3f73e2d0059f841ce7186ed903e28dbb7 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,21 @@ 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;
+ // If the suggestion for the offline page with the given |offline_id| is
+ // already dismissed, its dismissed flag is removed (as the offline page
+ // doesn't exist anymore), otherwise the |OnSuggestionInvalidated| event is
Marc Treib 2016/08/16 11:45:17 "otherwise", really? Shouldn't it be fired in any
Philipp Keck 2016/08/16 12:04:01 Done.
+ // fired.
+ 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 +116,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_;

Powered by Google App Engine
This is Rietveld 408576698