Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1629)

Side by Side Diff: components/prefs/json_pref_store.cc

Issue 2692203007: Add PrefStore::GetValues (Closed)
Patch Set: Add GetValues to FilesystemJsonPrefStore Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/prefs/json_pref_store.h ('k') | components/prefs/overlay_user_pref_store.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
193 void JsonPrefStore::AddObserver(PrefStore::Observer* observer) { 197 void JsonPrefStore::AddObserver(PrefStore::Observer* observer) {
194 DCHECK(CalledOnValidThread()); 198 DCHECK(CalledOnValidThread());
195 199
196 observers_.AddObserver(observer); 200 observers_.AddObserver(observer);
197 } 201 }
198 202
199 void JsonPrefStore::RemoveObserver(PrefStore::Observer* observer) { 203 void JsonPrefStore::RemoveObserver(PrefStore::Observer* observer) {
200 DCHECK(CalledOnValidThread()); 204 DCHECK(CalledOnValidThread());
201 205
202 observers_.RemoveObserver(observer); 206 observers_.RemoveObserver(observer);
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 DCHECK_EQ(31, num_buckets); 603 DCHECK_EQ(31, num_buckets);
600 604
601 // The histogram below is an expansion of the UMA_HISTOGRAM_CUSTOM_COUNTS 605 // The histogram below is an expansion of the UMA_HISTOGRAM_CUSTOM_COUNTS
602 // macro adapted to allow for a dynamically suffixed histogram name. 606 // macro adapted to allow for a dynamically suffixed histogram name.
603 // Note: The factory creates and owns the histogram. 607 // Note: The factory creates and owns the histogram.
604 base::HistogramBase* histogram = base::Histogram::FactoryGet( 608 base::HistogramBase* histogram = base::Histogram::FactoryGet(
605 histogram_name, min_value, max_value, num_buckets, 609 histogram_name, min_value, max_value, num_buckets,
606 base::HistogramBase::kUmaTargetedHistogramFlag); 610 base::HistogramBase::kUmaTargetedHistogramFlag);
607 return histogram; 611 return histogram;
608 } 612 }
OLDNEW
« no previous file with comments | « components/prefs/json_pref_store.h ('k') | components/prefs/overlay_user_pref_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698