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

Unified Diff: components/user_prefs/tracked/segregated_pref_store.cc

Issue 2692203007: Add PrefStore::GetValues (Closed)
Patch Set: Created 3 years, 10 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/user_prefs/tracked/segregated_pref_store.cc
diff --git a/components/user_prefs/tracked/segregated_pref_store.cc b/components/user_prefs/tracked/segregated_pref_store.cc
index edb1f2059920bb22706c69c36d2aea5f38fbe3e0..374b5c796798369deabc0969cf9f2ca51cdab06c 100644
--- a/components/user_prefs/tracked/segregated_pref_store.cc
+++ b/components/user_prefs/tracked/segregated_pref_store.cc
@@ -83,6 +83,21 @@ bool SegregatedPrefStore::GetValue(const std::string& key,
return StoreForKey(key)->GetValue(key, result);
}
+std::unique_ptr<base::DictionaryValue> SegregatedPrefStore::GetValues() const {
+ auto selected_values = selected_pref_store_->GetValues();
Sam McNally 2017/02/16 02:21:11 These should use the selected store for keys (with
tibell 2017/02/20 00:04:57 Done.
+ auto default_values = default_pref_store_->GetValues();
+ auto default_iter = base::DictionaryValue::Iterator(*default_values);
+ while (!default_iter.IsAtEnd()) {
+ const std::string key = default_iter.key();
+ if (!selected_values->HasKey(key)) {
+ selected_values->SetWithoutPathExpansion(
+ key, default_iter.value().CreateDeepCopy());
+ }
+ default_iter.Advance();
+ }
+ return selected_values;
+}
+
void SegregatedPrefStore::SetValue(const std::string& key,
std::unique_ptr<base::Value> value,
uint32_t flags) {
« components/prefs/pref_store.h ('K') | « components/user_prefs/tracked/segregated_pref_store.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698