diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-30 10:32:41 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-30 10:32:41 +0000 |
commit | b54e6259cc91acf5c1f37ae5f7126a47a9447b1f (patch) | |
tree | 1c521be12176fc81f84110372ad874548a325e64 /base/prefs | |
parent | 63aaa3f95c09df0edfc9a3703ad638cd4644434b (diff) | |
download | chromium_src-b54e6259cc91acf5c1f37ae5f7126a47a9447b1f.zip chromium_src-b54e6259cc91acf5c1f37ae5f7126a47a9447b1f.tar.gz chromium_src-b54e6259cc91acf5c1f37ae5f7126a47a9447b1f.tar.bz2 |
Get rid of some uses of base::Create*Value
BUG=160586
TBR=finnur, ajuma, thakis, atwilson
Review URL: https://codereview.chromium.org/131503015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247922 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/prefs')
-rw-r--r-- | base/prefs/pref_registry_simple.cc | 13 | ||||
-rw-r--r-- | base/prefs/pref_service.cc | 14 | ||||
-rw-r--r-- | base/prefs/pref_service_unittest.cc | 10 |
3 files changed, 17 insertions, 20 deletions
diff --git a/base/prefs/pref_registry_simple.cc b/base/prefs/pref_registry_simple.cc index c068b4b..7453016 100644 --- a/base/prefs/pref_registry_simple.cc +++ b/base/prefs/pref_registry_simple.cc @@ -16,29 +16,28 @@ PrefRegistrySimple::~PrefRegistrySimple() { void PrefRegistrySimple::RegisterBooleanPref(const char* path, bool default_value) { - RegisterPreference(path, base::Value::CreateBooleanValue(default_value)); + RegisterPreference(path, new base::FundamentalValue(default_value)); } void PrefRegistrySimple::RegisterIntegerPref(const char* path, int default_value) { - RegisterPreference(path, base::Value::CreateIntegerValue(default_value)); + RegisterPreference(path, new base::FundamentalValue(default_value)); } void PrefRegistrySimple::RegisterDoublePref(const char* path, double default_value) { - RegisterPreference(path, base::Value::CreateDoubleValue(default_value)); + RegisterPreference(path, new base::FundamentalValue(default_value)); } void PrefRegistrySimple::RegisterStringPref(const char* path, const std::string& default_value) { - RegisterPreference(path, base::Value::CreateStringValue(default_value)); + RegisterPreference(path, new base::StringValue(default_value)); } void PrefRegistrySimple::RegisterFilePathPref( const char* path, const base::FilePath& default_value) { - RegisterPreference(path, - base::Value::CreateStringValue(default_value.value())); + RegisterPreference(path, new base::StringValue(default_value.value())); } void PrefRegistrySimple::RegisterListPref(const char* path) { @@ -63,5 +62,5 @@ void PrefRegistrySimple::RegisterDictionaryPref( void PrefRegistrySimple::RegisterInt64Pref(const char* path, int64 default_value) { RegisterPreference( - path, base::Value::CreateStringValue(base::Int64ToString(default_value))); + path, new base::StringValue(base::Int64ToString(default_value))); } diff --git a/base/prefs/pref_service.cc b/base/prefs/pref_service.cc index 576043b..8a2c7421 100644 --- a/base/prefs/pref_service.cc +++ b/base/prefs/pref_service.cc @@ -336,19 +336,19 @@ void PrefService::Set(const char* path, const base::Value& value) { } void PrefService::SetBoolean(const char* path, bool value) { - SetUserPrefValue(path, base::Value::CreateBooleanValue(value)); + SetUserPrefValue(path, new base::FundamentalValue(value)); } void PrefService::SetInteger(const char* path, int value) { - SetUserPrefValue(path, base::Value::CreateIntegerValue(value)); + SetUserPrefValue(path, new base::FundamentalValue(value)); } void PrefService::SetDouble(const char* path, double value) { - SetUserPrefValue(path, base::Value::CreateDoubleValue(value)); + SetUserPrefValue(path, new base::FundamentalValue(value)); } void PrefService::SetString(const char* path, const std::string& value) { - SetUserPrefValue(path, base::Value::CreateStringValue(value)); + SetUserPrefValue(path, new base::StringValue(value)); } void PrefService::SetFilePath(const char* path, const base::FilePath& value) { @@ -356,8 +356,7 @@ void PrefService::SetFilePath(const char* path, const base::FilePath& value) { } void PrefService::SetInt64(const char* path, int64 value) { - SetUserPrefValue(path, - base::Value::CreateStringValue(base::Int64ToString(value))); + SetUserPrefValue(path, new base::StringValue(base::Int64ToString(value))); } int64 PrefService::GetInt64(const char* path) const { @@ -378,8 +377,7 @@ int64 PrefService::GetInt64(const char* path) const { } void PrefService::SetUint64(const char* path, uint64 value) { - SetUserPrefValue(path, - base::Value::CreateStringValue(base::Uint64ToString(value))); + SetUserPrefValue(path, new base::StringValue(base::Uint64ToString(value))); } uint64 PrefService::GetUint64(const char* path) const { diff --git a/base/prefs/pref_service_unittest.cc b/base/prefs/pref_service_unittest.cc index ff6bb2f..36ad887 100644 --- a/base/prefs/pref_service_unittest.cc +++ b/base/prefs/pref_service_unittest.cc @@ -79,7 +79,7 @@ TEST(PrefServiceTest, Observers) { TestingPrefServiceSimple prefs; prefs.SetUserPref(pref_name, - base::Value::CreateStringValue("http://www.cnn.com")); + new base::StringValue("http://www.cnn.com")); prefs.registry()->RegisterStringPref(pref_name, std::string()); const char new_pref_value[] = "http://www.google.com/"; @@ -138,7 +138,7 @@ TEST(PrefServiceTest, GetValueChangedType) { // Check falling back to a recommended value. prefs.SetUserPref(kPrefName, - base::Value::CreateStringValue("not an integer")); + new base::StringValue("not an integer")); const PrefService::Preference* pref = prefs.FindPreference(kPrefName); ASSERT_TRUE(pref); const base::Value* value = pref->GetValue(); @@ -173,7 +173,7 @@ TEST(PrefServiceTest, GetValueAndGetRecommendedValue) { ASSERT_FALSE(value); // Set a user-set value. - prefs.SetUserPref(kPrefName, base::Value::CreateIntegerValue(kUserValue)); + prefs.SetUserPref(kPrefName, new base::FundamentalValue(kUserValue)); // Check that GetValue() returns the user-set value. value = pref->GetValue(); @@ -189,7 +189,7 @@ TEST(PrefServiceTest, GetValueAndGetRecommendedValue) { // Set a recommended value. prefs.SetRecommendedPref(kPrefName, - base::Value::CreateIntegerValue(kRecommendedValue)); + new base::FundamentalValue(kRecommendedValue)); // Check that GetValue() returns the user-set value. value = pref->GetValue(); @@ -302,7 +302,7 @@ TEST_F(PrefServiceSetValueTest, SetListValue) { Mock::VerifyAndClearExpectations(&observer_); base::ListValue new_value; - new_value.Append(base::Value::CreateStringValue(kValue)); + new_value.Append(new base::StringValue(kValue)); observer_.Expect(kName, &new_value); prefs_.Set(kName, new_value); Mock::VerifyAndClearExpectations(&observer_); |