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

Side by Side Diff: components/pref_registry/pref_registry_syncable.cc

Issue 383263005: Remove more CreateIntegerValue calls. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/SetBoolean/SetInteger Created 6 years, 5 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 "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
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
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
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
OLDNEW
« no previous file with comments | « components/policy/tools/generate_policy_source.py ('k') | components/search_engines/default_search_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698