OLD | NEW |
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/pref_registry_simple.h" | 5 #include "base/prefs/pref_registry_simple.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 | 10 |
11 PrefRegistrySimple::PrefRegistrySimple() { | 11 PrefRegistrySimple::PrefRegistrySimple() { |
12 } | 12 } |
13 | 13 |
14 PrefRegistrySimple::~PrefRegistrySimple() { | 14 PrefRegistrySimple::~PrefRegistrySimple() { |
15 } | 15 } |
16 | 16 |
17 void PrefRegistrySimple::RegisterBooleanPref(const std::string& path, | 17 void PrefRegistrySimple::RegisterBooleanPref(const std::string& path, |
18 bool default_value) { | 18 bool default_value) { |
19 RegisterPreference(path, new base::FundamentalValue(default_value)); | 19 RegisterPrefAndNotify(path, new base::FundamentalValue(default_value), |
| 20 NO_REGISTRATION_FLAGS); |
20 } | 21 } |
21 | 22 |
22 void PrefRegistrySimple::RegisterIntegerPref(const std::string& path, | 23 void PrefRegistrySimple::RegisterIntegerPref(const std::string& path, |
23 int default_value) { | 24 int default_value) { |
24 RegisterPreference(path, new base::FundamentalValue(default_value)); | 25 RegisterPrefAndNotify(path, new base::FundamentalValue(default_value), |
| 26 NO_REGISTRATION_FLAGS); |
25 } | 27 } |
26 | 28 |
27 void PrefRegistrySimple::RegisterDoublePref(const std::string& path, | 29 void PrefRegistrySimple::RegisterDoublePref(const std::string& path, |
28 double default_value) { | 30 double default_value) { |
29 RegisterPreference(path, new base::FundamentalValue(default_value)); | 31 RegisterPrefAndNotify(path, new base::FundamentalValue(default_value), |
| 32 NO_REGISTRATION_FLAGS); |
30 } | 33 } |
31 | 34 |
32 void PrefRegistrySimple::RegisterStringPref(const std::string& path, | 35 void PrefRegistrySimple::RegisterStringPref(const std::string& path, |
33 const std::string& default_value) { | 36 const std::string& default_value) { |
34 RegisterPreference(path, new base::StringValue(default_value)); | 37 RegisterPrefAndNotify(path, new base::StringValue(default_value), |
| 38 NO_REGISTRATION_FLAGS); |
35 } | 39 } |
36 | 40 |
37 void PrefRegistrySimple::RegisterFilePathPref( | 41 void PrefRegistrySimple::RegisterFilePathPref( |
38 const std::string& path, | 42 const std::string& path, |
39 const base::FilePath& default_value) { | 43 const base::FilePath& default_value) { |
40 RegisterPreference(path, new base::StringValue(default_value.value())); | 44 RegisterPrefAndNotify(path, new base::StringValue(default_value.value()), |
| 45 NO_REGISTRATION_FLAGS); |
41 } | 46 } |
42 | 47 |
43 void PrefRegistrySimple::RegisterListPref(const std::string& path) { | 48 void PrefRegistrySimple::RegisterListPref(const std::string& path) { |
44 RegisterPreference(path, new base::ListValue()); | 49 RegisterPrefAndNotify(path, new base::ListValue(), NO_REGISTRATION_FLAGS); |
45 } | 50 } |
46 | 51 |
47 void PrefRegistrySimple::RegisterListPref(const std::string& path, | 52 void PrefRegistrySimple::RegisterListPref(const std::string& path, |
48 base::ListValue* default_value) { | 53 base::ListValue* default_value) { |
49 RegisterPreference(path, default_value); | 54 RegisterPrefAndNotify(path, default_value, NO_REGISTRATION_FLAGS); |
50 } | 55 } |
51 | 56 |
52 void PrefRegistrySimple::RegisterDictionaryPref(const std::string& path) { | 57 void PrefRegistrySimple::RegisterDictionaryPref(const std::string& path) { |
53 RegisterPreference(path, new base::DictionaryValue()); | 58 RegisterPrefAndNotify(path, new base::DictionaryValue(), |
| 59 NO_REGISTRATION_FLAGS); |
54 } | 60 } |
55 | 61 |
56 void PrefRegistrySimple::RegisterDictionaryPref( | 62 void PrefRegistrySimple::RegisterDictionaryPref( |
57 const std::string& path, | 63 const std::string& path, |
58 base::DictionaryValue* default_value) { | 64 base::DictionaryValue* default_value) { |
59 RegisterPreference(path, default_value); | 65 RegisterPrefAndNotify(path, default_value, NO_REGISTRATION_FLAGS); |
60 } | 66 } |
61 | 67 |
62 void PrefRegistrySimple::RegisterInt64Pref(const std::string& path, | 68 void PrefRegistrySimple::RegisterInt64Pref(const std::string& path, |
63 int64 default_value) { | 69 int64 default_value) { |
64 RegisterPreference( | 70 RegisterPrefAndNotify( |
65 path, new base::StringValue(base::Int64ToString(default_value))); | 71 path, new base::StringValue(base::Int64ToString(default_value)), |
| 72 NO_REGISTRATION_FLAGS); |
66 } | 73 } |
| 74 |
| 75 void PrefRegistrySimple::RegisterUint64Pref(const std::string& path, |
| 76 uint64 default_value) { |
| 77 RegisterPrefAndNotify( |
| 78 path, new base::StringValue(base::Uint64ToString(default_value)), |
| 79 NO_REGISTRATION_FLAGS); |
| 80 } |
| 81 |
| 82 void PrefRegistrySimple::RegisterBooleanPref(const std::string& path, |
| 83 bool default_value, |
| 84 uint32 flags) { |
| 85 RegisterPrefAndNotify(path, new base::FundamentalValue(default_value), flags); |
| 86 } |
| 87 |
| 88 void PrefRegistrySimple::RegisterIntegerPref(const std::string& path, |
| 89 int default_value, |
| 90 uint32 flags) { |
| 91 RegisterPrefAndNotify(path, new base::FundamentalValue(default_value), flags); |
| 92 } |
| 93 |
| 94 void PrefRegistrySimple::RegisterDoublePref(const std::string& path, |
| 95 double default_value, |
| 96 uint32 flags) { |
| 97 RegisterPrefAndNotify(path, new base::FundamentalValue(default_value), flags); |
| 98 } |
| 99 |
| 100 void PrefRegistrySimple::RegisterStringPref(const std::string& path, |
| 101 const std::string& default_value, |
| 102 uint32 flags) { |
| 103 RegisterPrefAndNotify(path, new base::StringValue(default_value), flags); |
| 104 } |
| 105 |
| 106 void PrefRegistrySimple::RegisterFilePathPref( |
| 107 const std::string& path, |
| 108 const base::FilePath& default_value, |
| 109 uint32 flags) { |
| 110 RegisterPrefAndNotify(path, new base::StringValue(default_value.value()), |
| 111 flags); |
| 112 } |
| 113 |
| 114 void PrefRegistrySimple::RegisterListPref(const std::string& path, |
| 115 uint32 flags) { |
| 116 RegisterPrefAndNotify(path, new base::ListValue(), flags); |
| 117 } |
| 118 |
| 119 void PrefRegistrySimple::RegisterListPref(const std::string& path, |
| 120 base::ListValue* default_value, |
| 121 uint32 flags) { |
| 122 RegisterPrefAndNotify(path, default_value, flags); |
| 123 } |
| 124 |
| 125 void PrefRegistrySimple::RegisterDictionaryPref(const std::string& path, |
| 126 uint32 flags) { |
| 127 RegisterPrefAndNotify(path, new base::DictionaryValue(), flags); |
| 128 } |
| 129 |
| 130 void PrefRegistrySimple::RegisterDictionaryPref( |
| 131 const std::string& path, |
| 132 base::DictionaryValue* default_value, |
| 133 uint32 flags) { |
| 134 RegisterPrefAndNotify(path, default_value, flags); |
| 135 } |
| 136 |
| 137 void PrefRegistrySimple::RegisterInt64Pref(const std::string& path, |
| 138 int64 default_value, |
| 139 uint32 flags) { |
| 140 RegisterPrefAndNotify( |
| 141 path, new base::StringValue(base::Int64ToString(default_value)), flags); |
| 142 } |
| 143 |
| 144 void PrefRegistrySimple::RegisterUint64Pref(const std::string& path, |
| 145 uint64 default_value, |
| 146 uint32 flags) { |
| 147 RegisterPrefAndNotify( |
| 148 path, new base::StringValue(base::Uint64ToString(default_value)), flags); |
| 149 } |
| 150 |
| 151 void PrefRegistrySimple::OnPrefRegistered(const std::string& path, |
| 152 base::Value* default_value, |
| 153 uint32 flags) { |
| 154 } |
| 155 |
| 156 void PrefRegistrySimple::RegisterPrefAndNotify(const std::string& path, |
| 157 base::Value* default_value, |
| 158 uint32 flags) { |
| 159 RegisterPreference(path, default_value, flags); |
| 160 OnPrefRegistered(path, default_value, flags); |
| 161 } |
OLD | NEW |