Index: components/ntp_snippets/offline_pages/offline_page_suggestions_provider.cc |
diff --git a/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.cc b/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.cc |
index 79675d4062de68b7ae7b3e11eb01370ebea09b5c..3ea6e2336e2924373da2b40dbb840ad800197399 100644 |
--- a/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.cc |
+++ b/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.cc |
@@ -5,6 +5,7 @@ |
#include "components/ntp_snippets/offline_pages/offline_page_suggestions_provider.h" |
#include <algorithm> |
+#include <utility> |
#include "base/bind.h" |
#include "base/guid.h" |
@@ -361,25 +362,15 @@ std::string OfflinePageSuggestionsProvider::GetDismissedPref( |
std::set<std::string> OfflinePageSuggestionsProvider::ReadDismissedIDsFromPrefs( |
Category category) const { |
- std::set<std::string> dismissed_ids; |
- const base::ListValue* list = |
- pref_service_->GetList(GetDismissedPref(category)); |
- for (const std::unique_ptr<base::Value>& value : *list) { |
- std::string dismissed_id; |
- bool success = value->GetAsString(&dismissed_id); |
- DCHECK(success) << "Failed to parse dismissed offline page ID from prefs"; |
- dismissed_ids.insert(dismissed_id); |
- } |
- return dismissed_ids; |
+ return prefs::ReadDismissedIDsFromPrefs(GetDismissedPref(category), |
+ pref_service_); |
Marc Treib
2016/08/29 09:18:50
Hm, might as well get rid of the members now and j
skym
2016/09/15 23:18:17
I can do this if you still really want me to, and
|
} |
void OfflinePageSuggestionsProvider::StoreDismissedIDsToPrefs( |
Category category, |
const std::set<std::string>& dismissed_ids) { |
- base::ListValue list; |
- for (const std::string& dismissed_id : dismissed_ids) |
- list.AppendString(dismissed_id); |
- pref_service_->Set(GetDismissedPref(category), list); |
+ prefs::StoreDismissedIDsToPrefs(GetDismissedPref(category), dismissed_ids, |
+ pref_service_); |
} |
} // namespace ntp_snippets |