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

Side by Side Diff: base/prefs/overlay_user_pref_store.cc

Issue 81183005: Remove JsonPrefStore pruning of empty values on write. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove else Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/prefs/overlay_user_pref_store.h ('k') | base/prefs/persistent_pref_store.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/prefs/overlay_user_pref_store.h" 5 #include "base/prefs/overlay_user_pref_store.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 9
10 OverlayUserPrefStore::OverlayUserPrefStore( 10 OverlayUserPrefStore::OverlayUserPrefStore(
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 void OverlayUserPrefStore::RemoveValue(const std::string& key) { 86 void OverlayUserPrefStore::RemoveValue(const std::string& key) {
87 if (!ShallBeStoredInOverlay(key)) { 87 if (!ShallBeStoredInOverlay(key)) {
88 underlay_->RemoveValue(GetUnderlayKey(key)); 88 underlay_->RemoveValue(GetUnderlayKey(key));
89 return; 89 return;
90 } 90 }
91 91
92 if (overlay_.RemoveValue(key)) 92 if (overlay_.RemoveValue(key))
93 ReportValueChanged(key); 93 ReportValueChanged(key);
94 } 94 }
95 95
96 void OverlayUserPrefStore::MarkNeedsEmptyValue(const std::string& key) {
97 if (!ShallBeStoredInOverlay(key))
98 underlay_->MarkNeedsEmptyValue(key);
99 }
100
101 bool OverlayUserPrefStore::ReadOnly() const { 96 bool OverlayUserPrefStore::ReadOnly() const {
102 return false; 97 return false;
103 } 98 }
104 99
105 PersistentPrefStore::PrefReadError OverlayUserPrefStore::GetReadError() const { 100 PersistentPrefStore::PrefReadError OverlayUserPrefStore::GetReadError() const {
106 return PersistentPrefStore::PREF_READ_ERROR_NONE; 101 return PersistentPrefStore::PREF_READ_ERROR_NONE;
107 } 102 }
108 103
109 PersistentPrefStore::PrefReadError OverlayUserPrefStore::ReadPrefs() { 104 PersistentPrefStore::PrefReadError OverlayUserPrefStore::ReadPrefs() {
110 // We do not read intentionally. 105 // We do not read intentionally.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 NamesMap::const_iterator i = 168 NamesMap::const_iterator i =
174 overlay_to_underlay_names_map_.find(overlay_key); 169 overlay_to_underlay_names_map_.find(overlay_key);
175 return i != overlay_to_underlay_names_map_.end() ? i->second : overlay_key; 170 return i != overlay_to_underlay_names_map_.end() ? i->second : overlay_key;
176 } 171 }
177 172
178 bool OverlayUserPrefStore::ShallBeStoredInOverlay( 173 bool OverlayUserPrefStore::ShallBeStoredInOverlay(
179 const std::string& key) const { 174 const std::string& key) const {
180 return overlay_to_underlay_names_map_.find(key) != 175 return overlay_to_underlay_names_map_.find(key) !=
181 overlay_to_underlay_names_map_.end(); 176 overlay_to_underlay_names_map_.end();
182 } 177 }
OLDNEW
« no previous file with comments | « base/prefs/overlay_user_pref_store.h ('k') | base/prefs/persistent_pref_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698