| 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/pref_registry/pref_registry_syncable.h" | 5 #include "components/pref_registry/pref_registry_syncable.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/prefs/default_pref_store.h" | 8 #include "base/prefs/default_pref_store.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 case base::Value::TYPE_INTEGER: { | 34 case base::Value::TYPE_INTEGER: { |
| 35 int val; | 35 int val; |
| 36 base::StringToInt(resource_string, &val); | 36 base::StringToInt(resource_string, &val); |
| 37 return base::Value::CreateIntegerValue(val); | 37 return base::Value::CreateIntegerValue(val); |
| 38 } | 38 } |
| 39 | 39 |
| 40 case base::Value::TYPE_DOUBLE: { | 40 case base::Value::TYPE_DOUBLE: { |
| 41 double val; | 41 double val; |
| 42 base::StringToDouble(resource_string, &val); | 42 base::StringToDouble(resource_string, &val); |
| 43 return base::Value::CreateDoubleValue(val); | 43 return new base::FundamentalValue(val); |
| 44 } | 44 } |
| 45 | 45 |
| 46 case base::Value::TYPE_STRING: { | 46 case base::Value::TYPE_STRING: { |
| 47 return base::Value::CreateStringValue(resource_string); | 47 return base::Value::CreateStringValue(resource_string); |
| 48 } | 48 } |
| 49 | 49 |
| 50 default: { | 50 default: { |
| 51 NOTREACHED() << | 51 NOTREACHED() << |
| 52 "list and dictionary types cannot have default locale values"; | 52 "list and dictionary types cannot have default locale values"; |
| 53 } | 53 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 PrefSyncStatus sync_status) { | 87 PrefSyncStatus sync_status) { |
| 88 RegisterSyncablePreference(path, | 88 RegisterSyncablePreference(path, |
| 89 base::Value::CreateIntegerValue(default_value), | 89 base::Value::CreateIntegerValue(default_value), |
| 90 sync_status); | 90 sync_status); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void PrefRegistrySyncable::RegisterDoublePref(const char* path, | 93 void PrefRegistrySyncable::RegisterDoublePref(const char* path, |
| 94 double default_value, | 94 double default_value, |
| 95 PrefSyncStatus sync_status) { | 95 PrefSyncStatus sync_status) { |
| 96 RegisterSyncablePreference(path, | 96 RegisterSyncablePreference(path, |
| 97 base::Value::CreateDoubleValue(default_value), | 97 new base::FundamentalValue(default_value), |
| 98 sync_status); | 98 sync_status); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void PrefRegistrySyncable::RegisterStringPref(const char* path, | 101 void PrefRegistrySyncable::RegisterStringPref(const char* path, |
| 102 const std::string& default_value, | 102 const std::string& default_value, |
| 103 PrefSyncStatus sync_status) { | 103 PrefSyncStatus sync_status) { |
| 104 RegisterSyncablePreference(path, | 104 RegisterSyncablePreference(path, |
| 105 base::Value::CreateStringValue(default_value), | 105 base::Value::CreateStringValue(default_value), |
| 106 sync_status); | 106 sync_status); |
| 107 } | 107 } |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 scoped_refptr<PrefRegistrySyncable> PrefRegistrySyncable::ForkForIncognito() { | 221 scoped_refptr<PrefRegistrySyncable> PrefRegistrySyncable::ForkForIncognito() { |
| 222 // TODO(joi): We can directly reuse the same PrefRegistry once | 222 // TODO(joi): We can directly reuse the same PrefRegistry once |
| 223 // PrefService no longer registers for callbacks on registration and | 223 // PrefService no longer registers for callbacks on registration and |
| 224 // unregistration. | 224 // unregistration. |
| 225 scoped_refptr<PrefRegistrySyncable> registry(new PrefRegistrySyncable()); | 225 scoped_refptr<PrefRegistrySyncable> registry(new PrefRegistrySyncable()); |
| 226 registry->defaults_ = defaults_; | 226 registry->defaults_ = defaults_; |
| 227 return registry; | 227 return registry; |
| 228 } | 228 } |
| 229 | 229 |
| 230 } // namespace user_prefs | 230 } // namespace user_prefs |
| OLD | NEW |