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

Unified Diff: chrome/browser/ntp_snippets/download_suggestions_provider.h

Issue 2562073002: [NTP::Downloads] Limit number of dismissed IDs instead of pruning. (Closed)
Patch Set: rebase & treib@ comments. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ntp_snippets/download_suggestions_provider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ntp_snippets/download_suggestions_provider.h
diff --git a/chrome/browser/ntp_snippets/download_suggestions_provider.h b/chrome/browser/ntp_snippets/download_suggestions_provider.h
index 9b7cdb26d24ef6765f433456c4a2b59cdb27f488..a98dc97d1f04a6ee8448245cb6c6693d924bc453 100644
--- a/chrome/browser/ntp_snippets/download_suggestions_provider.h
+++ b/chrome/browser/ntp_snippets/download_suggestions_provider.h
@@ -75,6 +75,8 @@ class DownloadSuggestionsProvider
static void RegisterProfilePrefs(PrefRegistrySimple* registry);
+ static int GetMaxDismissedCountForTesting();
+
private:
friend class DownloadSuggestionsProviderTest;
@@ -171,11 +173,11 @@ class DownloadSuggestionsProvider
void InvalidateSuggestion(const std::string& id_within_category);
// Reads dismissed IDs related to asset downloads from prefs.
- std::set<std::string> ReadAssetDismissedIDsFromPrefs() const;
+ std::vector<std::string> ReadAssetDismissedIDsFromPrefs() const;
// Writes |dismissed_ids| into prefs for asset downloads.
void StoreAssetDismissedIDsToPrefs(
- const std::set<std::string>& dismissed_ids);
+ const std::vector<std::string>& dismissed_ids);
// Reads dismissed IDs related to offline page downloads from prefs.
std::set<std::string> ReadOfflinePageDismissedIDsFromPrefs() const;
@@ -184,15 +186,15 @@ class DownloadSuggestionsProvider
void StoreOfflinePageDismissedIDsToPrefs(
const std::set<std::string>& dismissed_ids);
- // Reads from prefs dismissed IDs related to either offline page or asset
- // downloads (given by |for_offline_page_downloads|).
- std::set<std::string> ReadDismissedIDsFromPrefs(
- bool for_offline_page_downloads) const;
+ // Adds a suggestion ID to the dismissed list in prefs, if it is not there.
+ // Works for both Offline Page and Asset downloads.
+ void AddToDismissedStorageIfNeeded(
+ const ntp_snippets::ContentSuggestion::ID& suggestion_id);
- // Writes |dismissed_ids| into prefs for either offline page or asset
- // downloads (given by |for_offline_page_downloads|).
- void StoreDismissedIDsToPrefs(bool for_offline_page_downloads,
- const std::set<std::string>& dismissed_ids);
+ // Removes a suggestion ID from the dismissed list in prefs, if it is there.
+ // Works for both Offline Page and Asset downloads.
+ void RemoveFromDismissedStorageIfNeeded(
+ const ntp_snippets::ContentSuggestion::ID& suggestion_id);
void UnregisterDownloadItemObservers();
« no previous file with comments | « no previous file | chrome/browser/ntp_snippets/download_suggestions_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698