| 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 "chrome/browser/prefs/overlay_user_pref_store.h" | 5 #include "chrome/browser/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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 void OverlayUserPrefStore::RemoveValue(const std::string& key) { | 94 void OverlayUserPrefStore::RemoveValue(const std::string& key) { |
| 95 if (!ShallBeStoredInOverlay(key)) { | 95 if (!ShallBeStoredInOverlay(key)) { |
| 96 underlay_->RemoveValue(GetUnderlayKey(key)); | 96 underlay_->RemoveValue(GetUnderlayKey(key)); |
| 97 return; | 97 return; |
| 98 } | 98 } |
| 99 | 99 |
| 100 if (overlay_.RemoveValue(key)) | 100 if (overlay_.RemoveValue(key)) |
| 101 ReportValueChanged(key); | 101 ReportValueChanged(key); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void OverlayUserPrefStore::MarkNeedsEmptyValue(const std::string& key) { |
| 105 if (!ShallBeStoredInOverlay(key)) |
| 106 underlay_->MarkNeedsEmptyValue(key); |
| 107 } |
| 108 |
| 104 bool OverlayUserPrefStore::ReadOnly() const { | 109 bool OverlayUserPrefStore::ReadOnly() const { |
| 105 return false; | 110 return false; |
| 106 } | 111 } |
| 107 | 112 |
| 108 PersistentPrefStore::PrefReadError OverlayUserPrefStore::GetReadError() const { | 113 PersistentPrefStore::PrefReadError OverlayUserPrefStore::GetReadError() const { |
| 109 return PersistentPrefStore::PREF_READ_ERROR_NONE; | 114 return PersistentPrefStore::PREF_READ_ERROR_NONE; |
| 110 } | 115 } |
| 111 | 116 |
| 112 PersistentPrefStore::PrefReadError OverlayUserPrefStore::ReadPrefs() { | 117 PersistentPrefStore::PrefReadError OverlayUserPrefStore::ReadPrefs() { |
| 113 // We do not read intentionally. | 118 // We do not read intentionally. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 NamesMap::const_iterator i = | 177 NamesMap::const_iterator i = |
| 173 overlay_to_underlay_names_map_.find(overlay_key); | 178 overlay_to_underlay_names_map_.find(overlay_key); |
| 174 return i != overlay_to_underlay_names_map_.end() ? i->second : overlay_key; | 179 return i != overlay_to_underlay_names_map_.end() ? i->second : overlay_key; |
| 175 } | 180 } |
| 176 | 181 |
| 177 bool OverlayUserPrefStore::ShallBeStoredInOverlay( | 182 bool OverlayUserPrefStore::ShallBeStoredInOverlay( |
| 178 const std::string& key) const { | 183 const std::string& key) const { |
| 179 return overlay_to_underlay_names_map_.find(key) != | 184 return overlay_to_underlay_names_map_.find(key) != |
| 180 overlay_to_underlay_names_map_.end(); | 185 overlay_to_underlay_names_map_.end(); |
| 181 } | 186 } |
| OLD | NEW |