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

@ -877,7 +877,7 @@ void WebContents::DevToolsOpened() {
devtools_web_contents_.Reset(isolate(), handle.ToV8()); devtools_web_contents_.Reset(isolate(), handle.ToV8());
// Set inspected tabID. // Set inspected tabID.
base::FundamentalValue tab_id(ID()); base::Value tab_id(ID());
managed_web_contents()->CallClientFunction( managed_web_contents()->CallClientFunction(
"DevToolsAPI.setInspectedTabId", &tab_id, nullptr, nullptr); "DevToolsAPI.setInspectedTabId", &tab_id, nullptr, nullptr);

View file

@ -489,9 +489,9 @@ void CommonWebContentsDelegate::OnDevToolsIndexingWorkCalculated(
int request_id, int request_id,
const std::string& file_system_path, const std::string& file_system_path,
int total_work) { int total_work) {
base::FundamentalValue request_id_value(request_id); base::Value request_id_value(request_id);
base::StringValue file_system_path_value(file_system_path); base::StringValue file_system_path_value(file_system_path);
base::FundamentalValue total_work_value(total_work); base::Value total_work_value(total_work);
web_contents_->CallClientFunction("DevToolsAPI.indexingTotalWorkCalculated", web_contents_->CallClientFunction("DevToolsAPI.indexingTotalWorkCalculated",
&request_id_value, &request_id_value,
&file_system_path_value, &file_system_path_value,
@ -502,9 +502,9 @@ void CommonWebContentsDelegate::OnDevToolsIndexingWorked(
int request_id, int request_id,
const std::string& file_system_path, const std::string& file_system_path,
int worked) { int worked) {
base::FundamentalValue request_id_value(request_id); base::Value request_id_value(request_id);
base::StringValue file_system_path_value(file_system_path); base::StringValue file_system_path_value(file_system_path);
base::FundamentalValue worked_value(worked); base::Value worked_value(worked);
web_contents_->CallClientFunction("DevToolsAPI.indexingWorked", web_contents_->CallClientFunction("DevToolsAPI.indexingWorked",
&request_id_value, &request_id_value,
&file_system_path_value, &file_system_path_value,
@ -515,7 +515,7 @@ void CommonWebContentsDelegate::OnDevToolsIndexingDone(
int request_id, int request_id,
const std::string& file_system_path) { const std::string& file_system_path) {
devtools_indexing_jobs_.erase(request_id); devtools_indexing_jobs_.erase(request_id);
base::FundamentalValue request_id_value(request_id); base::Value request_id_value(request_id);
base::StringValue file_system_path_value(file_system_path); base::StringValue file_system_path_value(file_system_path);
web_contents_->CallClientFunction("DevToolsAPI.indexingDone", web_contents_->CallClientFunction("DevToolsAPI.indexingDone",
&request_id_value, &request_id_value,
@ -531,7 +531,7 @@ void CommonWebContentsDelegate::OnDevToolsSearchCompleted(
for (const auto& file_path : file_paths) { for (const auto& file_path : file_paths) {
file_paths_value.AppendString(file_path); file_paths_value.AppendString(file_path);
} }
base::FundamentalValue request_id_value(request_id); base::Value request_id_value(request_id);
base::StringValue file_system_path_value(file_system_path); base::StringValue file_system_path_value(file_system_path);
web_contents_->CallClientFunction("DevToolsAPI.searchCompleted", web_contents_->CallClientFunction("DevToolsAPI.searchCompleted",
&request_id_value, &request_id_value,

View file

@ -187,7 +187,7 @@ NativeWindowViews::NativeWindowViews(
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
params.bounds = bounds; params.bounds = bounds;
params.delegate = this; params.delegate = this;
params.type = views::Widget::InitParams::TYPE_WINDOW; params.type = views::Widget::InitParams::Type::WINDOW;
params.remove_standard_frame = !has_frame(); params.remove_standard_frame = !has_frame();
if (transparent()) if (transparent())

View file

@ -185,7 +185,7 @@ std::unique_ptr<net::SourceStream> URLRequestAsarJob::SetUpSourceStream() {
// Bug 9936 - .svgz files needs to be decompressed. // Bug 9936 - .svgz files needs to be decompressed.
return base::LowerCaseEqualsASCII(file_path_.Extension(), ".svgz") return base::LowerCaseEqualsASCII(file_path_.Extension(), ".svgz")
? net::GzipSourceStream::Create(std::move(source), ? net::GzipSourceStream::Create(std::move(source),
net::SourceStream::TYPE_GZIP) net::SourceStream::Type::GZIP)
: std::move(source); : std::move(source);
} }

View file

@ -59,11 +59,11 @@ void AskForOptions(v8::Isolate* isolate,
} }
bool IsErrorOptions(base::Value* value, int* error) { bool IsErrorOptions(base::Value* value, int* error) {
if (value->IsType(base::Value::TYPE::DICTIONARY)) { if (value->IsType(base::Value::Type::DICTIONARY)) {
base::DictionaryValue* dict = static_cast<base::DictionaryValue*>(value); base::DictionaryValue* dict = static_cast<base::DictionaryValue*>(value);
if (dict->GetInteger("error", error)) if (dict->GetInteger("error", error))
return true; return true;
} else if (value->IsType(base::Value::TYPE_INTEGER)) { } else if (value->IsType(base::Value::Type::INTEGER)) {
if (value->GetAsInteger(error)) if (value->GetAsInteger(error))
return true; return true;
} }

View file

@ -18,10 +18,10 @@ URLRequestAsyncAsarJob::URLRequestAsyncAsarJob(
void URLRequestAsyncAsarJob::StartAsync(std::unique_ptr<base::Value> options) { void URLRequestAsyncAsarJob::StartAsync(std::unique_ptr<base::Value> options) {
base::FilePath::StringType file_path; base::FilePath::StringType file_path;
if (options->IsType(base::Value::TYPE::DICTIONARY)) { if (options->IsType(base::Value::Type::DICTIONARY)) {
static_cast<base::DictionaryValue*>(options.get())->GetString( static_cast<base::DictionaryValue*>(options.get())->GetString(
"path", &file_path); "path", &file_path);
} else if (options->IsType(base::Value::TYPE_STRING)) { } else if (options->IsType(base::Value::Type::STRING)) {
options->GetAsString(&file_path); options->GetAsString(&file_path);
} }

View file

@ -34,13 +34,13 @@ URLRequestBufferJob::URLRequestBufferJob(
void URLRequestBufferJob::StartAsync(std::unique_ptr<base::Value> options) { void URLRequestBufferJob::StartAsync(std::unique_ptr<base::Value> options) {
const base::BinaryValue* binary = nullptr; const base::BinaryValue* binary = nullptr;
if (options->IsType(base::Value::TYPE::DICTIONARY)) { if (options->IsType(base::Value::Type::DICTIONARY)) {
base::DictionaryValue* dict = base::DictionaryValue* dict =
static_cast<base::DictionaryValue*>(options.get()); static_cast<base::DictionaryValue*>(options.get());
dict->GetString("mimeType", &mime_type_); dict->GetString("mimeType", &mime_type_);
dict->GetString("charset", &charset_); dict->GetString("charset", &charset_);
dict->GetBinary("data", &binary); dict->GetBinary("data", &binary);
} else if (options->IsType(base::Value::TYPE_BINARY)) { } else if (options->IsType(base::Value::Type::BINARY)) {
options->GetAsBinary(&binary); options->GetAsBinary(&binary);
} }

View file

@ -112,7 +112,7 @@ void URLRequestFetchJob::BeforeStartInUI(
} }
void URLRequestFetchJob::StartAsync(std::unique_ptr<base::Value> options) { void URLRequestFetchJob::StartAsync(std::unique_ptr<base::Value> options) {
if (!options->IsType(base::Value::TYPE::DICTIONARY)) { if (!options->IsType(base::Value::Type::DICTIONARY)) {
NotifyStartError(net::URLRequestStatus( NotifyStartError(net::URLRequestStatus(
net::URLRequestStatus::FAILED, net::ERR_NOT_IMPLEMENTED)); net::URLRequestStatus::FAILED, net::ERR_NOT_IMPLEMENTED));
return; return;

View file

@ -17,13 +17,13 @@ URLRequestStringJob::URLRequestStringJob(
} }
void URLRequestStringJob::StartAsync(std::unique_ptr<base::Value> options) { void URLRequestStringJob::StartAsync(std::unique_ptr<base::Value> options) {
if (options->IsType(base::Value::TYPE::DICTIONARY)) { if (options->IsType(base::Value::Type::DICTIONARY)) {
base::DictionaryValue* dict = base::DictionaryValue* dict =
static_cast<base::DictionaryValue*>(options.get()); static_cast<base::DictionaryValue*>(options.get());
dict->GetString("mimeType", &mime_type_); dict->GetString("mimeType", &mime_type_);
dict->GetString("charset", &charset_); dict->GetString("charset", &charset_);
dict->GetString("data", &data_); dict->GetString("data", &data_);
} else if (options->IsType(base::Value::TYPE_STRING)) { } else if (options->IsType(base::Value::Type::STRING)) {
options->GetAsString(&data_); options->GetAsString(&data_);
} }
net::URLRequestSimpleJob::Start(); net::URLRequestSimpleJob::Start();

View file

@ -58,7 +58,7 @@ NodeDebugger::NodeDebugger(v8::Isolate* isolate)
// Start a new IO thread. // Start a new IO thread.
base::Thread::Options options; base::Thread::Options options;
options.message_loop_type = base::MessageLoop::TYPE_IO; options.message_loop_type = base::MessageLoop::Type::IO;
if (!thread_.StartWithOptions(options)) { if (!thread_.StartWithOptions(options)) {
LOG(ERROR) << "Unable to start debugger thread"; LOG(ERROR) << "Unable to start debugger thread";
return; return;

View file

@ -73,7 +73,7 @@ void GenerateAcceleratorTable(AcceleratorTable* table,
int count = model->GetItemCount(); int count = model->GetItemCount();
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
atom::AtomMenuModel::ItemType type = model->GetTypeAt(i); atom::AtomMenuModel::ItemType type = model->GetTypeAt(i);
if (type == atom::AtomMenuModel::TYPE_SUBMENU) { if (type == atom::AtomMenuModel::Type::SUBMENU) {
auto submodel = model->GetSubmenuModelAt(i); auto submodel = model->GetSubmenuModelAt(i);
GenerateAcceleratorTable(table, submodel); GenerateAcceleratorTable(table, submodel);
} else { } else {

View file

@ -87,7 +87,7 @@ Role kRolesMap[] = {
const int count = model->GetItemCount(); const int count = model->GetItemCount();
for (int index = 0; index < count; index++) { for (int index = 0; index < count; index++) {
if (model->GetTypeAt(index) == atom::AtomMenuModel::TYPE_SEPARATOR) if (model->GetTypeAt(index) == atom::AtomMenuModel::Type::SEPARATOR)
[self addSeparatorToMenu:menu_ atIndex:index]; [self addSeparatorToMenu:menu_ atIndex:index];
else else
[self addItemToMenu:menu_ atIndex:index fromModel:model]; [self addItemToMenu:menu_ atIndex:index fromModel:model];
@ -109,7 +109,7 @@ Role kRolesMap[] = {
const int count = model->GetItemCount(); const int count = model->GetItemCount();
for (int index = 0; index < count; index++) { for (int index = 0; index < count; index++) {
if (model->GetTypeAt(index) == atom::AtomMenuModel::TYPE_SEPARATOR) if (model->GetTypeAt(index) == atom::AtomMenuModel::Type::SEPARATOR)
[self addSeparatorToMenu:menu atIndex:index]; [self addSeparatorToMenu:menu atIndex:index];
else else
[self addItemToMenu:menu atIndex:index fromModel:model]; [self addItemToMenu:menu atIndex:index fromModel:model];
@ -145,7 +145,7 @@ Role kRolesMap[] = {
[item setImage:icon.ToNSImage()]; [item setImage:icon.ToNSImage()];
atom::AtomMenuModel::ItemType type = model->GetTypeAt(index); atom::AtomMenuModel::ItemType type = model->GetTypeAt(index);
if (type == atom::AtomMenuModel::TYPE_SUBMENU) { if (type == atom::AtomMenuModel::Type::SUBMENU) {
// Recursively build a submenu from the sub-model at this index. // Recursively build a submenu from the sub-model at this index.
[item setTarget:nil]; [item setTarget:nil];
[item setAction:nil]; [item setAction:nil];

View file

@ -225,7 +225,7 @@ void GlobalMenuBarX11::BuildMenuFromModel(AtomMenuModel* model,
menuitem_property_set_bool(item, kPropertyVisible, model->IsVisibleAt(i)); menuitem_property_set_bool(item, kPropertyVisible, model->IsVisibleAt(i));
AtomMenuModel::ItemType type = model->GetTypeAt(i); AtomMenuModel::ItemType type = model->GetTypeAt(i);
if (type == AtomMenuModel::TYPE_SEPARATOR) { if (type == AtomMenuModel::Type::SEPARATOR) {
menuitem_property_set(item, kPropertyType, kTypeSeparator); menuitem_property_set(item, kPropertyType, kTypeSeparator);
} else { } else {
std::string label = ui::ConvertAcceleratorsFromWindowsStyle( std::string label = ui::ConvertAcceleratorsFromWindowsStyle(
@ -236,7 +236,7 @@ void GlobalMenuBarX11::BuildMenuFromModel(AtomMenuModel* model,
g_object_set_data(G_OBJECT(item), "model", model); g_object_set_data(G_OBJECT(item), "model", model);
SetMenuItemID(item, i); SetMenuItemID(item, i);
if (type == AtomMenuModel::TYPE_SUBMENU) { if (type == AtomMenuModel::Type::SUBMENU) {
menuitem_property_set(item, kPropertyChildrenDisplay, kDisplaySubmenu); menuitem_property_set(item, kPropertyChildrenDisplay, kDisplaySubmenu);
g_signal_connect(item, "about-to-show", g_signal_connect(item, "about-to-show",
G_CALLBACK(OnSubMenuShowThunk), this); G_CALLBACK(OnSubMenuShowThunk), this);
@ -248,10 +248,10 @@ void GlobalMenuBarX11::BuildMenuFromModel(AtomMenuModel* model,
g_signal_connect(item, "item-activated", g_signal_connect(item, "item-activated",
G_CALLBACK(OnItemActivatedThunk), this); G_CALLBACK(OnItemActivatedThunk), this);
if (type == AtomMenuModel::TYPE_CHECK || if (type == AtomMenuModel::Type::CHECK ||
type == AtomMenuModel::TYPE_RADIO) { type == AtomMenuModel::Type::RADIO) {
menuitem_property_set(item, kPropertyToggleType, menuitem_property_set(item, kPropertyToggleType,
type == AtomMenuModel::TYPE_CHECK ? kToggleCheck : kToggleRadio); type == AtomMenuModel::Type::CHECK ? kToggleCheck : kToggleRadio);
menuitem_property_set_int(item, kPropertyToggleState, menuitem_property_set_int(item, kPropertyToggleState,
model->IsItemCheckedAt(i)); model->IsItemCheckedAt(i));
} }

View file

@ -120,7 +120,7 @@ bool MenuBar::GetMenuButtonFromScreenPoint(const gfx::Point& point,
for (int i = 0; i < child_count(); ++i) { for (int i = 0; i < child_count(); ++i) {
views::View* view = child_at(i); views::View* view = child_at(i);
if (view->bounds().Contains(location) && if (view->bounds().Contains(location) &&
(menu_model_->GetTypeAt(i) == AtomMenuModel::TYPE_SUBMENU)) { (menu_model_->GetTypeAt(i) == AtomMenuModel::Type::SUBMENU)) {
*menu_model = menu_model_->GetSubmenuModelAt(i); *menu_model = menu_model_->GetSubmenuModelAt(i);
*button = static_cast<views::MenuButton*>(view); *button = static_cast<views::MenuButton*>(view);
return true; return true;
@ -148,7 +148,7 @@ void MenuBar::OnMenuButtonClicked(views::MenuButton* source,
int id = source->tag(); int id = source->tag();
AtomMenuModel::ItemType type = menu_model_->GetTypeAt(id); AtomMenuModel::ItemType type = menu_model_->GetTypeAt(id);
if (type != AtomMenuModel::TYPE_SUBMENU) { if (type != AtomMenuModel::Type::SUBMENU) {
menu_model_->ActivatedAt(id, 0); menu_model_->ActivatedAt(id, 0);
return; return;
} }

View file

@ -131,7 +131,7 @@ void PdfViewerHandler::GetDefaultZoom(const base::ListValue* args) {
double zoom_level = host_zoom_map->GetDefaultZoomLevel(); double zoom_level = host_zoom_map->GetDefaultZoomLevel();
ResolveJavascriptCallback( ResolveJavascriptCallback(
*callback_id, *callback_id,
base::FundamentalValue(content::ZoomLevelToZoomFactor(zoom_level))); base::Value(content::ZoomLevelToZoomFactor(zoom_level)));
} }
void PdfViewerHandler::GetInitialZoom(const base::ListValue* args) { void PdfViewerHandler::GetInitialZoom(const base::ListValue* args) {
@ -145,7 +145,7 @@ void PdfViewerHandler::GetInitialZoom(const base::ListValue* args) {
content::HostZoomMap::GetZoomLevel(web_ui()->GetWebContents()); content::HostZoomMap::GetZoomLevel(web_ui()->GetWebContents());
ResolveJavascriptCallback( ResolveJavascriptCallback(
*callback_id, *callback_id,
base::FundamentalValue(content::ZoomLevelToZoomFactor(zoom_level))); base::Value(content::ZoomLevelToZoomFactor(zoom_level)));
} }
void PdfViewerHandler::SetZoom(const base::ListValue* args) { void PdfViewerHandler::SetZoom(const base::ListValue* args) {
@ -159,7 +159,7 @@ void PdfViewerHandler::SetZoom(const base::ListValue* args) {
content::HostZoomMap::SetZoomLevel(web_ui()->GetWebContents(), content::HostZoomMap::SetZoomLevel(web_ui()->GetWebContents(),
zoom_level); zoom_level);
ResolveJavascriptCallback(*callback_id, base::FundamentalValue(zoom_level)); ResolveJavascriptCallback(*callback_id, base::Value(zoom_level));
} }
void PdfViewerHandler::GetStrings(const base::ListValue* args) { void PdfViewerHandler::GetStrings(const base::ListValue* args) {
@ -204,7 +204,7 @@ void PdfViewerHandler::OnZoomLevelChanged(
if (change.host == kPdfViewerUIHost) { if (change.host == kPdfViewerUIHost) {
CallJavascriptFunction( CallJavascriptFunction(
"cr.webUIListenerCallback", base::StringValue("onZoomLevelChanged"), "cr.webUIListenerCallback", base::StringValue("onZoomLevelChanged"),
base::FundamentalValue( base::Value(
content::ZoomLevelToZoomFactor(change.zoom_level))); content::ZoomLevelToZoomFactor(change.zoom_level)));
} }
} }

View file

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

View file

@ -6,7 +6,7 @@
#define ATOM_COMMON_NATIVE_MATE_CONVERTERS_BLINK_CONVERTER_H_ #define ATOM_COMMON_NATIVE_MATE_CONVERTERS_BLINK_CONVERTER_H_
#include "native_mate/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" #include "third_party/WebKit/public/web/WebContextMenuData.h"
namespace blink { namespace blink {

View file

@ -213,13 +213,13 @@ Converter<scoped_refptr<ResourceRequestBodyImpl>>::ToV8(
std::unique_ptr<base::DictionaryValue> post_data_dict( std::unique_ptr<base::DictionaryValue> post_data_dict(
new base::DictionaryValue); new base::DictionaryValue);
auto type = element.type(); auto type = element.type();
if (type == ResourceRequestBodyImpl::Element::TYPE_BYTES) { if (type == ResourceRequestBodyImpl::Element::Type::BYTES) {
std::unique_ptr<base::Value> bytes( std::unique_ptr<base::Value> bytes(
base::BinaryValue::CreateWithCopiedBuffer( base::BinaryValue::CreateWithCopiedBuffer(
element.bytes(), static_cast<size_t>(element.length()))); element.bytes(), static_cast<size_t>(element.length())));
post_data_dict->SetString("type", "rawData"); post_data_dict->SetString("type", "rawData");
post_data_dict->Set("bytes", std::move(bytes)); 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->SetString("type", "file");
post_data_dict->SetStringWithoutPathExpansion( post_data_dict->SetStringWithoutPathExpansion(
"filePath", element.path().AsUTF8Unsafe()); "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->SetInteger("length", static_cast<int>(element.length()));
post_data_dict->SetDouble( post_data_dict->SetDouble(
"modificationTime", element.expected_modification_time().ToDoubleT()); "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->SetString("type", "fileSystem");
post_data_dict->SetStringWithoutPathExpansion( post_data_dict->SetStringWithoutPathExpansion(
"fileSystemURL", element.filesystem_url().spec()); "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->SetInteger("length", static_cast<int>(element.length()));
post_data_dict->SetDouble( post_data_dict->SetDouble(
"modificationTime", element.expected_modification_time().ToDoubleT()); "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("type", "blob");
post_data_dict->SetString("blobUUID", element.blob_uuid()); 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::Local<v8::Value> V8ValueConverter::ToV8ValueImpl(
v8::Isolate* isolate, const base::Value* value) const { v8::Isolate* isolate, const base::Value* value) const {
switch (value->GetType()) { switch (value->GetType()) {
case base::Value::TYPE_NULL: case base::Value::Type::NULL:
return v8::Null(isolate); return v8::Null(isolate);
case base::Value::TYPE_BOOLEAN: { case base::Value::Type::BOOLEAN: {
bool val = false; bool val = false;
value->GetAsBoolean(&val); value->GetAsBoolean(&val);
return v8::Boolean::New(isolate, val); return v8::Boolean::New(isolate, val);
} }
case base::Value::TYPE_INTEGER: { case base::Value::Type::INTEGER: {
int val = 0; int val = 0;
value->GetAsInteger(&val); value->GetAsInteger(&val);
return v8::Integer::New(isolate, val); return v8::Integer::New(isolate, val);
} }
case base::Value::TYPE_DOUBLE: { case base::Value::Type::DOUBLE: {
double val = 0.0; double val = 0.0;
value->GetAsDouble(&val); value->GetAsDouble(&val);
return v8::Number::New(isolate, val); return v8::Number::New(isolate, val);
} }
case base::Value::TYPE_STRING: { case base::Value::Type::STRING: {
std::string val; std::string val;
value->GetAsString(&val); value->GetAsString(&val);
return v8::String::NewFromUtf8( return v8::String::NewFromUtf8(
isolate, val.c_str(), v8::String::kNormalString, val.length()); 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)); return ToV8Array(isolate, static_cast<const base::ListValue*>(value));
case base::Value::TYPE::DICTIONARY: case base::Value::Type::DICTIONARY:
return ToV8Object(isolate, return ToV8Object(isolate,
static_cast<const base::DictionaryValue*>(value)); static_cast<const base::DictionaryValue*>(value));
case base::Value::TYPE_BINARY: case base::Value::Type::BINARY:
return ToArrayBuffer(isolate, return ToArrayBuffer(isolate,
static_cast<const base::BinaryValue*>(value)); static_cast<const base::BinaryValue*>(value));
@ -314,13 +314,13 @@ base::Value* V8ValueConverter::FromV8ValueImpl(
return base::Value::CreateNullValue().release(); return base::Value::CreateNullValue().release();
if (val->IsBoolean()) if (val->IsBoolean())
return new base::FundamentalValue(val->ToBoolean()->Value()); return new base::Value(val->ToBoolean()->Value());
if (val->IsInt32()) if (val->IsInt32())
return new base::FundamentalValue(val->ToInt32()->Value()); return new base::Value(val->ToInt32()->Value());
if (val->IsNumber()) if (val->IsNumber())
return new base::FundamentalValue(val->ToNumber()->Value()); return new base::Value(val->ToNumber()->Value());
if (val->IsString()) { if (val->IsString()) {
v8::String::Utf8Value utf8(val->ToString()); 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 // 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. // on the browser which doesn't additionally check for null will fail.
// We can avoid all bugs related to this by stripping null. // 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; continue;
result->SetWithoutPathExpansion(std::string(*name_utf8, name_utf8.length()), result->SetWithoutPathExpansion(std::string(*name_utf8, name_utf8.length()),

View file

@ -10,10 +10,10 @@
#include "v8/include/v8.h" #include "v8/include/v8.h"
namespace base { namespace base {
class BinaryValue;
class DictionaryValue; class DictionaryValue;
class ListValue; class ListValue;
class Value; class Value;
using BinaryValue = Value;
} }
namespace atom { 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<atom::V8ValueConverter> converter(new atom::V8ValueConverter);
std::unique_ptr<base::Value> value(converter->FromV8Value( std::unique_ptr<base::Value> value(converter->FromV8Value(
val, isolate->GetCurrentContext())); 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())); out->Swap(static_cast<base::DictionaryValue*>(value.get()));
return true; return true;
} else { } 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<atom::V8ValueConverter> converter(new atom::V8ValueConverter);
std::unique_ptr<base::Value> value(converter->FromV8Value( std::unique_ptr<base::Value> value(converter->FromV8Value(
val, isolate->GetCurrentContext())); 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())); out->Swap(static_cast<base::ListValue*>(value.get()));
return true; return true;
} else { } else {