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

Unified Diff: components/ntp_snippets/pref_util.cc

Issue 2823073003: Make Use of Value::GetList API
Patch Set: Further Usages Created 3 years, 8 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/pref_util.cc
diff --git a/components/ntp_snippets/pref_util.cc b/components/ntp_snippets/pref_util.cc
index 3973cda1b1d53a01b50ae949675412d1c1eb5154..05cf55191d9687cfb467cd45f8922ee327fd820f 100644
--- a/components/ntp_snippets/pref_util.cc
+++ b/components/ntp_snippets/pref_util.cc
@@ -15,8 +15,8 @@ namespace prefs {
std::set<std::string> ReadDismissedIDsFromPrefs(const PrefService& pref_service,
const std::string& pref_name) {
std::set<std::string> dismissed_ids;
- const base::ListValue* list = pref_service.GetList(pref_name);
- for (const base::Value& value : *list) {
+ const base::Value* list = pref_service.GetList(pref_name);
+ for (const base::Value& value : list->GetList()) {
std::string dismissed_id;
bool success = value.GetAsString(&dismissed_id);
DCHECK(success) << "Failed to parse dismissed id from prefs param "
@@ -29,9 +29,9 @@ std::set<std::string> ReadDismissedIDsFromPrefs(const PrefService& pref_service,
void StoreDismissedIDsToPrefs(PrefService* pref_service,
const std::string& pref_name,
const std::set<std::string>& dismissed_ids) {
- base::ListValue list;
+ base::Value list(base::Value::Type::LIST);
for (const std::string& dismissed_id : dismissed_ids) {
- list.AppendString(dismissed_id);
+ list.GetList().emplace_back(dismissed_id);
}
pref_service->Set(pref_name, list);
}
« no previous file with comments | « chrome/browser/ui/webui/settings/protocol_handlers_handler.cc ('k') | components/sync/driver/about_sync_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698