Commit 23972357 authored by jdoerrie's avatar jdoerrie Committed by Commit bot

Remove base::FundamentalValue

As a follow-up to typedeffing base::FundamentalValue to base::Value in
http://crrev.com/2645073002 this change replaces all references to
base::FundamentalValue by base::Value.

TBR=stevenjb@chromium.org, dbeam@chromium.org
BUG=646113

Review-Url: https://codereview.chromium.org/2666093002
Cr-Commit-Position: refs/heads/master@{#454235}
parent d665cfde
......@@ -736,12 +736,12 @@ std::unique_ptr<Value> JSONParser::ConsumeNumber() {
int num_int;
if (StringToInt(num_string, &num_int))
return base::MakeUnique<FundamentalValue>(num_int);
return base::MakeUnique<Value>(num_int);
double num_double;
if (StringToDouble(num_string.as_string(), &num_double) &&
std::isfinite(num_double)) {
return base::MakeUnique<FundamentalValue>(num_double);
return base::MakeUnique<Value>(num_double);
}
return nullptr;
......@@ -782,7 +782,7 @@ std::unique_ptr<Value> JSONParser::ConsumeLiteral() {
return nullptr;
}
NextNChars(kTrueLen - 1);
return base::MakeUnique<FundamentalValue>(true);
return base::MakeUnique<Value>(true);
}
case 'f': {
const char kFalseLiteral[] = "false";
......@@ -793,7 +793,7 @@ std::unique_ptr<Value> JSONParser::ConsumeLiteral() {
return nullptr;
}
NextNChars(kFalseLen - 1);
return base::MakeUnique<FundamentalValue>(false);
return base::MakeUnique<Value>(false);
}
case 'n': {
const char kNullLiteral[] = "null";
......
......@@ -23,9 +23,9 @@ std::unique_ptr<DictionaryValue> GenerateDict() {
root->SetString("String", "Foo");
auto list = MakeUnique<ListValue>();
list->Set(0, MakeUnique<FundamentalValue>(2.718));
list->Set(1, MakeUnique<FundamentalValue>(false));
list->Set(2, MakeUnique<FundamentalValue>(123));
list->Set(0, MakeUnique<Value>(2.718));
list->Set(1, MakeUnique<Value>(false));
list->Set(2, MakeUnique<Value>(123));
list->Set(3, MakeUnique<StringValue>("Bar"));
root->Set("List", std::move(list));
......
......@@ -27,23 +27,23 @@ TEST(JSONWriterTest, BasicTypes) {
EXPECT_EQ("[]", output_js);
// Test integer values.
EXPECT_TRUE(JSONWriter::Write(FundamentalValue(42), &output_js));
EXPECT_TRUE(JSONWriter::Write(Value(42), &output_js));
EXPECT_EQ("42", output_js);
// Test boolean values.
EXPECT_TRUE(JSONWriter::Write(FundamentalValue(true), &output_js));
EXPECT_TRUE(JSONWriter::Write(Value(true), &output_js));
EXPECT_EQ("true", output_js);
// Test Real values should always have a decimal or an 'e'.
EXPECT_TRUE(JSONWriter::Write(FundamentalValue(1.0), &output_js));
EXPECT_TRUE(JSONWriter::Write(Value(1.0), &output_js));
EXPECT_EQ("1.0", output_js);
// Test Real values in the the range (-1, 1) must have leading zeros
EXPECT_TRUE(JSONWriter::Write(FundamentalValue(0.2), &output_js));
EXPECT_TRUE(JSONWriter::Write(Value(0.2), &output_js));
EXPECT_EQ("0.2", output_js);
// Test Real values in the the range (-1, 1) must have leading zeros
EXPECT_TRUE(JSONWriter::Write(FundamentalValue(-0.8), &output_js));
EXPECT_TRUE(JSONWriter::Write(Value(-0.8), &output_js));
EXPECT_EQ("-0.8", output_js);
// Test String values.
......@@ -119,9 +119,9 @@ TEST(JSONWriterTest, BinaryValues) {
ListValue binary_list;
binary_list.Append(BinaryValue::CreateWithCopiedBuffer("asdf", 4));
binary_list.Append(MakeUnique<FundamentalValue>(5));
binary_list.Append(MakeUnique<Value>(5));
binary_list.Append(BinaryValue::CreateWithCopiedBuffer("asdf", 4));
binary_list.Append(MakeUnique<FundamentalValue>(2));
binary_list.Append(MakeUnique<Value>(2));
binary_list.Append(BinaryValue::CreateWithCopiedBuffer("asdf", 4));
EXPECT_FALSE(JSONWriter::Write(binary_list, &output_js));
EXPECT_TRUE(JSONWriter::WriteWithOptions(
......@@ -144,7 +144,7 @@ TEST(JSONWriterTest, DoublesAsInts) {
std::string output_js;
// Test allowing a double with no fractional part to be written as an integer.
FundamentalValue double_value(1e10);
Value double_value(1e10);
EXPECT_TRUE(JSONWriter::WriteWithOptions(
double_value, JSONWriter::OPTIONS_OMIT_DOUBLE_TYPE_PRESERVATION,
&output_js));
......
......@@ -97,9 +97,9 @@ TEST(TraceEventArgumentTest, LongStrings) {
}
TEST(TraceEventArgumentTest, PassBaseValue) {
FundamentalValue int_value(42);
FundamentalValue bool_value(true);
FundamentalValue double_value(42.0f);
Value int_value(42);
Value bool_value(true);
Value double_value(42.0f);
auto dict_value = WrapUnique(new DictionaryValue);
dict_value->SetBoolean("bool", true);
......
......@@ -353,14 +353,12 @@ Value* Value::DeepCopy() const {
case Type::NONE:
return CreateNullValue().release();
// For now, make FundamentalValues for backward-compatibility. Convert to
// Value when that code is deleted.
case Type::BOOLEAN:
return new FundamentalValue(bool_value_);
return new Value(bool_value_);
case Type::INTEGER:
return new FundamentalValue(int_value_);
return new Value(int_value_);
case Type::DOUBLE:
return new FundamentalValue(double_value_);
return new Value(double_value_);
// For now, make StringValues for backward-compatibility. Convert to
// Value when that code is deleted.
case Type::STRING:
......@@ -673,15 +671,15 @@ void DictionaryValue::Set(StringPiece path, Value* in_value) {
}
void DictionaryValue::SetBoolean(StringPiece path, bool in_value) {
Set(path, new FundamentalValue(in_value));
Set(path, new Value(in_value));
}
void DictionaryValue::SetInteger(StringPiece path, int in_value) {
Set(path, new FundamentalValue(in_value));
Set(path, new Value(in_value));
}
void DictionaryValue::SetDouble(StringPiece path, double in_value) {
Set(path, new FundamentalValue(in_value));
Set(path, new Value(in_value));
}
void DictionaryValue::SetString(StringPiece path, StringPiece in_value) {
......@@ -704,20 +702,17 @@ void DictionaryValue::SetWithoutPathExpansion(StringPiece key,
void DictionaryValue::SetBooleanWithoutPathExpansion(StringPiece path,
bool in_value) {
SetWithoutPathExpansion(path,
base::MakeUnique<base::FundamentalValue>(in_value));
SetWithoutPathExpansion(path, base::MakeUnique<base::Value>(in_value));
}
void DictionaryValue::SetIntegerWithoutPathExpansion(StringPiece path,
int in_value) {
SetWithoutPathExpansion(path,
base::MakeUnique<base::FundamentalValue>(in_value));
SetWithoutPathExpansion(path, base::MakeUnique<base::Value>(in_value));
}
void DictionaryValue::SetDoubleWithoutPathExpansion(StringPiece path,
double in_value) {
SetWithoutPathExpansion(path,
base::MakeUnique<base::FundamentalValue>(in_value));
SetWithoutPathExpansion(path, base::MakeUnique<base::Value>(in_value));
}
void DictionaryValue::SetStringWithoutPathExpansion(StringPiece path,
......@@ -1274,15 +1269,15 @@ void ListValue::Append(Value* in_value) {
#endif
void ListValue::AppendBoolean(bool in_value) {
Append(MakeUnique<FundamentalValue>(in_value));
Append(MakeUnique<Value>(in_value));
}
void ListValue::AppendInteger(int in_value) {
Append(MakeUnique<FundamentalValue>(in_value));
Append(MakeUnique<Value>(in_value));
}
void ListValue::AppendDouble(double in_value) {
Append(MakeUnique<FundamentalValue>(in_value));
Append(MakeUnique<Value>(in_value));
}
void ListValue::AppendString(StringPiece in_value) {
......
......@@ -39,7 +39,6 @@ namespace base {
class DictionaryValue;
class ListValue;
class Value;
using FundamentalValue = Value;
using StringValue = Value;
using BinaryValue = Value;
......
This diff is collapsed.
......@@ -195,7 +195,7 @@ TEST_F(SearchGeolocationServiceTest, UseDSEGeolocationSetting) {
// False if the content setting is enterprise ask.
profile()->GetTestingPrefService()->SetManagedPref(
prefs::kManagedDefaultGeolocationSetting,
new base::FundamentalValue(CONTENT_SETTING_ASK));
new base::Value(CONTENT_SETTING_ASK));
EXPECT_FALSE(GetService()->UseDSEGeolocationSetting(ToOrigin(kGoogleURL)));
}
......@@ -245,7 +245,7 @@ TEST_F(SearchGeolocationServiceTest, SetDSEGeolocationSetting) {
GetService()->SetDSEGeolocationSetting(true);
profile()->GetTestingPrefService()->SetManagedPref(
prefs::kManagedDefaultGeolocationSetting,
new base::FundamentalValue(CONTENT_SETTING_ASK));
new base::Value(CONTENT_SETTING_ASK));
EXPECT_TRUE(GetService()->GetDSEGeolocationSetting());
GetService()->SetDSEGeolocationSetting(false);
EXPECT_TRUE(GetService()->GetDSEGeolocationSetting());
......
......@@ -673,8 +673,8 @@ class ArcSessionOobeOptInNegotiatorTest
profile());
connector->OverrideIsManagedForTesting(true);
profile()->GetTestingPrefService()->SetManagedPref(
prefs::kArcEnabled, new base::FundamentalValue(true));
profile()->GetTestingPrefService()->SetManagedPref(prefs::kArcEnabled,
new base::Value(true));
}
arc_session_manager()->SetProfile(profile());
......
......@@ -220,7 +220,7 @@ TEST_F(ArcPolicyBridgeTest, DisableScreenshotsTest) {
policy_map().Set(policy::key::kDisableScreenshots,
policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER,
policy::POLICY_SOURCE_CLOUD,
base::MakeUnique<base::FundamentalValue>(true), nullptr);
base::MakeUnique<base::Value>(true), nullptr);
policy_bridge()->GetPolicies(
PolicyStringCallback("{\"screenCaptureDisabled\":true}"));
}
......@@ -229,7 +229,7 @@ TEST_F(ArcPolicyBridgeTest, VideoCaptureAllowedTest) {
policy_map().Set(policy::key::kVideoCaptureAllowed,
policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER,
policy::POLICY_SOURCE_CLOUD,
base::MakeUnique<base::FundamentalValue>(false), nullptr);
base::MakeUnique<base::Value>(false), nullptr);
policy_bridge()->GetPolicies(
PolicyStringCallback("{\"cameraDisabled\":true}"));
}
......@@ -238,7 +238,7 @@ TEST_F(ArcPolicyBridgeTest, AudioCaptureAllowedTest) {
policy_map().Set(policy::key::kAudioCaptureAllowed,
policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER,
policy::POLICY_SOURCE_CLOUD,
base::MakeUnique<base::FundamentalValue>(false), nullptr);
base::MakeUnique<base::Value>(false), nullptr);
policy_bridge()->GetPolicies(
PolicyStringCallback("{\"unmuteMicrophoneDisabled\":true}"));
}
......@@ -247,19 +247,19 @@ TEST_F(ArcPolicyBridgeTest, DefaultGeolocationSettingTest) {
policy_map().Set(policy::key::kDefaultGeolocationSetting,
policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER,
policy::POLICY_SOURCE_CLOUD,
base::MakeUnique<base::FundamentalValue>(1), nullptr);
base::MakeUnique<base::Value>(1), nullptr);
policy_bridge()->GetPolicies(
PolicyStringCallback("{\"shareLocationDisabled\":false}"));
policy_map().Set(policy::key::kDefaultGeolocationSetting,
policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER,
policy::POLICY_SOURCE_CLOUD,
base::MakeUnique<base::FundamentalValue>(2), nullptr);
base::MakeUnique<base::Value>(2), nullptr);
policy_bridge()->GetPolicies(
PolicyStringCallback("{\"shareLocationDisabled\":true}"));
policy_map().Set(policy::key::kDefaultGeolocationSetting,
policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER,
policy::POLICY_SOURCE_CLOUD,
base::MakeUnique<base::FundamentalValue>(3), nullptr);
base::MakeUnique<base::Value>(3), nullptr);
policy_bridge()->GetPolicies(
PolicyStringCallback("{\"shareLocationDisabled\":false}"));
}
......@@ -268,7 +268,7 @@ TEST_F(ArcPolicyBridgeTest, ExternalStorageDisabledTest) {
policy_map().Set(policy::key::kExternalStorageDisabled,
policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER,
policy::POLICY_SOURCE_CLOUD,
base::MakeUnique<base::FundamentalValue>(true), nullptr);
base::MakeUnique<base::Value>(true), nullptr);
policy_bridge()->GetPolicies(
PolicyStringCallback("{\"mountPhysicalMediaDisabled\":true}"));
}
......@@ -329,8 +329,7 @@ TEST_F(ArcPolicyBridgeTest, CaCertificateTest) {
policy_map().Set(
policy::key::kArcCertificatesSyncMode, policy::POLICY_LEVEL_MANDATORY,
policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD,
base::MakeUnique<base::FundamentalValue>(ArcCertsSyncMode::COPY_CA_CERTS),
nullptr);
base::MakeUnique<base::Value>(ArcCertsSyncMode::COPY_CA_CERTS), nullptr);
policy_map().Set(policy::key::kOpenNetworkConfiguration,
policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER,
policy::POLICY_SOURCE_CLOUD,
......@@ -349,8 +348,7 @@ TEST_F(ArcPolicyBridgeTest, CaCertificateTest) {
policy_map().Set(
policy::key::kArcCertificatesSyncMode, policy::POLICY_LEVEL_MANDATORY,
policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD,
base::MakeUnique<base::FundamentalValue>(ArcCertsSyncMode::SYNC_DISABLED),
nullptr);
base::MakeUnique<base::Value>(ArcCertsSyncMode::SYNC_DISABLED), nullptr);
policy_bridge()->GetPolicies(PolicyStringCallback("{}"));
}
......@@ -358,7 +356,7 @@ TEST_F(ArcPolicyBridgeTest, DeveloperToolsDisabledTest) {
policy_map().Set(policy::key::kDeveloperToolsDisabled,
policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER,
policy::POLICY_SOURCE_CLOUD,
base::MakeUnique<base::FundamentalValue>(true), nullptr);
base::MakeUnique<base::Value>(true), nullptr);
policy_bridge()->GetPolicies(
PolicyStringCallback("{\"debuggingFeaturesDisabled\":true}"));
}
......@@ -383,7 +381,7 @@ TEST_F(ArcPolicyBridgeTest, MultiplePoliciesTest) {
policy_map().Set(policy::key::kVideoCaptureAllowed,
policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER,
policy::POLICY_SOURCE_CLOUD,
base::MakeUnique<base::FundamentalValue>(false), nullptr);
base::MakeUnique<base::Value>(false), nullptr);
policy_bridge()->GetPolicies(PolicyStringCallback(
"{\"applications\":"
"[{\"installType\":\"REQUIRED\","
......
......@@ -156,8 +156,8 @@ class DisplayPreferencesTest : public ash::test::AshTestBase {
void StoreDisplayBoolPropertyForList(const display::DisplayIdList& list,
const std::string& key,
bool value) {
StoreDisplayPropertyForList(
list, key, base::MakeUnique<base::FundamentalValue>(value));
StoreDisplayPropertyForList(list, key,
base::MakeUnique<base::Value>(value));
}
void StoreDisplayLayoutPrefForList(const display::DisplayIdList& list,
......
......@@ -327,7 +327,7 @@ void PostNotificationCallbackTaskToUIThread(
void FileWatchFunctionBase::Respond(bool success) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
SetResult(base::MakeUnique<base::FundamentalValue>(success));
SetResult(base::MakeUnique<base::Value>(success));
SendResponse(success);
}
......@@ -567,7 +567,7 @@ bool FileManagerPrivateInternalValidatePathNameLengthFunction::RunAsync() {
// No explicit limit on the length of Drive file names.
if (file_system_url.type() == storage::kFileSystemTypeDrive) {
SetResult(base::MakeUnique<base::FundamentalValue>(true));
SetResult(base::MakeUnique<base::Value>(true));
SendResponse(true);
return true;
}
......@@ -585,8 +585,7 @@ bool FileManagerPrivateInternalValidatePathNameLengthFunction::RunAsync() {
void FileManagerPrivateInternalValidatePathNameLengthFunction::
OnFilePathLimitRetrieved(size_t current_length, size_t max_length) {
SetResult(
base::MakeUnique<base::FundamentalValue>(current_length <= max_length));
SetResult(base::MakeUnique<base::Value>(current_length <= max_length));
SendResponse(true);
}
......@@ -746,7 +745,7 @@ void FileManagerPrivateInternalStartCopyFunction::RunAfterStartCopy(
int operation_id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
SetResult(base::MakeUnique<base::FundamentalValue>(operation_id));
SetResult(base::MakeUnique<base::Value>(operation_id));
SendResponse(true);
}
......@@ -954,7 +953,7 @@ void FileManagerPrivateSearchFilesByHashesFunction::OnSearchByHashes(
ExtensionFunction::ResponseAction
FileManagerPrivateIsUMAEnabledFunction::Run() {
return RespondNow(OneArgument(base::MakeUnique<base::FundamentalValue>(
return RespondNow(OneArgument(base::MakeUnique<base::Value>(
ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled())));
}
......@@ -1052,8 +1051,7 @@ bool FileManagerPrivateInternalGetDirectorySizeFunction::RunAsync() {
void FileManagerPrivateInternalGetDirectorySizeFunction::
OnDirectorySizeRetrieved(int64_t size) {
SetResult(
base::MakeUnique<base::FundamentalValue>(static_cast<double>(size)));
SetResult(base::MakeUnique<base::Value>(static_cast<double>(size)));
SendResponse(true);
}
......
......@@ -284,7 +284,7 @@ bool FileManagerPrivateInternalZipSelectionFunction::RunAsync() {
}
void FileManagerPrivateInternalZipSelectionFunction::OnZipDone(bool success) {
SetResult(base::MakeUnique<base::FundamentalValue>(success));
SetResult(base::MakeUnique<base::Value>(success));
SendResponse(true);
}
......@@ -473,11 +473,9 @@ void FileManagerPrivateInternalGetMimeTypeFunction::OnGetMimeType(
ExtensionFunction::ResponseAction
FileManagerPrivateIsPiexLoaderEnabledFunction::Run() {
#if defined(OFFICIAL_BUILD)
return RespondNow(
OneArgument(base::MakeUnique<base::FundamentalValue>(true)));
return RespondNow(OneArgument(base::MakeUnique<base::Value>(true)));
#else
return RespondNow(
OneArgument(base::MakeUnique<base::FundamentalValue>(false)));
return RespondNow(OneArgument(base::MakeUnique<base::Value>(false)));
#endif
}
......
......@@ -239,8 +239,7 @@ FileManagerPrivateInternalSetDefaultTaskFunction::Run() {
// TODO(gspencer): Fix file manager so that it never tries to set default in
// cases where extensionless local files are part of the selection.
if (suffixes.empty() && mime_types.empty()) {
return RespondNow(
OneArgument(base::MakeUnique<base::FundamentalValue>(true)));
return RespondNow(OneArgument(base::MakeUnique<base::Value>(true)));
}
file_manager::file_tasks::UpdateDefaultTask(
......
......@@ -257,7 +257,7 @@ base::Value* ChromeosInfoPrivateGetFunction::GetValue(
}
if (property_name == kPropertyOwner) {
return new base::FundamentalValue(
return new base::Value(
user_manager::UserManager::Get()->IsCurrentUserOwner());
}
......@@ -303,7 +303,7 @@ base::Value* ChromeosInfoPrivateGetFunction::GetValue(
const char* pref_name = GetBoolPrefNameForApiProperty(property_name.c_str());
if (pref_name) {
return new base::FundamentalValue(
return new base::Value(
Profile::FromBrowserContext(context_)->GetPrefs()->GetBoolean(
pref_name));
}
......
......@@ -217,8 +217,8 @@ InputMethodPrivateGetEncryptSyncEnabledFunction::Run() {
Profile::FromBrowserContext(browser_context()));
if (!profile_sync_service)
return RespondNow(Error("Sync service is not ready for current profile."));
std::unique_ptr<base::Value> ret(new base::FundamentalValue(
profile_sync_service->IsEncryptEverythingEnabled()));
std::unique_ptr<base::Value> ret(
new base::Value(profile_sync_service->IsEncryptEverythingEnabled()));
return RespondNow(OneArgument(std::move(ret)));
#endif
}
......
......@@ -128,15 +128,13 @@ UsersPrivateAddWhitelistedUserFunction::Run() {
// Non-owners should not be able to add users.
if (!chromeos::ProfileHelper::IsOwnerProfile(chrome_details_.GetProfile())) {
return RespondNow(
OneArgument(base::MakeUnique<base::FundamentalValue>(false)));
return RespondNow(OneArgument(base::MakeUnique<base::Value>(false)));
}
std::string username = gaia::CanonicalizeEmail(parameters->email);
if (chromeos::CrosSettings::Get()->FindEmailInList(
chromeos::kAccountsPrefUsers, username, NULL)) {
return RespondNow(
OneArgument(base::MakeUnique<base::FundamentalValue>(false)));
return RespondNow(OneArgument(base::MakeUnique<base::Value>(false)));
}
base::StringValue username_value(username);
......@@ -146,8 +144,7 @@ UsersPrivateAddWhitelistedUserFunction::Run() {
PrefsUtil* prefs_util = delegate->GetPrefsUtil();
bool added = prefs_util->AppendToListCrosSetting(chromeos::kAccountsPrefUsers,
username_value);
return RespondNow(
OneArgument(base::MakeUnique<base::FundamentalValue>(added)));
return RespondNow(OneArgument(base::MakeUnique<base::Value>(added)));
}
////////////////////////////////////////////////////////////////////////////////
......@@ -171,8 +168,7 @@ UsersPrivateRemoveWhitelistedUserFunction::Run() {
// Non-owners should not be able to remove users.
if (!chromeos::ProfileHelper::IsOwnerProfile(chrome_details_.GetProfile())) {
return RespondNow(
OneArgument(base::MakeUnique<base::FundamentalValue>(false)));
return RespondNow(OneArgument(base::MakeUnique<base::Value>(false)));
}
base::StringValue canonical_email(gaia::CanonicalizeEmail(parameters->email));
......@@ -184,8 +180,7 @@ UsersPrivateRemoveWhitelistedUserFunction::Run() {
chromeos::kAccountsPrefUsers, canonical_email);
user_manager::UserManager::Get()->RemoveUser(
AccountId::FromUserEmail(parameters->email), NULL);
return RespondNow(
OneArgument(base::MakeUnique<base::FundamentalValue>(removed)));