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

Side by Side Diff: base/prefs/default_pref_store.cc

Issue 1647803004: Move base to DEPS (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 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 | « base/prefs/default_pref_store.h ('k') | base/prefs/default_pref_store_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/prefs/default_pref_store.h"
6 #include "base/logging.h"
7
8 using base::Value;
9
10 DefaultPrefStore::DefaultPrefStore() {}
11
12 bool DefaultPrefStore::GetValue(const std::string& key,
13 const Value** result) const {
14 return prefs_.GetValue(key, result);
15 }
16
17 void DefaultPrefStore::AddObserver(PrefStore::Observer* observer) {
18 observers_.AddObserver(observer);
19 }
20
21 void DefaultPrefStore::RemoveObserver(PrefStore::Observer* observer) {
22 observers_.RemoveObserver(observer);
23 }
24
25 bool DefaultPrefStore::HasObservers() const {
26 return observers_.might_have_observers();
27 }
28
29 void DefaultPrefStore::SetDefaultValue(const std::string& key,
30 scoped_ptr<Value> value) {
31 DCHECK(!GetValue(key, NULL));
32 prefs_.SetValue(key, value.Pass());
33 }
34
35 void DefaultPrefStore::ReplaceDefaultValue(const std::string& key,
36 scoped_ptr<Value> value) {
37 const Value* old_value = NULL;
38 GetValue(key, &old_value);
39 bool notify = !old_value->Equals(value.get());
40 prefs_.SetValue(key, value.Pass());
41 if (notify)
42 FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key));
43 }
44
45 DefaultPrefStore::const_iterator DefaultPrefStore::begin() const {
46 return prefs_.begin();
47 }
48
49 DefaultPrefStore::const_iterator DefaultPrefStore::end() const {
50 return prefs_.end();
51 }
52
53 DefaultPrefStore::~DefaultPrefStore() {}
OLDNEW
« no previous file with comments | « base/prefs/default_pref_store.h ('k') | base/prefs/default_pref_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698