| 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 11 matching lines...) Expand all Loading... |
| 22 } | 22 } |
| 23 | 23 |
| 24 void OverlayUserPrefStore::AddObserver(PrefStore::Observer* observer) { | 24 void OverlayUserPrefStore::AddObserver(PrefStore::Observer* observer) { |
| 25 observers_.AddObserver(observer); | 25 observers_.AddObserver(observer); |
| 26 } | 26 } |
| 27 | 27 |
| 28 void OverlayUserPrefStore::RemoveObserver(PrefStore::Observer* observer) { | 28 void OverlayUserPrefStore::RemoveObserver(PrefStore::Observer* observer) { |
| 29 observers_.RemoveObserver(observer); | 29 observers_.RemoveObserver(observer); |
| 30 } | 30 } |
| 31 | 31 |
| 32 size_t OverlayUserPrefStore::NumberOfObservers() const { |
| 33 return observers_.size(); |
| 34 } |
| 35 |
| 32 bool OverlayUserPrefStore::IsInitializationComplete() const { | 36 bool OverlayUserPrefStore::IsInitializationComplete() const { |
| 33 return underlay_->IsInitializationComplete(); | 37 return underlay_->IsInitializationComplete(); |
| 34 } | 38 } |
| 35 | 39 |
| 36 PrefStore::ReadResult OverlayUserPrefStore::GetValue( | 40 PrefStore::ReadResult OverlayUserPrefStore::GetValue( |
| 37 const std::string& key, | 41 const std::string& key, |
| 38 const Value** result) const { | 42 const Value** result) const { |
| 39 // If the |key| shall NOT be stored in the overlay store, there must not | 43 // If the |key| shall NOT be stored in the overlay store, there must not |
| 40 // be an entry. | 44 // be an entry. |
| 41 DCHECK(ShallBeStoredInOverlay(key) || !overlay_.GetValue(key, NULL)); | 45 DCHECK(ShallBeStoredInOverlay(key) || !overlay_.GetValue(key, NULL)); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 NamesMap::const_iterator i = | 168 NamesMap::const_iterator i = |
| 165 overlay_to_underlay_names_map_.find(overlay_key); | 169 overlay_to_underlay_names_map_.find(overlay_key); |
| 166 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; |
| 167 } | 171 } |
| 168 | 172 |
| 169 bool OverlayUserPrefStore::ShallBeStoredInOverlay( | 173 bool OverlayUserPrefStore::ShallBeStoredInOverlay( |
| 170 const std::string& key) const { | 174 const std::string& key) const { |
| 171 return overlay_to_underlay_names_map_.find(key) != | 175 return overlay_to_underlay_names_map_.find(key) != |
| 172 overlay_to_underlay_names_map_.end(); | 176 overlay_to_underlay_names_map_.end(); |
| 173 } | 177 } |
| OLD | NEW |