Fix API changes of base::Value

This commit is contained in:
Cheng Zhao 2017-04-05 17:34:53 +09:00
parent 9d1b88ed59
commit 50e3bfa764
21 changed files with 55 additions and 55 deletions

View file

@ -181,7 +181,7 @@ bool Archive::Init() {
std::string error;
base::JSONReader reader;
std::unique_ptr<base::Value> value(reader.ReadToValue(header));
if (!value || !value->IsType(base::Value::TYPE::DICTIONARY)) {
if (!value || !value->IsType(base::Value::Type::DICTIONARY)) {
LOG(ERROR) << "Failed to parse header: " << error;
return false;
}

View file

@ -6,7 +6,7 @@
#define ATOM_COMMON_NATIVE_MATE_CONVERTERS_BLINK_CONVERTER_H_
#include "native_mate/converter.h"
#include "third_party/WebKit/public/web/WebCache.h"
#include "third_party/WebKit/public/platform/WebCache.h"
#include "third_party/WebKit/public/web/WebContextMenuData.h"
namespace blink {

View file

@ -213,13 +213,13 @@ Converter<scoped_refptr<ResourceRequestBodyImpl>>::ToV8(
std::unique_ptr<base::DictionaryValue> post_data_dict(
new base::DictionaryValue);
auto type = element.type();
if (type == ResourceRequestBodyImpl::Element::TYPE_BYTES) {
if (type == ResourceRequestBodyImpl::Element::Type::BYTES) {
std::unique_ptr<base::Value> bytes(
base::BinaryValue::CreateWithCopiedBuffer(
element.bytes(), static_cast<size_t>(element.length())));
post_data_dict->SetString("type", "rawData");
post_data_dict->Set("bytes", std::move(bytes));
} else if (type == ResourceRequestBodyImpl::Element::TYPE_FILE) {
} else if (type == ResourceRequestBodyImpl::Element::Type::FILE) {
post_data_dict->SetString("type", "file");
post_data_dict->SetStringWithoutPathExpansion(
"filePath", element.path().AsUTF8Unsafe());
@ -227,7 +227,7 @@ Converter<scoped_refptr<ResourceRequestBodyImpl>>::ToV8(
post_data_dict->SetInteger("length", static_cast<int>(element.length()));
post_data_dict->SetDouble(
"modificationTime", element.expected_modification_time().ToDoubleT());
} else if (type == ResourceRequestBodyImpl::Element::TYPE_FILE_FILESYSTEM) {
} else if (type == ResourceRequestBodyImpl::Element::Type::FILE_FILESYSTEM) {
post_data_dict->SetString("type", "fileSystem");
post_data_dict->SetStringWithoutPathExpansion(
"fileSystemURL", element.filesystem_url().spec());
@ -235,7 +235,7 @@ Converter<scoped_refptr<ResourceRequestBodyImpl>>::ToV8(
post_data_dict->SetInteger("length", static_cast<int>(element.length()));
post_data_dict->SetDouble(
"modificationTime", element.expected_modification_time().ToDoubleT());
} else if (type == ResourceRequestBodyImpl::Element::TYPE_BLOB) {
} else if (type == ResourceRequestBodyImpl::Element::Type::BLOB) {
post_data_dict->SetString("type", "blob");
post_data_dict->SetString("blobUUID", element.blob_uuid());
}

View file

@ -167,42 +167,42 @@ base::Value* V8ValueConverter::FromV8Value(
v8::Local<v8::Value> V8ValueConverter::ToV8ValueImpl(
v8::Isolate* isolate, const base::Value* value) const {
switch (value->GetType()) {
case base::Value::TYPE_NULL:
case base::Value::Type::NULL:
return v8::Null(isolate);
case base::Value::TYPE_BOOLEAN: {
case base::Value::Type::BOOLEAN: {
bool val = false;
value->GetAsBoolean(&val);
return v8::Boolean::New(isolate, val);
}
case base::Value::TYPE_INTEGER: {
case base::Value::Type::INTEGER: {
int val = 0;
value->GetAsInteger(&val);
return v8::Integer::New(isolate, val);
}
case base::Value::TYPE_DOUBLE: {
case base::Value::Type::DOUBLE: {
double val = 0.0;
value->GetAsDouble(&val);
return v8::Number::New(isolate, val);
}
case base::Value::TYPE_STRING: {
case base::Value::Type::STRING: {
std::string val;
value->GetAsString(&val);
return v8::String::NewFromUtf8(
isolate, val.c_str(), v8::String::kNormalString, val.length());
}
case base::Value::TYPE_LIST:
case base::Value::Type::LIST:
return ToV8Array(isolate, static_cast<const base::ListValue*>(value));
case base::Value::TYPE::DICTIONARY:
case base::Value::Type::DICTIONARY:
return ToV8Object(isolate,
static_cast<const base::DictionaryValue*>(value));
case base::Value::TYPE_BINARY:
case base::Value::Type::BINARY:
return ToArrayBuffer(isolate,
static_cast<const base::BinaryValue*>(value));
@ -314,13 +314,13 @@ base::Value* V8ValueConverter::FromV8ValueImpl(
return base::Value::CreateNullValue().release();
if (val->IsBoolean())
return new base::FundamentalValue(val->ToBoolean()->Value());
return new base::Value(val->ToBoolean()->Value());
if (val->IsInt32())
return new base::FundamentalValue(val->ToInt32()->Value());
return new base::Value(val->ToInt32()->Value());
if (val->IsNumber())
return new base::FundamentalValue(val->ToNumber()->Value());
return new base::Value(val->ToNumber()->Value());
if (val->IsString()) {
v8::String::Utf8Value utf8(val->ToString());
@ -490,7 +490,7 @@ base::Value* V8ValueConverter::FromV8Object(
// there *is* a "windowId" property, but since it should be an int, code
// on the browser which doesn't additionally check for null will fail.
// We can avoid all bugs related to this by stripping null.
if (strip_null_from_objects_ && child->IsType(base::Value::TYPE_NULL))
if (strip_null_from_objects_ && child->IsType(base::Value::Type::NULL))
continue;
result->SetWithoutPathExpansion(std::string(*name_utf8, name_utf8.length()),

View file

@ -10,10 +10,10 @@
#include "v8/include/v8.h"
namespace base {
class BinaryValue;
class DictionaryValue;
class ListValue;
class Value;
using BinaryValue = Value;
}
namespace atom {

View file

@ -15,7 +15,7 @@ bool Converter<base::DictionaryValue>::FromV8(v8::Isolate* isolate,
std::unique_ptr<atom::V8ValueConverter> converter(new atom::V8ValueConverter);
std::unique_ptr<base::Value> value(converter->FromV8Value(
val, isolate->GetCurrentContext()));
if (value && value->IsType(base::Value::TYPE::DICTIONARY)) {
if (value && value->IsType(base::Value::Type::DICTIONARY)) {
out->Swap(static_cast<base::DictionaryValue*>(value.get()));
return true;
} else {
@ -36,7 +36,7 @@ bool Converter<base::ListValue>::FromV8(v8::Isolate* isolate,
std::unique_ptr<atom::V8ValueConverter> converter(new atom::V8ValueConverter);
std::unique_ptr<base::Value> value(converter->FromV8Value(
val, isolate->GetCurrentContext()));
if (value->IsType(base::Value::TYPE_LIST)) {
if (value->IsType(base::Value::Type::LIST)) {
out->Swap(static_cast<base::ListValue*>(value.get()));
return true;
} else {