The Blink Rename

This commit is contained in:
Aleksei Kuzmin 2017-06-16 23:42:33 +03:00
parent 3939359354
commit 7a4ca08a8d
32 changed files with 452 additions and 450 deletions

View file

@ -19,11 +19,11 @@ namespace atom {
namespace {
content::RenderView* GetCurrentRenderView() {
WebLocalFrame* frame = WebLocalFrame::frameForCurrentContext();
WebLocalFrame* frame = WebLocalFrame::FrameForCurrentContext();
if (!frame)
return nullptr;
WebView* view = frame->view();
WebView* view = frame->View();
if (!view)
return nullptr; // can happen during closing.

View file

@ -179,27 +179,27 @@ ui::KeyboardCode KeyboardCodeFromStr(const std::string& str, bool* shifted) {
int WebEventModifiersToEventFlags(int modifiers) {
int flags = 0;
if (modifiers & blink::WebInputEvent::ShiftKey)
if (modifiers & blink::WebInputEvent::kShiftKey)
flags |= ui::EF_SHIFT_DOWN;
if (modifiers & blink::WebInputEvent::ControlKey)
if (modifiers & blink::WebInputEvent::kControlKey)
flags |= ui::EF_CONTROL_DOWN;
if (modifiers & blink::WebInputEvent::AltKey)
if (modifiers & blink::WebInputEvent::kAltKey)
flags |= ui::EF_ALT_DOWN;
if (modifiers & blink::WebInputEvent::MetaKey)
if (modifiers & blink::WebInputEvent::kMetaKey)
flags |= ui::EF_COMMAND_DOWN;
if (modifiers & blink::WebInputEvent::CapsLockOn)
if (modifiers & blink::WebInputEvent::kCapsLockOn)
flags |= ui::EF_CAPS_LOCK_ON;
if (modifiers & blink::WebInputEvent::NumLockOn)
if (modifiers & blink::WebInputEvent::kNumLockOn)
flags |= ui::EF_NUM_LOCK_ON;
if (modifiers & blink::WebInputEvent::ScrollLockOn)
if (modifiers & blink::WebInputEvent::kScrollLockOn)
flags |= ui::EF_SCROLL_LOCK_ON;
if (modifiers & blink::WebInputEvent::LeftButtonDown)
if (modifiers & blink::WebInputEvent::kLeftButtonDown)
flags |= ui::EF_LEFT_MOUSE_BUTTON;
if (modifiers & blink::WebInputEvent::MiddleButtonDown)
if (modifiers & blink::WebInputEvent::kMiddleButtonDown)
flags |= ui::EF_MIDDLE_MOUSE_BUTTON;
if (modifiers & blink::WebInputEvent::RightButtonDown)
if (modifiers & blink::WebInputEvent::kRightButtonDown)
flags |= ui::EF_RIGHT_MOUSE_BUTTON;
if (modifiers & blink::WebInputEvent::IsAutoRepeat)
if (modifiers & blink::WebInputEvent::kIsAutoRepeat)
flags |= ui::EF_IS_REPEAT;
return flags;

View file

@ -11,50 +11,50 @@ namespace atom {
std::string CursorTypeToString(const content::WebCursor::CursorInfo& info) {
switch (info.type) {
case Cursor::TypePointer: return "default";
case Cursor::TypeCross: return "crosshair";
case Cursor::TypeHand: return "pointer";
case Cursor::TypeIBeam: return "text";
case Cursor::TypeWait: return "wait";
case Cursor::TypeHelp: return "help";
case Cursor::TypeEastResize: return "e-resize";
case Cursor::TypeNorthResize: return "n-resize";
case Cursor::TypeNorthEastResize: return "ne-resize";
case Cursor::TypeNorthWestResize: return "nw-resize";
case Cursor::TypeSouthResize: return "s-resize";
case Cursor::TypeSouthEastResize: return "se-resize";
case Cursor::TypeSouthWestResize: return "sw-resize";
case Cursor::TypeWestResize: return "w-resize";
case Cursor::TypeNorthSouthResize: return "ns-resize";
case Cursor::TypeEastWestResize: return "ew-resize";
case Cursor::TypeNorthEastSouthWestResize: return "nesw-resize";
case Cursor::TypeNorthWestSouthEastResize: return "nwse-resize";
case Cursor::TypeColumnResize: return "col-resize";
case Cursor::TypeRowResize: return "row-resize";
case Cursor::TypeMiddlePanning: return "m-panning";
case Cursor::TypeEastPanning: return "e-panning";
case Cursor::TypeNorthPanning: return "n-panning";
case Cursor::TypeNorthEastPanning: return "ne-panning";
case Cursor::TypeNorthWestPanning: return "nw-panning";
case Cursor::TypeSouthPanning: return "s-panning";
case Cursor::TypeSouthEastPanning: return "se-panning";
case Cursor::TypeSouthWestPanning: return "sw-panning";
case Cursor::TypeWestPanning: return "w-panning";
case Cursor::TypeMove: return "move";
case Cursor::TypeVerticalText: return "vertical-text";
case Cursor::TypeCell: return "cell";
case Cursor::TypeContextMenu: return "context-menu";
case Cursor::TypeAlias: return "alias";
case Cursor::TypeProgress: return "progress";
case Cursor::TypeNoDrop: return "nodrop";
case Cursor::TypeCopy: return "copy";
case Cursor::TypeNone: return "none";
case Cursor::TypeNotAllowed: return "not-allowed";
case Cursor::TypeZoomIn: return "zoom-in";
case Cursor::TypeZoomOut: return "zoom-out";
case Cursor::TypeGrab: return "grab";
case Cursor::TypeGrabbing: return "grabbing";
case Cursor::TypeCustom: return "custom";
case Cursor::kTypePointer: return "default";
case Cursor::kTypeCross: return "crosshair";
case Cursor::kTypeHand: return "pointer";
case Cursor::kTypeIBeam: return "text";
case Cursor::kTypeWait: return "wait";
case Cursor::kTypeHelp: return "help";
case Cursor::kTypeEastResize: return "e-resize";
case Cursor::kTypeNorthResize: return "n-resize";
case Cursor::kTypeNorthEastResize: return "ne-resize";
case Cursor::kTypeNorthWestResize: return "nw-resize";
case Cursor::kTypeSouthResize: return "s-resize";
case Cursor::kTypeSouthEastResize: return "se-resize";
case Cursor::kTypeSouthWestResize: return "sw-resize";
case Cursor::kTypeWestResize: return "w-resize";
case Cursor::kTypeNorthSouthResize: return "ns-resize";
case Cursor::kTypeEastWestResize: return "ew-resize";
case Cursor::kTypeNorthEastSouthWestResize: return "nesw-resize";
case Cursor::kTypeNorthWestSouthEastResize: return "nwse-resize";
case Cursor::kTypeColumnResize: return "col-resize";
case Cursor::kTypeRowResize: return "row-resize";
case Cursor::kTypeMiddlePanning: return "m-panning";
case Cursor::kTypeEastPanning: return "e-panning";
case Cursor::kTypeNorthPanning: return "n-panning";
case Cursor::kTypeNorthEastPanning: return "ne-panning";
case Cursor::kTypeNorthWestPanning: return "nw-panning";
case Cursor::kTypeSouthPanning: return "s-panning";
case Cursor::kTypeSouthEastPanning: return "se-panning";
case Cursor::kTypeSouthWestPanning: return "sw-panning";
case Cursor::kTypeWestPanning: return "w-panning";
case Cursor::kTypeMove: return "move";
case Cursor::kTypeVerticalText: return "vertical-text";
case Cursor::kTypeCell: return "cell";
case Cursor::kTypeContextMenu: return "context-menu";
case Cursor::kTypeAlias: return "alias";
case Cursor::kTypeProgress: return "progress";
case Cursor::kTypeNoDrop: return "nodrop";
case Cursor::kTypeCopy: return "copy";
case Cursor::kTypeNone: return "none";
case Cursor::kTypeNotAllowed: return "not-allowed";
case Cursor::kTypeZoomIn: return "zoom-in";
case Cursor::kTypeZoomOut: return "zoom-out";
case Cursor::kTypeGrab: return "grab";
case Cursor::kTypeGrabbing: return "grabbing";
case Cursor::kTypeCustom: return "custom";
default: return "default";
}
}

View file

@ -54,33 +54,33 @@ struct Converter<blink::WebInputEvent::Type> {
blink::WebInputEvent::Type* out) {
std::string type = base::ToLowerASCII(V8ToString(val));
if (type == "mousedown")
*out = blink::WebInputEvent::MouseDown;
*out = blink::WebInputEvent::kMouseDown;
else if (type == "mouseup")
*out = blink::WebInputEvent::MouseUp;
*out = blink::WebInputEvent::kMouseUp;
else if (type == "mousemove")
*out = blink::WebInputEvent::MouseMove;
*out = blink::WebInputEvent::kMouseMove;
else if (type == "mouseenter")
*out = blink::WebInputEvent::MouseEnter;
*out = blink::WebInputEvent::kMouseEnter;
else if (type == "mouseleave")
*out = blink::WebInputEvent::MouseLeave;
*out = blink::WebInputEvent::kMouseLeave;
else if (type == "contextmenu")
*out = blink::WebInputEvent::ContextMenu;
*out = blink::WebInputEvent::kContextMenu;
else if (type == "mousewheel")
*out = blink::WebInputEvent::MouseWheel;
*out = blink::WebInputEvent::kMouseWheel;
else if (type == "keydown")
*out = blink::WebInputEvent::RawKeyDown;
*out = blink::WebInputEvent::kRawKeyDown;
else if (type == "keyup")
*out = blink::WebInputEvent::KeyUp;
*out = blink::WebInputEvent::kKeyUp;
else if (type == "char")
*out = blink::WebInputEvent::Char;
*out = blink::WebInputEvent::kChar;
else if (type == "touchstart")
*out = blink::WebInputEvent::TouchStart;
*out = blink::WebInputEvent::kTouchStart;
else if (type == "touchmove")
*out = blink::WebInputEvent::TouchMove;
*out = blink::WebInputEvent::kTouchMove;
else if (type == "touchend")
*out = blink::WebInputEvent::TouchEnd;
*out = blink::WebInputEvent::kTouchEnd;
else if (type == "touchcancel")
*out = blink::WebInputEvent::TouchCancel;
*out = blink::WebInputEvent::kTouchCancel;
return true;
}
};
@ -91,11 +91,11 @@ struct Converter<blink::WebMouseEvent::Button> {
blink::WebMouseEvent::Button* out) {
std::string button = base::ToLowerASCII(V8ToString(val));
if (button == "left")
*out = blink::WebMouseEvent::Button::Left;
*out = blink::WebMouseEvent::Button::kLeft;
else if (button == "middle")
*out = blink::WebMouseEvent::Button::Middle;
*out = blink::WebMouseEvent::Button::kMiddle;
else if (button == "right")
*out = blink::WebMouseEvent::Button::Right;
*out = blink::WebMouseEvent::Button::kRight;
else
return false;
return true;
@ -108,37 +108,37 @@ struct Converter<blink::WebInputEvent::Modifiers> {
blink::WebInputEvent::Modifiers* out) {
std::string modifier = base::ToLowerASCII(V8ToString(val));
if (modifier == "shift")
*out = blink::WebInputEvent::ShiftKey;
*out = blink::WebInputEvent::kShiftKey;
else if (modifier == "control" || modifier == "ctrl")
*out = blink::WebInputEvent::ControlKey;
*out = blink::WebInputEvent::kControlKey;
else if (modifier == "alt")
*out = blink::WebInputEvent::AltKey;
*out = blink::WebInputEvent::kAltKey;
else if (modifier == "meta" || modifier == "command" || modifier == "cmd")
*out = blink::WebInputEvent::MetaKey;
*out = blink::WebInputEvent::kMetaKey;
else if (modifier == "iskeypad")
*out = blink::WebInputEvent::IsKeyPad;
*out = blink::WebInputEvent::kIsKeyPad;
else if (modifier == "isautorepeat")
*out = blink::WebInputEvent::IsAutoRepeat;
*out = blink::WebInputEvent::kIsAutoRepeat;
else if (modifier == "leftbuttondown")
*out = blink::WebInputEvent::LeftButtonDown;
*out = blink::WebInputEvent::kLeftButtonDown;
else if (modifier == "middlebuttondown")
*out = blink::WebInputEvent::MiddleButtonDown;
*out = blink::WebInputEvent::kMiddleButtonDown;
else if (modifier == "rightbuttondown")
*out = blink::WebInputEvent::RightButtonDown;
*out = blink::WebInputEvent::kRightButtonDown;
else if (modifier == "capslock")
*out = blink::WebInputEvent::CapsLockOn;
*out = blink::WebInputEvent::kCapsLockOn;
else if (modifier == "numlock")
*out = blink::WebInputEvent::NumLockOn;
*out = blink::WebInputEvent::kNumLockOn;
else if (modifier == "left")
*out = blink::WebInputEvent::IsLeft;
*out = blink::WebInputEvent::kIsLeft;
else if (modifier == "right")
*out = blink::WebInputEvent::IsRight;
*out = blink::WebInputEvent::kIsRight;
return true;
}
};
int GetWebInputEventType(v8::Isolate* isolate, v8::Local<v8::Value> val) {
blink::WebInputEvent::Type type = blink::WebInputEvent::Undefined;
blink::WebInputEvent::Type type = blink::WebInputEvent::kUndefined;
mate::Dictionary dict;
ConvertFromV8(isolate, val, &dict) && dict.Get("type", &type);
return type;
@ -153,11 +153,11 @@ bool Converter<blink::WebInputEvent>::FromV8(
blink::WebInputEvent::Type type;
if (!dict.Get("type", &type))
return false;
out->setType(type);
out->SetType(type);
std::vector<blink::WebInputEvent::Modifiers> modifiers;
if (dict.Get("modifiers", &modifiers))
out->setModifiers(VectorToBitArray(modifiers));
out->setTimeStampSeconds(base::Time::Now().ToDoubleT());
out->SetModifiers(VectorToBitArray(modifiers));
out->SetTimeStampSeconds(base::Time::Now().ToDoubleT());
return true;
}
@ -176,31 +176,31 @@ bool Converter<blink::WebKeyboardEvent>::FromV8(
bool shifted = false;
ui::KeyboardCode keyCode = atom::KeyboardCodeFromStr(str, &shifted);
out->windowsKeyCode = keyCode;
out->windows_key_code = keyCode;
if (shifted)
out->setModifiers(out->modifiers() | blink::WebInputEvent::ShiftKey);
out->SetModifiers(out->GetModifiers() | blink::WebInputEvent::kShiftKey);
ui::DomCode domCode = ui::UsLayoutKeyboardCodeToDomCode(keyCode);
out->domCode = static_cast<int>(domCode);
out->dom_code = static_cast<int>(domCode);
ui::DomKey domKey;
ui::KeyboardCode dummy_code;
int flags = atom::WebEventModifiersToEventFlags(out->modifiers());
int flags = atom::WebEventModifiersToEventFlags(out->GetModifiers());
if (ui::DomCodeToUsLayoutDomKey(domCode, flags, &domKey, &dummy_code))
out->domKey = static_cast<int>(domKey);
out->dom_key = static_cast<int>(domKey);
if ((out->type() == blink::WebInputEvent::Char ||
out->type() == blink::WebInputEvent::RawKeyDown)) {
if ((out->GetType() == blink::WebInputEvent::kChar ||
out->GetType() == blink::WebInputEvent::kRawKeyDown)) {
// Make sure to not read beyond the buffer in case some bad code doesn't
// NULL-terminate it (this is called from plugins).
size_t text_length_cap = blink::WebKeyboardEvent::textLengthCap;
size_t text_length_cap = blink::WebKeyboardEvent::kTextLengthCap;
base::string16 text16 = base::UTF8ToUTF16(str);
memset(out->text, 0, text_length_cap);
memset(out->unmodifiedText, 0, text_length_cap);
memset(out->unmodified_text, 0, text_length_cap);
for (size_t i = 0; i < std::min(text_length_cap, text16.size()); ++i) {
out->text[i] = text16[i];
out->unmodifiedText[i] = text16[i];
out->unmodified_text[i] = text16[i];
}
}
return true;
@ -222,20 +222,20 @@ v8::Local<v8::Value> Converter<content::NativeWebKeyboardEvent>::ToV8(
v8::Isolate* isolate, const content::NativeWebKeyboardEvent& in) {
mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate);
if (in.type() == blink::WebInputEvent::Type::RawKeyDown)
if (in.GetType() == blink::WebInputEvent::Type::kRawKeyDown)
dict.Set("type", "keyDown");
else if (in.type() == blink::WebInputEvent::Type::KeyUp)
else if (in.GetType() == blink::WebInputEvent::Type::kKeyUp)
dict.Set("type", "keyUp");
dict.Set("key", ui::KeycodeConverter::DomKeyToKeyString(in.domKey));
dict.Set("key", ui::KeycodeConverter::DomKeyToKeyString(in.dom_key));
dict.Set("code", ui::KeycodeConverter::DomCodeToCodeString(
static_cast<ui::DomCode>(in.domCode)));
static_cast<ui::DomCode>(in.dom_code)));
using Modifiers = blink::WebInputEvent::Modifiers;
dict.Set("isAutoRepeat", (in.modifiers() & Modifiers::IsAutoRepeat) != 0);
dict.Set("shift", (in.modifiers() & Modifiers::ShiftKey) != 0);
dict.Set("control", (in.modifiers() & Modifiers::ControlKey) != 0);
dict.Set("alt", (in.modifiers() & Modifiers::AltKey) != 0);
dict.Set("meta", (in.modifiers() & Modifiers::MetaKey) != 0);
dict.Set("isAutoRepeat", (in.GetModifiers() & Modifiers::kIsAutoRepeat) != 0);
dict.Set("shift", (in.GetModifiers() & Modifiers::kShiftKey) != 0);
dict.Set("control", (in.GetModifiers() & Modifiers::kControlKey) != 0);
dict.Set("alt", (in.GetModifiers() & Modifiers::kAltKey) != 0);
dict.Set("meta", (in.GetModifiers() & Modifiers::kMetaKey) != 0);
return dict.GetHandle();
}
@ -250,12 +250,12 @@ bool Converter<blink::WebMouseEvent>::FromV8(
if (!dict.Get("x", &out->x) || !dict.Get("y", &out->y))
return false;
if (!dict.Get("button", &out->button))
out->button = blink::WebMouseEvent::Button::Left;
out->button = blink::WebMouseEvent::Button::kLeft;
dict.Get("globalX", &out->globalX);
dict.Get("globalY", &out->globalY);
dict.Get("movementX", &out->movementX);
dict.Get("movementY", &out->movementY);
dict.Get("clickCount", &out->clickCount);
dict.Get("movementX", &out->movement_x);
dict.Get("movementY", &out->movement_y);
dict.Get("clickCount", &out->click_count);
return true;
}
@ -267,20 +267,20 @@ bool Converter<blink::WebMouseWheelEvent>::FromV8(
return false;
if (!ConvertFromV8(isolate, val, static_cast<blink::WebMouseEvent*>(out)))
return false;
dict.Get("deltaX", &out->deltaX);
dict.Get("deltaY", &out->deltaY);
dict.Get("wheelTicksX", &out->wheelTicksX);
dict.Get("wheelTicksY", &out->wheelTicksY);
dict.Get("accelerationRatioX", &out->accelerationRatioX);
dict.Get("accelerationRatioY", &out->accelerationRatioY);
dict.Get("hasPreciseScrollingDeltas", &out->hasPreciseScrollingDeltas);
dict.Get("deltaX", &out->delta_x);
dict.Get("deltaY", &out->delta_y);
dict.Get("wheelTicksX", &out->wheel_ticks_x);
dict.Get("wheelTicksY", &out->wheel_ticks_y);
dict.Get("accelerationRatioX", &out->acceleration_ratio_x);
dict.Get("accelerationRatioY", &out->acceleration_ratio_y);
dict.Get("hasPreciseScrollingDeltas", &out->has_precise_scrolling_deltas);
#if defined(USE_AURA)
// Matches the behavior of ui/events/blink/web_input_event_traits.cc:
bool can_scroll = true;
if (dict.Get("canScroll", &can_scroll) && !can_scroll) {
out->hasPreciseScrollingDeltas = false;
out->setModifiers(out->modifiers() & ~blink::WebInputEvent::ControlKey);
out->has_precise_scrolling_deltas = false;
out->setModifiers(out->GetModifiers() & ~blink::WebInputEvent::ControlKey);
}
#endif
return true;
@ -321,18 +321,18 @@ bool Converter<blink::WebDeviceEmulationParams>::FromV8(
if (dict.Get("screenPosition", &screen_position)) {
screen_position = base::ToLowerASCII(screen_position);
if (screen_position == "mobile")
out->screenPosition = blink::WebDeviceEmulationParams::Mobile;
out->screen_position = blink::WebDeviceEmulationParams::kMobile;
else if (screen_position == "desktop")
out->screenPosition = blink::WebDeviceEmulationParams::Desktop;
out->screen_position = blink::WebDeviceEmulationParams::kDesktop;
else
return false;
}
dict.Get("screenSize", &out->screenSize);
dict.Get("viewPosition", &out->viewPosition);
dict.Get("deviceScaleFactor", &out->deviceScaleFactor);
dict.Get("viewSize", &out->viewSize);
dict.Get("fitToView", &out->fitToView);
dict.Get("screenSize", &out->screen_size);
dict.Get("viewPosition", &out->view_position);
dict.Get("deviceScaleFactor", &out->device_scale_factor);
dict.Get("viewSize", &out->view_size);
dict.Get("fitToView", &out->fit_to_view);
dict.Get("offset", &out->offset);
dict.Get("scale", &out->scale);
return true;
@ -347,10 +347,10 @@ bool Converter<blink::WebFindOptions>::FromV8(
return false;
dict.Get("forward", &out->forward);
dict.Get("matchCase", &out->matchCase);
dict.Get("findNext", &out->findNext);
dict.Get("wordStart", &out->wordStart);
dict.Get("medialCapitalAsWordStart", &out->medialCapitalAsWordStart);
dict.Get("matchCase", &out->match_case);
dict.Get("findNext", &out->find_next);
dict.Get("wordStart", &out->word_start);
dict.Get("medialCapitalAsWordStart", &out->medial_capital_as_word_start);
return true;
}
@ -358,17 +358,17 @@ bool Converter<blink::WebFindOptions>::FromV8(
v8::Local<v8::Value> Converter<blink::WebContextMenuData::MediaType>::ToV8(
v8::Isolate* isolate, const blink::WebContextMenuData::MediaType& in) {
switch (in) {
case blink::WebContextMenuData::MediaTypeImage:
case blink::WebContextMenuData::kMediaTypeImage:
return mate::StringToV8(isolate, "image");
case blink::WebContextMenuData::MediaTypeVideo:
case blink::WebContextMenuData::kMediaTypeVideo:
return mate::StringToV8(isolate, "video");
case blink::WebContextMenuData::MediaTypeAudio:
case blink::WebContextMenuData::kMediaTypeAudio:
return mate::StringToV8(isolate, "audio");
case blink::WebContextMenuData::MediaTypeCanvas:
case blink::WebContextMenuData::kMediaTypeCanvas:
return mate::StringToV8(isolate, "canvas");
case blink::WebContextMenuData::MediaTypeFile:
case blink::WebContextMenuData::kMediaTypeFile:
return mate::StringToV8(isolate, "file");
case blink::WebContextMenuData::MediaTypePlugin:
case blink::WebContextMenuData::kMediaTypePlugin:
return mate::StringToV8(isolate, "plugin");
default:
return mate::StringToV8(isolate, "none");
@ -380,11 +380,11 @@ v8::Local<v8::Value> Converter<blink::WebContextMenuData::InputFieldType>::ToV8(
v8::Isolate* isolate,
const blink::WebContextMenuData::InputFieldType& in) {
switch (in) {
case blink::WebContextMenuData::InputFieldTypePlainText:
case blink::WebContextMenuData::kInputFieldTypePlainText:
return mate::StringToV8(isolate, "plainText");
case blink::WebContextMenuData::InputFieldTypePassword:
case blink::WebContextMenuData::kInputFieldTypePassword:
return mate::StringToV8(isolate, "password");
case blink::WebContextMenuData::InputFieldTypeOther:
case blink::WebContextMenuData::kInputFieldTypeOther:
return mate::StringToV8(isolate, "other");
default:
return mate::StringToV8(isolate, "none");
@ -394,16 +394,16 @@ v8::Local<v8::Value> Converter<blink::WebContextMenuData::InputFieldType>::ToV8(
v8::Local<v8::Value> EditFlagsToV8(v8::Isolate* isolate, int editFlags) {
mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate);
dict.Set("canUndo",
!!(editFlags & blink::WebContextMenuData::CanUndo));
!!(editFlags & blink::WebContextMenuData::kCanUndo));
dict.Set("canRedo",
!!(editFlags & blink::WebContextMenuData::CanRedo));
!!(editFlags & blink::WebContextMenuData::kCanRedo));
dict.Set("canCut",
!!(editFlags & blink::WebContextMenuData::CanCut));
!!(editFlags & blink::WebContextMenuData::kCanCut));
dict.Set("canCopy",
!!(editFlags & blink::WebContextMenuData::CanCopy));
!!(editFlags & blink::WebContextMenuData::kCanCopy));
bool pasteFlag = false;
if (editFlags & blink::WebContextMenuData::CanPaste) {
if (editFlags & blink::WebContextMenuData::kCanPaste) {
std::vector<base::string16> types;
bool ignore;
ui::Clipboard::GetForCurrentThread()->ReadAvailableTypes(
@ -413,9 +413,9 @@ v8::Local<v8::Value> EditFlagsToV8(v8::Isolate* isolate, int editFlags) {
dict.Set("canPaste", pasteFlag);
dict.Set("canDelete",
!!(editFlags & blink::WebContextMenuData::CanDelete));
!!(editFlags & blink::WebContextMenuData::kCanDelete));
dict.Set("canSelectAll",
!!(editFlags & blink::WebContextMenuData::CanSelectAll));
!!(editFlags & blink::WebContextMenuData::kCanSelectAll));
return mate::ConvertToV8(isolate, dict);
}
@ -423,21 +423,21 @@ v8::Local<v8::Value> EditFlagsToV8(v8::Isolate* isolate, int editFlags) {
v8::Local<v8::Value> MediaFlagsToV8(v8::Isolate* isolate, int mediaFlags) {
mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate);
dict.Set("inError",
!!(mediaFlags & blink::WebContextMenuData::MediaInError));
!!(mediaFlags & blink::WebContextMenuData::kMediaInError));
dict.Set("isPaused",
!!(mediaFlags & blink::WebContextMenuData::MediaPaused));
!!(mediaFlags & blink::WebContextMenuData::kMediaPaused));
dict.Set("isMuted",
!!(mediaFlags & blink::WebContextMenuData::MediaMuted));
!!(mediaFlags & blink::WebContextMenuData::kMediaMuted));
dict.Set("hasAudio",
!!(mediaFlags & blink::WebContextMenuData::MediaHasAudio));
!!(mediaFlags & blink::WebContextMenuData::kMediaHasAudio));
dict.Set("isLooping",
(mediaFlags & blink::WebContextMenuData::MediaLoop) != 0);
(mediaFlags & blink::WebContextMenuData::kMediaLoop) != 0);
dict.Set("isControlsVisible",
(mediaFlags & blink::WebContextMenuData::MediaControls) != 0);
(mediaFlags & blink::WebContextMenuData::kMediaControls) != 0);
dict.Set("canToggleControls",
!!(mediaFlags & blink::WebContextMenuData::MediaCanToggleControls));
!!(mediaFlags & blink::WebContextMenuData::kMediaCanToggleControls));
dict.Set("canRotate",
!!(mediaFlags & blink::WebContextMenuData::MediaCanRotate));
!!(mediaFlags & blink::WebContextMenuData::kMediaCanRotate));
return mate::ConvertToV8(isolate, dict);
}
@ -447,7 +447,7 @@ v8::Local<v8::Value> Converter<blink::WebCache::ResourceTypeStat>::ToV8(
mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate);
dict.Set("count", static_cast<uint32_t>(stat.count));
dict.Set("size", static_cast<double>(stat.size));
dict.Set("liveSize", static_cast<double>(stat.decodedSize));
dict.Set("liveSize", static_cast<double>(stat.decoded_size));
return dict.GetHandle();
}
@ -457,8 +457,8 @@ v8::Local<v8::Value> Converter<blink::WebCache::ResourceTypeStats>::ToV8(
mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate);
dict.Set("images", stats.images);
dict.Set("scripts", stats.scripts);
dict.Set("cssStyleSheets", stats.cssStyleSheets);
dict.Set("xslStyleSheets", stats.xslStyleSheets);
dict.Set("cssStyleSheets", stats.css_style_sheets);
dict.Set("xslStyleSheets", stats.xsl_style_sheets);
dict.Set("fonts", stats.fonts);
dict.Set("other", stats.other);
return dict.GetHandle();

View file

@ -109,7 +109,7 @@ v8::Local<v8::Value> Converter<ContextMenuParamsWithWebContents>::ToV8(
dict.Set("mediaType", params.media_type);
dict.Set("mediaFlags", MediaFlagsToV8(isolate, params.media_flags));
bool has_image_contents =
(params.media_type == blink::WebContextMenuData::MediaTypeImage) &&
(params.media_type == blink::WebContextMenuData::kMediaTypeImage) &&
params.has_image_contents;
dict.Set("hasImageContents", has_image_contents);
dict.Set("isEditable", params.is_editable);