Index: components/bookmarks/browser/bookmark_expanded_state_tracker.cc |
diff --git a/components/bookmarks/browser/bookmark_expanded_state_tracker.cc b/components/bookmarks/browser/bookmark_expanded_state_tracker.cc |
index dd3070b039c2c2d99d836812e3b0f03d02bb3b97..d0c6b4571de242fa770bce6ae19417aff10c8b49 100644 |
--- a/components/bookmarks/browser/bookmark_expanded_state_tracker.cc |
+++ b/components/bookmarks/browser/bookmark_expanded_state_tracker.cc |
@@ -6,6 +6,9 @@ |
#include <stdint.h> |
+#include <utility> |
+#include <vector> |
+ |
#include "base/strings/string_number_conversions.h" |
#include "base/values.h" |
#include "components/bookmarks/browser/bookmark_model.h" |
@@ -104,13 +107,14 @@ void BookmarkExpandedStateTracker::UpdatePrefs(const Nodes& nodes) { |
if (!pref_service_) |
return; |
- base::ListValue values; |
- for (Nodes::const_iterator i = nodes.begin(); i != nodes.end(); ++i) { |
- values.Set(values.GetSize(), |
- new base::Value(base::Int64ToString((*i)->id()))); |
+ std::vector<base::Value> values; |
+ values.reserve(nodes.size()); |
+ for (const auto* node : nodes) { |
+ values.emplace_back(base::Int64ToString(node->id())); |
} |
- pref_service_->Set(prefs::kBookmarkEditorExpandedNodes, values); |
+ pref_service_->Set(prefs::kBookmarkEditorExpandedNodes, |
+ base::Value(std::move(values))); |
} |
} // namespace bookmarks |