| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 scoped_ptr<ReadErrorDelegate> error_delegate(error_delegate_raw); | 114 scoped_ptr<ReadErrorDelegate> error_delegate(error_delegate_raw); |
| 115 // We do not read intentionally. | 115 // We do not read intentionally. |
| 116 OnInitializationCompleted(true); | 116 OnInitializationCompleted(true); |
| 117 } | 117 } |
| 118 | 118 |
| 119 void OverlayUserPrefStore::CommitPendingWrite() { | 119 void OverlayUserPrefStore::CommitPendingWrite() { |
| 120 underlay_->CommitPendingWrite(); | 120 underlay_->CommitPendingWrite(); |
| 121 // We do not write our content intentionally. | 121 // We do not write our content intentionally. |
| 122 } | 122 } |
| 123 | 123 |
| 124 void OverlayUserPrefStore::SchedulePendingLossyWrites() { |
| 125 underlay_->SchedulePendingLossyWrites(); |
| 126 } |
| 127 |
| 124 void OverlayUserPrefStore::ReportValueChanged(const std::string& key, | 128 void OverlayUserPrefStore::ReportValueChanged(const std::string& key, |
| 125 uint32 flags) { | 129 uint32 flags) { |
| 126 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, OnPrefValueChanged(key)); | 130 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, OnPrefValueChanged(key)); |
| 127 } | 131 } |
| 128 | 132 |
| 129 void OverlayUserPrefStore::OnPrefValueChanged(const std::string& key) { | 133 void OverlayUserPrefStore::OnPrefValueChanged(const std::string& key) { |
| 130 if (!overlay_.GetValue(GetOverlayKey(key), NULL)) | 134 if (!overlay_.GetValue(GetOverlayKey(key), NULL)) |
| 131 ReportValueChanged(GetOverlayKey(key), DEFAULT_PREF_WRITE_FLAGS); | 135 ReportValueChanged(GetOverlayKey(key), DEFAULT_PREF_WRITE_FLAGS); |
| 132 } | 136 } |
| 133 | 137 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 NamesMap::const_iterator i = | 175 NamesMap::const_iterator i = |
| 172 overlay_to_underlay_names_map_.find(overlay_key); | 176 overlay_to_underlay_names_map_.find(overlay_key); |
| 173 return i != overlay_to_underlay_names_map_.end() ? i->second : overlay_key; | 177 return i != overlay_to_underlay_names_map_.end() ? i->second : overlay_key; |
| 174 } | 178 } |
| 175 | 179 |
| 176 bool OverlayUserPrefStore::ShallBeStoredInOverlay( | 180 bool OverlayUserPrefStore::ShallBeStoredInOverlay( |
| 177 const std::string& key) const { | 181 const std::string& key) const { |
| 178 return overlay_to_underlay_names_map_.find(key) != | 182 return overlay_to_underlay_names_map_.find(key) != |
| 179 overlay_to_underlay_names_map_.end(); | 183 overlay_to_underlay_names_map_.end(); |
| 180 } | 184 } |
| OLD | NEW |