| 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 "components/prefs/value_map_pref_store.h" | 5 #include "components/prefs/value_map_pref_store.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 | 12 |
| 13 ValueMapPrefStore::ValueMapPrefStore() {} | 13 ValueMapPrefStore::ValueMapPrefStore() {} |
| 14 | 14 |
| 15 bool ValueMapPrefStore::GetValue(const std::string& key, | 15 bool ValueMapPrefStore::GetValue(const std::string& key, |
| 16 const base::Value** value) const { | 16 const base::Value** value) const { |
| 17 return prefs_.GetValue(key, value); | 17 return prefs_.GetValue(key, value); |
| 18 } | 18 } |
| 19 | 19 |
| 20 std::unique_ptr<base::DictionaryValue> ValueMapPrefStore::GetValues() const { |
| 21 return prefs_.AsDictionaryValue(); |
| 22 } |
| 23 |
| 20 void ValueMapPrefStore::AddObserver(PrefStore::Observer* observer) { | 24 void ValueMapPrefStore::AddObserver(PrefStore::Observer* observer) { |
| 21 observers_.AddObserver(observer); | 25 observers_.AddObserver(observer); |
| 22 } | 26 } |
| 23 | 27 |
| 24 void ValueMapPrefStore::RemoveObserver(PrefStore::Observer* observer) { | 28 void ValueMapPrefStore::RemoveObserver(PrefStore::Observer* observer) { |
| 25 observers_.RemoveObserver(observer); | 29 observers_.RemoveObserver(observer); |
| 26 } | 30 } |
| 27 | 31 |
| 28 bool ValueMapPrefStore::HasObservers() const { | 32 bool ValueMapPrefStore::HasObservers() const { |
| 29 return observers_.might_have_observers(); | 33 return observers_.might_have_observers(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 uint32_t flags) { | 65 uint32_t flags) { |
| 62 prefs_.SetValue(key, std::move(value)); | 66 prefs_.SetValue(key, std::move(value)); |
| 63 } | 67 } |
| 64 | 68 |
| 65 ValueMapPrefStore::~ValueMapPrefStore() {} | 69 ValueMapPrefStore::~ValueMapPrefStore() {} |
| 66 | 70 |
| 67 void ValueMapPrefStore::NotifyInitializationCompleted() { | 71 void ValueMapPrefStore::NotifyInitializationCompleted() { |
| 68 for (Observer& observer : observers_) | 72 for (Observer& observer : observers_) |
| 69 observer.OnInitializationCompleted(true); | 73 observer.OnInitializationCompleted(true); |
| 70 } | 74 } |
| OLD | NEW |