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

Unified Diff: components/prefs/overlay_user_pref_store.cc

Issue 2692203007: Add PrefStore::GetValues (Closed)
Patch Set: Add GetValues to FilesystemJsonPrefStore 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
« no previous file with comments | « components/prefs/overlay_user_pref_store.h ('k') | components/prefs/overlay_user_pref_store_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/prefs/overlay_user_pref_store.cc
diff --git a/components/prefs/overlay_user_pref_store.cc b/components/prefs/overlay_user_pref_store.cc
index 2b2208ed8214408290c312125e5309689dfecaff..ddc47c8f351d58320c3dc836c3208271a38b510e 100644
--- a/components/prefs/overlay_user_pref_store.cc
+++ b/components/prefs/overlay_user_pref_store.cc
@@ -47,6 +47,24 @@ bool OverlayUserPrefStore::GetValue(const std::string& key,
return underlay_->GetValue(GetUnderlayKey(key), result);
}
+std::unique_ptr<base::DictionaryValue> OverlayUserPrefStore::GetValues() const {
+ auto values = underlay_->GetValues();
+ auto overlay_values = overlay_.AsDictionaryValue();
+ for (const auto& overlay_mapping : overlay_to_underlay_names_map_) {
+ const std::string& overlay_key = overlay_mapping.first;
+ const std::string& underlay_key = overlay_mapping.second;
+ std::unique_ptr<base::Value> out_value;
+ if (overlay_key != underlay_key) {
+ values->Remove(underlay_key, &out_value);
+ }
+ overlay_values->Remove(overlay_key, &out_value);
+ if (out_value) {
+ values->Set(overlay_key, std::move(out_value));
+ }
+ }
+ return values;
+}
+
bool OverlayUserPrefStore::GetMutableValue(const std::string& key,
base::Value** result) {
if (!ShallBeStoredInOverlay(key))
« no previous file with comments | « components/prefs/overlay_user_pref_store.h ('k') | components/prefs/overlay_user_pref_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698