Use generic base::Value::SetKey
Remove base::Value::SetDoubleWithoutPathExpansion https://chromium-review.googlesource.com/591654 Remove base::Value::SetStringWithoutPathExpansion https://chromium-review.googlesource.com/592368 Remove base::Value::SetIntegerWithoutPathExpansion https://chromium-review.googlesource.com/591655
This commit is contained in:
parent
8250dbd172
commit
75c17cf846
4 changed files with 9 additions and 11 deletions
|
@ -87,18 +87,17 @@ std::unique_ptr<base::DictionaryValue> NSDictionaryToDictionaryValue(
|
||||||
|
|
||||||
id value = [dict objectForKey:key];
|
id value = [dict objectForKey:key];
|
||||||
if ([value isKindOfClass:[NSString class]]) {
|
if ([value isKindOfClass:[NSString class]]) {
|
||||||
result->SetStringWithoutPathExpansion(
|
result->SetKey(str_key, base::Value(base::SysNSStringToUTF8(value)));
|
||||||
str_key, base::SysNSStringToUTF8(value));
|
|
||||||
} else if ([value isKindOfClass:[NSNumber class]]) {
|
} else if ([value isKindOfClass:[NSNumber class]]) {
|
||||||
const char* objc_type = [value objCType];
|
const char* objc_type = [value objCType];
|
||||||
if (strcmp(objc_type, @encode(BOOL)) == 0 ||
|
if (strcmp(objc_type, @encode(BOOL)) == 0 ||
|
||||||
strcmp(objc_type, @encode(char)) == 0)
|
strcmp(objc_type, @encode(char)) == 0)
|
||||||
result->SetBooleanWithoutPathExpansion(str_key, [value boolValue]);
|
result->SetKey(str_key, base::Value([value boolValue]));
|
||||||
else if (strcmp(objc_type, @encode(double)) == 0 ||
|
else if (strcmp(objc_type, @encode(double)) == 0 ||
|
||||||
strcmp(objc_type, @encode(float)) == 0)
|
strcmp(objc_type, @encode(float)) == 0)
|
||||||
result->SetDoubleWithoutPathExpansion(str_key, [value doubleValue]);
|
result->SetKey(str_key, base::Value([value doubleValue]));
|
||||||
else
|
else
|
||||||
result->SetIntegerWithoutPathExpansion(str_key, [value intValue]);
|
result->SetKey(str_key, base::Value([value intValue]));
|
||||||
} else if ([value isKindOfClass:[NSArray class]]) {
|
} else if ([value isKindOfClass:[NSArray class]]) {
|
||||||
std::unique_ptr<base::ListValue> sub_arr = NSArrayToListValue(value);
|
std::unique_ptr<base::ListValue> sub_arr = NSArrayToListValue(value);
|
||||||
if (sub_arr)
|
if (sub_arr)
|
||||||
|
@ -115,9 +114,8 @@ std::unique_ptr<base::DictionaryValue> NSDictionaryToDictionaryValue(
|
||||||
result->SetWithoutPathExpansion(str_key,
|
result->SetWithoutPathExpansion(str_key,
|
||||||
base::MakeUnique<base::Value>());
|
base::MakeUnique<base::Value>());
|
||||||
} else {
|
} else {
|
||||||
result->SetStringWithoutPathExpansion(
|
result->SetKey(str_key,
|
||||||
str_key,
|
base::Value(base::SysNSStringToUTF8([value description])));
|
||||||
base::SysNSStringToUTF8([value description]));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,7 @@ void ToDictionary(base::DictionaryValue* details,
|
||||||
std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
|
std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
|
||||||
net::HttpRequestHeaders::Iterator it(headers);
|
net::HttpRequestHeaders::Iterator it(headers);
|
||||||
while (it.GetNext())
|
while (it.GetNext())
|
||||||
dict->SetStringWithoutPathExpansion(it.name(), it.value());
|
dict->SetKey(it.name(), base::Value(it.value()));
|
||||||
details->Set("requestHeaders", std::move(dict));
|
details->Set("requestHeaders", std::move(dict));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -608,7 +608,7 @@ void InspectableWebContentsImpl::GetPreferences(
|
||||||
void InspectableWebContentsImpl::SetPreference(const std::string& name,
|
void InspectableWebContentsImpl::SetPreference(const std::string& name,
|
||||||
const std::string& value) {
|
const std::string& value) {
|
||||||
DictionaryPrefUpdate update(pref_service_, kDevToolsPreferences);
|
DictionaryPrefUpdate update(pref_service_, kDevToolsPreferences);
|
||||||
update.Get()->SetStringWithoutPathExpansion(name, value);
|
update.Get()->SetKey(name, base::Value(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InspectableWebContentsImpl::RemovePreference(const std::string& name) {
|
void InspectableWebContentsImpl::RemovePreference(const std::string& name) {
|
||||||
|
|
|
@ -95,7 +95,7 @@ void ZoomLevelDelegate::OnZoomLevelChanged(
|
||||||
if (modification_is_removal)
|
if (modification_is_removal)
|
||||||
host_zoom_dictionary->RemoveWithoutPathExpansion(change.host, nullptr);
|
host_zoom_dictionary->RemoveWithoutPathExpansion(change.host, nullptr);
|
||||||
else
|
else
|
||||||
host_zoom_dictionary->SetDoubleWithoutPathExpansion(change.host, level);
|
host_zoom_dictionary->SetKey(change.host, base::Value(level));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoomLevelDelegate::ExtractPerHostZoomLevels(
|
void ZoomLevelDelegate::ExtractPerHostZoomLevels(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue