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