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

Side by Side Diff: chrome/browser/prefs/dictionary_pref_store.cc

Issue 324493002: Move preference MACs to the protected preference stores. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to CR comments. Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 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 "chrome/browser/prefs/dictionary_pref_store.h"
6
7 #include "base/values.h"
8
9 DictionaryPrefStore::DictionaryPrefStore(base::DictionaryValue* dictionary)
10 : dictionary_(dictionary) {
11 }
12
13 bool DictionaryPrefStore::GetValue(const std::string& key,
14 const base::Value** result) const {
15 return dictionary_->Get(key, result);
16 }
17
18 void DictionaryPrefStore::AddObserver(PrefStore::Observer* observer) {
19 observers_.AddObserver(observer);
20 }
21
22 void DictionaryPrefStore::RemoveObserver(PrefStore::Observer* observer) {
23 observers_.RemoveObserver(observer);
24 }
25
26 bool DictionaryPrefStore::HasObservers() const {
27 return observers_.might_have_observers();
28 }
29
30 void DictionaryPrefStore::SetValue(const std::string& key, base::Value* value) {
31 dictionary_->Set(key, value);
32 ReportValueChanged(key);
33 }
34
35 void DictionaryPrefStore::RemoveValue(const std::string& key) {
36 dictionary_->Remove(key, NULL);
37 ReportValueChanged(key);
38 }
39
40 bool DictionaryPrefStore::GetMutableValue(const std::string& key,
41 base::Value** result) {
42 return dictionary_->Get(key, result);
43 }
44
45 void DictionaryPrefStore::ReportValueChanged(const std::string& key) {
46 FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key));
47 }
48
49 DictionaryPrefStore::~DictionaryPrefStore() {
50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698