OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/incognito_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( |
11 PersistentPrefStore* underlay) | 11 PersistentPrefStore* underlay) |
12 : underlay_(underlay) { | 12 : underlay_(underlay) { |
13 underlay_->AddObserver(this); | 13 underlay_->AddObserver(this); |
14 } | 14 } |
15 | 15 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 void OverlayUserPrefStore::CommitPendingWrite() { | 117 void OverlayUserPrefStore::CommitPendingWrite() { |
118 underlay_->CommitPendingWrite(); | 118 underlay_->CommitPendingWrite(); |
119 // We do not write our content intentionally. | 119 // We do not write our content intentionally. |
120 } | 120 } |
121 | 121 |
122 void OverlayUserPrefStore::ReportValueChanged(const std::string& key) { | 122 void OverlayUserPrefStore::ReportValueChanged(const std::string& key) { |
123 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, OnPrefValueChanged(key)); | 123 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, OnPrefValueChanged(key)); |
124 } | 124 } |
125 | 125 |
126 void OverlayUserPrefStore::RegisterOverlayProperty(const std::string& key) { | 126 void OverlayUserPrefStore::RegisterOverlayPref(const std::string& key) { |
127 RegisterOverlayProperty(key, key); | 127 RegisterOverlayPref(key, key); |
128 } | 128 } |
129 | 129 |
130 void OverlayUserPrefStore::RegisterOverlayProperty( | 130 void OverlayUserPrefStore::RegisterOverlayPref( |
131 const std::string& overlay_key, | 131 const std::string& overlay_key, |
132 const std::string& underlay_key) { | 132 const std::string& underlay_key) { |
133 DCHECK(!overlay_key.empty()) << "Overlay key is empty"; | 133 DCHECK(!overlay_key.empty()) << "Overlay key is empty"; |
134 DCHECK(overlay_to_underlay_names_map_.find(overlay_key) == | 134 DCHECK(overlay_to_underlay_names_map_.find(overlay_key) == |
135 overlay_to_underlay_names_map_.end()) << | 135 overlay_to_underlay_names_map_.end()) << |
136 "Overlay key already registered"; | 136 "Overlay key already registered"; |
137 DCHECK(!underlay_key.empty()) << "Underlay key is empty"; | 137 DCHECK(!underlay_key.empty()) << "Underlay key is empty"; |
138 DCHECK(underlay_to_overlay_names_map_.find(underlay_key) == | 138 DCHECK(underlay_to_overlay_names_map_.find(underlay_key) == |
139 underlay_to_overlay_names_map_.end()) << | 139 underlay_to_overlay_names_map_.end()) << |
140 "Underlay key already registered"; | 140 "Underlay key already registered"; |
(...skipping 23 matching lines...) Expand all Loading... |
164 NamesMap::const_iterator i = | 164 NamesMap::const_iterator i = |
165 overlay_to_underlay_names_map_.find(overlay_key); | 165 overlay_to_underlay_names_map_.find(overlay_key); |
166 return i != overlay_to_underlay_names_map_.end() ? i->second : overlay_key; | 166 return i != overlay_to_underlay_names_map_.end() ? i->second : overlay_key; |
167 } | 167 } |
168 | 168 |
169 bool OverlayUserPrefStore::ShallBeStoredInOverlay( | 169 bool OverlayUserPrefStore::ShallBeStoredInOverlay( |
170 const std::string& key) const { | 170 const std::string& key) const { |
171 return overlay_to_underlay_names_map_.find(key) != | 171 return overlay_to_underlay_names_map_.find(key) != |
172 overlay_to_underlay_names_map_.end(); | 172 overlay_to_underlay_names_map_.end(); |
173 } | 173 } |
OLD | NEW |