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 16 matching lines...) Expand all Loading... |
27 if ("true" == resource_string) | 27 if ("true" == resource_string) |
28 return base::Value::CreateBooleanValue(true); | 28 return base::Value::CreateBooleanValue(true); |
29 if ("false" == resource_string) | 29 if ("false" == resource_string) |
30 return base::Value::CreateBooleanValue(false); | 30 return base::Value::CreateBooleanValue(false); |
31 break; | 31 break; |
32 } | 32 } |
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 new base::FundamentalValue(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 base::Value::CreateDoubleValue(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); |
(...skipping 30 matching lines...) Expand all Loading... |
78 bool default_value, | 78 bool default_value, |
79 PrefSyncStatus sync_status) { | 79 PrefSyncStatus sync_status) { |
80 RegisterSyncablePreference(path, | 80 RegisterSyncablePreference(path, |
81 base::Value::CreateBooleanValue(default_value), | 81 base::Value::CreateBooleanValue(default_value), |
82 sync_status); | 82 sync_status); |
83 } | 83 } |
84 | 84 |
85 void PrefRegistrySyncable::RegisterIntegerPref(const char* path, | 85 void PrefRegistrySyncable::RegisterIntegerPref(const char* path, |
86 int default_value, | 86 int default_value, |
87 PrefSyncStatus sync_status) { | 87 PrefSyncStatus sync_status) { |
88 RegisterSyncablePreference(path, | 88 RegisterSyncablePreference( |
89 base::Value::CreateIntegerValue(default_value), | 89 path, new base::FundamentalValue(default_value), sync_status); |
90 sync_status); | |
91 } | 90 } |
92 | 91 |
93 void PrefRegistrySyncable::RegisterDoublePref(const char* path, | 92 void PrefRegistrySyncable::RegisterDoublePref(const char* path, |
94 double default_value, | 93 double default_value, |
95 PrefSyncStatus sync_status) { | 94 PrefSyncStatus sync_status) { |
96 RegisterSyncablePreference(path, | 95 RegisterSyncablePreference(path, |
97 base::Value::CreateDoubleValue(default_value), | 96 base::Value::CreateDoubleValue(default_value), |
98 sync_status); | 97 sync_status); |
99 } | 98 } |
100 | 99 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 scoped_refptr<PrefRegistrySyncable> PrefRegistrySyncable::ForkForIncognito() { | 220 scoped_refptr<PrefRegistrySyncable> PrefRegistrySyncable::ForkForIncognito() { |
222 // TODO(joi): We can directly reuse the same PrefRegistry once | 221 // TODO(joi): We can directly reuse the same PrefRegistry once |
223 // PrefService no longer registers for callbacks on registration and | 222 // PrefService no longer registers for callbacks on registration and |
224 // unregistration. | 223 // unregistration. |
225 scoped_refptr<PrefRegistrySyncable> registry(new PrefRegistrySyncable()); | 224 scoped_refptr<PrefRegistrySyncable> registry(new PrefRegistrySyncable()); |
226 registry->defaults_ = defaults_; | 225 registry->defaults_ = defaults_; |
227 return registry; | 226 return registry; |
228 } | 227 } |
229 | 228 |
230 } // namespace user_prefs | 229 } // namespace user_prefs |
OLD | NEW |