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

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

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (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/port.h ('k') | base/prefs/json_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 "base/prefs/default_pref_store.h" 5 #include "base/prefs/default_pref_store.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 7
8 using base::Value; 8 using base::Value;
9 9
10 DefaultPrefStore::DefaultPrefStore() {} 10 DefaultPrefStore::DefaultPrefStore() {}
(...skipping 11 matching lines...) Expand all
22 observers_.RemoveObserver(observer); 22 observers_.RemoveObserver(observer);
23 } 23 }
24 24
25 bool DefaultPrefStore::HasObservers() const { 25 bool DefaultPrefStore::HasObservers() const {
26 return observers_.might_have_observers(); 26 return observers_.might_have_observers();
27 } 27 }
28 28
29 void DefaultPrefStore::SetDefaultValue(const std::string& key, 29 void DefaultPrefStore::SetDefaultValue(const std::string& key,
30 scoped_ptr<Value> value) { 30 scoped_ptr<Value> value) {
31 DCHECK(!GetValue(key, NULL)); 31 DCHECK(!GetValue(key, NULL));
32 prefs_.SetValue(key, value.release()); 32 prefs_.SetValue(key, value.Pass());
33 } 33 }
34 34
35 void DefaultPrefStore::ReplaceDefaultValue(const std::string& key, 35 void DefaultPrefStore::ReplaceDefaultValue(const std::string& key,
36 scoped_ptr<Value> value) { 36 scoped_ptr<Value> value) {
37 const Value* old_value = NULL; 37 const Value* old_value = NULL;
38 GetValue(key, &old_value); 38 GetValue(key, &old_value);
39 bool notify = !old_value->Equals(value.get()); 39 bool notify = !old_value->Equals(value.get());
40 prefs_.SetValue(key, value.release()); 40 prefs_.SetValue(key, value.Pass());
41 if (notify) 41 if (notify)
42 FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key)); 42 FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key));
43 } 43 }
44 44
45 DefaultPrefStore::const_iterator DefaultPrefStore::begin() const { 45 DefaultPrefStore::const_iterator DefaultPrefStore::begin() const {
46 return prefs_.begin(); 46 return prefs_.begin();
47 } 47 }
48 48
49 DefaultPrefStore::const_iterator DefaultPrefStore::end() const { 49 DefaultPrefStore::const_iterator DefaultPrefStore::end() const {
50 return prefs_.end(); 50 return prefs_.end();
51 } 51 }
52 52
53 DefaultPrefStore::~DefaultPrefStore() {} 53 DefaultPrefStore::~DefaultPrefStore() {}
OLDNEW
« no previous file with comments | « base/port.h ('k') | base/prefs/json_pref_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698