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());
// Set inspected tabID.
base::FundamentalValue tab_id(ID());
base::Value tab_id(ID());
managed_web_contents()->CallClientFunction(
"DevToolsAPI.setInspectedTabId", &tab_id, nullptr, nullptr);

View file

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

View file

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

View file

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

View file

@ -59,11 +59,11 @@ void AskForOptions(v8::Isolate* isolate,
}
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);
if (dict->GetInteger("error", error))
return true;
} else if (value->IsType(base::Value::TYPE_INTEGER)) {
} else if (value->IsType(base::Value::Type::INTEGER)) {
if (value->GetAsInteger(error))
return true;
}

View file

@ -18,10 +18,10 @@ URLRequestAsyncAsarJob::URLRequestAsyncAsarJob(
void URLRequestAsyncAsarJob::StartAsync(std::unique_ptr<base::Value> options) {
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(
"path", &file_path);
} else if (options->IsType(base::Value::TYPE_STRING)) {
} else if (options->IsType(base::Value::Type::STRING)) {
options->GetAsString(&file_path);
}

View file

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

View file

@ -112,7 +112,7 @@ void URLRequestFetchJob::BeforeStartInUI(
}
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(
net::URLRequestStatus::FAILED, net::ERR_NOT_IMPLEMENTED));
return;

View file

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

View file

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

View file

@ -73,7 +73,7 @@ void GenerateAcceleratorTable(AcceleratorTable* table,
int count = model->GetItemCount();
for (int i = 0; i < count; ++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);
GenerateAcceleratorTable(table, submodel);
} else {

View file

@ -87,7 +87,7 @@ Role kRolesMap[] = {
const int count = model->GetItemCount();
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];
else
[self addItemToMenu:menu_ atIndex:index fromModel:model];
@ -109,7 +109,7 @@ Role kRolesMap[] = {
const int count = model->GetItemCount();
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];
else
[self addItemToMenu:menu atIndex:index fromModel:model];
@ -145,7 +145,7 @@ Role kRolesMap[] = {
[item setImage:icon.ToNSImage()];
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.
[item setTarget:nil];
[item setAction:nil];

View file

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

View file

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

View file

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

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 {