OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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/in_memory_pref_store.h" | 5 #include "components/prefs/in_memory_pref_store.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 | 11 |
12 InMemoryPrefStore::InMemoryPrefStore() {} | 12 InMemoryPrefStore::InMemoryPrefStore() {} |
13 | 13 |
14 InMemoryPrefStore::~InMemoryPrefStore() {} | 14 InMemoryPrefStore::~InMemoryPrefStore() {} |
15 | 15 |
16 bool InMemoryPrefStore::GetValue(const std::string& key, | 16 bool InMemoryPrefStore::GetValue(const std::string& key, |
17 const base::Value** value) const { | 17 const base::Value** value) const { |
18 return prefs_.GetValue(key, value); | 18 return prefs_.GetValue(key, value); |
19 } | 19 } |
20 | 20 |
| 21 std::unique_ptr<base::DictionaryValue> InMemoryPrefStore::GetValues() const { |
| 22 return prefs_.AsDictionaryValue(); |
| 23 } |
| 24 |
21 bool InMemoryPrefStore::GetMutableValue(const std::string& key, | 25 bool InMemoryPrefStore::GetMutableValue(const std::string& key, |
22 base::Value** value) { | 26 base::Value** value) { |
23 return prefs_.GetValue(key, value); | 27 return prefs_.GetValue(key, value); |
24 } | 28 } |
25 | 29 |
26 void InMemoryPrefStore::AddObserver(PrefStore::Observer* observer) { | 30 void InMemoryPrefStore::AddObserver(PrefStore::Observer* observer) { |
27 observers_.AddObserver(observer); | 31 observers_.AddObserver(observer); |
28 } | 32 } |
29 | 33 |
30 void InMemoryPrefStore::RemoveObserver(PrefStore::Observer* observer) { | 34 void InMemoryPrefStore::RemoveObserver(PrefStore::Observer* observer) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 72 |
69 PersistentPrefStore::PrefReadError InMemoryPrefStore::ReadPrefs() { | 73 PersistentPrefStore::PrefReadError InMemoryPrefStore::ReadPrefs() { |
70 return PersistentPrefStore::PREF_READ_ERROR_NONE; | 74 return PersistentPrefStore::PREF_READ_ERROR_NONE; |
71 } | 75 } |
72 | 76 |
73 void InMemoryPrefStore::ReportValueChanged(const std::string& key, | 77 void InMemoryPrefStore::ReportValueChanged(const std::string& key, |
74 uint32_t flags) { | 78 uint32_t flags) { |
75 for (Observer& observer : observers_) | 79 for (Observer& observer : observers_) |
76 observer.OnPrefValueChanged(key); | 80 observer.OnPrefValueChanged(key); |
77 } | 81 } |
OLD | NEW |