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

Unified Diff: components/prefs/overlay_user_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/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..7add270311eb10a19de2467755dcf63640074435 100644
--- a/components/prefs/overlay_user_pref_store.cc
+++ b/components/prefs/overlay_user_pref_store.cc
@@ -47,6 +47,21 @@ bool OverlayUserPrefStore::GetValue(const std::string& key,
return underlay_->GetValue(GetUnderlayKey(key), result);
}
+std::unique_ptr<base::DictionaryValue> OverlayUserPrefStore::GetValues() const {
+ auto overlay_values = overlay_.AsDictionaryValue();
+ auto underlay_values = underlay_->GetValues();
+ auto underlay_iter = base::DictionaryValue::Iterator(*underlay_values);
+ while (!underlay_iter.IsAtEnd()) {
+ const std::string overlay_key = GetOverlayKey(underlay_iter.key());
Sam McNally 2017/02/16 02:21:11 const std::string&
tibell 2017/02/20 00:04:57 Done.
+ if (!overlay_values->HasKey(overlay_key)) {
+ overlay_values->SetWithoutPathExpansion(
+ overlay_key, underlay_iter.value().CreateDeepCopy());
+ }
+ underlay_iter.Advance();
+ }
+ return overlay_values;
+}
+
bool OverlayUserPrefStore::GetMutableValue(const std::string& key,
base::Value** result) {
if (!ShallBeStoredInOverlay(key))

Powered by Google App Engine
This is Rietveld 408576698