| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |