| 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 | |
| 24 void ValueMapPrefStore::AddObserver(PrefStore::Observer* observer) { | 20 void ValueMapPrefStore::AddObserver(PrefStore::Observer* observer) { |
| 25 observers_.AddObserver(observer); | 21 observers_.AddObserver(observer); |
| 26 } | 22 } |
| 27 | 23 |
| 28 void ValueMapPrefStore::RemoveObserver(PrefStore::Observer* observer) { | 24 void ValueMapPrefStore::RemoveObserver(PrefStore::Observer* observer) { |
| 29 observers_.RemoveObserver(observer); | 25 observers_.RemoveObserver(observer); |
| 30 } | 26 } |
| 31 | 27 |
| 32 bool ValueMapPrefStore::HasObservers() const { | 28 bool ValueMapPrefStore::HasObservers() const { |
| 33 return observers_.might_have_observers(); | 29 return observers_.might_have_observers(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 uint32_t flags) { | 61 uint32_t flags) { |
| 66 prefs_.SetValue(key, std::move(value)); | 62 prefs_.SetValue(key, std::move(value)); |
| 67 } | 63 } |
| 68 | 64 |
| 69 ValueMapPrefStore::~ValueMapPrefStore() {} | 65 ValueMapPrefStore::~ValueMapPrefStore() {} |
| 70 | 66 |
| 71 void ValueMapPrefStore::NotifyInitializationCompleted() { | 67 void ValueMapPrefStore::NotifyInitializationCompleted() { |
| 72 for (Observer& observer : observers_) | 68 for (Observer& observer : observers_) |
| 73 observer.OnInitializationCompleted(true); | 69 observer.OnInitializationCompleted(true); |
| 74 } | 70 } |
| OLD | NEW |