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/json_pref_store.h" | 5 #include "components/prefs/json_pref_store.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 | 183 |
184 base::Value* tmp = nullptr; | 184 base::Value* tmp = nullptr; |
185 if (!prefs_->Get(key, &tmp)) | 185 if (!prefs_->Get(key, &tmp)) |
186 return false; | 186 return false; |
187 | 187 |
188 if (result) | 188 if (result) |
189 *result = tmp; | 189 *result = tmp; |
190 return true; | 190 return true; |
191 } | 191 } |
192 | 192 |
193 std::unique_ptr<base::DictionaryValue> JsonPrefStore::GetValues() const { | |
194 return prefs_->CreateDeepCopy(); | |
195 } | |
196 | |
197 void JsonPrefStore::AddObserver(PrefStore::Observer* observer) { | 193 void JsonPrefStore::AddObserver(PrefStore::Observer* observer) { |
198 DCHECK(CalledOnValidThread()); | 194 DCHECK(CalledOnValidThread()); |
199 | 195 |
200 observers_.AddObserver(observer); | 196 observers_.AddObserver(observer); |
201 } | 197 } |
202 | 198 |
203 void JsonPrefStore::RemoveObserver(PrefStore::Observer* observer) { | 199 void JsonPrefStore::RemoveObserver(PrefStore::Observer* observer) { |
204 DCHECK(CalledOnValidThread()); | 200 DCHECK(CalledOnValidThread()); |
205 | 201 |
206 observers_.RemoveObserver(observer); | 202 observers_.RemoveObserver(observer); |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 DCHECK_EQ(31, num_buckets); | 599 DCHECK_EQ(31, num_buckets); |
604 | 600 |
605 // The histogram below is an expansion of the UMA_HISTOGRAM_CUSTOM_COUNTS | 601 // The histogram below is an expansion of the UMA_HISTOGRAM_CUSTOM_COUNTS |
606 // macro adapted to allow for a dynamically suffixed histogram name. | 602 // macro adapted to allow for a dynamically suffixed histogram name. |
607 // Note: The factory creates and owns the histogram. | 603 // Note: The factory creates and owns the histogram. |
608 base::HistogramBase* histogram = base::Histogram::FactoryGet( | 604 base::HistogramBase* histogram = base::Histogram::FactoryGet( |
609 histogram_name, min_value, max_value, num_buckets, | 605 histogram_name, min_value, max_value, num_buckets, |
610 base::HistogramBase::kUmaTargetedHistogramFlag); | 606 base::HistogramBase::kUmaTargetedHistogramFlag); |
611 return histogram; | 607 return histogram; |
612 } | 608 } |
OLD | NEW |