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

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: . 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
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..e736f35e48806bd17b3488a276c783b1dbfabbc6 100644
--- a/chrome/browser/ntp_snippets/download_suggestions_provider.h
+++ b/chrome/browser/ntp_snippets/download_suggestions_provider.h
@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_NTP_SNIPPETS_DOWNLOAD_SUGGESTIONS_PROVIDER_H_
#define CHROME_BROWSER_NTP_SNIPPETS_DOWNLOAD_SUGGESTIONS_PROVIDER_H_
+#include <list>
#include <set>
#include <string>
#include <vector>
@@ -171,11 +172,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::list<std::string> ReadAssetDismissedIDsFromPrefs() const;
Marc Treib 2016/12/09 16:37:26 vector? No need to be super inefficient and use li
vitaliii 2016/12/09 17:30:36 Done.
// Writes |dismissed_ids| into prefs for asset downloads.
void StoreAssetDismissedIDsToPrefs(
- const std::set<std::string>& dismissed_ids);
+ const std::list<std::string>& dismissed_ids);
// Reads dismissed IDs related to offline page downloads from prefs.
std::set<std::string> ReadOfflinePageDismissedIDsFromPrefs() const;
@@ -184,15 +185,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();

Powered by Google App Engine
This is Rietveld 408576698