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

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

Issue 10068036: RefCounted types should not have public destructors, chrome/browser/ part 5 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win fix Created 8 years, 8 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
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 "chrome/browser/prefs/value_map_pref_store.h" 5 #include "chrome/browser/prefs/value_map_pref_store.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 11
12 ValueMapPrefStore::ValueMapPrefStore() {} 12 ValueMapPrefStore::ValueMapPrefStore() {}
13 13
14 ValueMapPrefStore::~ValueMapPrefStore() {}
15
16 PrefStore::ReadResult ValueMapPrefStore::GetValue(const std::string& key, 14 PrefStore::ReadResult ValueMapPrefStore::GetValue(const std::string& key,
17 const Value** value) const { 15 const Value** value) const {
18 return prefs_.GetValue(key, value) ? READ_OK : READ_NO_VALUE; 16 return prefs_.GetValue(key, value) ? READ_OK : READ_NO_VALUE;
19 } 17 }
20 18
21 void ValueMapPrefStore::AddObserver(PrefStore::Observer* observer) { 19 void ValueMapPrefStore::AddObserver(PrefStore::Observer* observer) {
22 observers_.AddObserver(observer); 20 observers_.AddObserver(observer);
23 } 21 }
24 22
25 void ValueMapPrefStore::RemoveObserver(PrefStore::Observer* observer) { 23 void ValueMapPrefStore::RemoveObserver(PrefStore::Observer* observer) {
26 observers_.RemoveObserver(observer); 24 observers_.RemoveObserver(observer);
27 } 25 }
28 26
29 size_t ValueMapPrefStore::NumberOfObservers() const { 27 size_t ValueMapPrefStore::NumberOfObservers() const {
30 return observers_.size(); 28 return observers_.size();
31 } 29 }
32 30
33 void ValueMapPrefStore::SetValue(const std::string& key, Value* value) {
34 if (prefs_.SetValue(key, value))
35 FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key));
36 }
37
38 void ValueMapPrefStore::RemoveValue(const std::string& key) {
39 if (prefs_.RemoveValue(key))
40 FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key));
41 }
42
43 void ValueMapPrefStore::NotifyInitializationCompleted() {
44 FOR_EACH_OBSERVER(Observer, observers_, OnInitializationCompleted(true));
45 }
46
47 ValueMapPrefStore::iterator ValueMapPrefStore::begin() { 31 ValueMapPrefStore::iterator ValueMapPrefStore::begin() {
48 return prefs_.begin(); 32 return prefs_.begin();
49 } 33 }
50 34
51 ValueMapPrefStore::iterator ValueMapPrefStore::end() { 35 ValueMapPrefStore::iterator ValueMapPrefStore::end() {
52 return prefs_.end(); 36 return prefs_.end();
53 } 37 }
54 38
55 ValueMapPrefStore::const_iterator ValueMapPrefStore::begin() const { 39 ValueMapPrefStore::const_iterator ValueMapPrefStore::begin() const {
56 return prefs_.begin(); 40 return prefs_.begin();
57 } 41 }
58 42
59 ValueMapPrefStore::const_iterator ValueMapPrefStore::end() const { 43 ValueMapPrefStore::const_iterator ValueMapPrefStore::end() const {
60 return prefs_.end(); 44 return prefs_.end();
61 } 45 }
46
47 ValueMapPrefStore::~ValueMapPrefStore() {}
48
49 void ValueMapPrefStore::SetValue(const std::string& key, Value* value) {
50 if (prefs_.SetValue(key, value))
51 FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key));
52 }
53
54 void ValueMapPrefStore::RemoveValue(const std::string& key) {
55 if (prefs_.RemoveValue(key))
56 FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key));
57 }
58
59 void ValueMapPrefStore::NotifyInitializationCompleted() {
60 FOR_EACH_OBSERVER(Observer, observers_, OnInitializationCompleted(true));
61 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/value_map_pref_store.h ('k') | chrome/browser/printing/cloud_print/cloud_print_proxy_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698