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

@ -590,8 +590,8 @@ bool WebContents::PreHandleKeyboardEvent(
content::WebContents* source, content::WebContents* source,
const content::NativeWebKeyboardEvent& event, const content::NativeWebKeyboardEvent& event,
bool* is_keyboard_shortcut) { bool* is_keyboard_shortcut) {
if (event.type() == blink::WebInputEvent::Type::RawKeyDown || if (event.GetType() == blink::WebInputEvent::Type::kRawKeyDown ||
event.type() == blink::WebInputEvent::Type::KeyUp) { event.GetType() == blink::WebInputEvent::Type::kKeyUp) {
return Emit("before-input-event", event); return Emit("before-input-event", event);
} else { } else {
return false; return false;
@ -818,7 +818,7 @@ void WebContents::DidFinishNavigation(
bool is_main_frame = navigation_handle->IsInMainFrame(); bool is_main_frame = navigation_handle->IsInMainFrame();
if (navigation_handle->HasCommitted() && !navigation_handle->IsErrorPage()) { if (navigation_handle->HasCommitted() && !navigation_handle->IsErrorPage()) {
auto url = navigation_handle->GetURL(); auto url = navigation_handle->GetURL();
bool is_in_page = navigation_handle->IsSamePage(); bool is_in_page = navigation_handle->IsSameDocument();
if (is_main_frame && !is_in_page) { if (is_main_frame && !is_in_page) {
Emit("did-navigate", url); Emit("did-navigate", url);
} else if (is_in_page) { } else if (is_in_page) {
@ -1002,7 +1002,7 @@ void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) {
GURL http_referrer; GURL http_referrer;
if (options.Get("httpReferrer", &http_referrer)) if (options.Get("httpReferrer", &http_referrer))
params.referrer = content::Referrer(http_referrer.GetAsReferrer(), params.referrer = content::Referrer(http_referrer.GetAsReferrer(),
blink::WebReferrerPolicyDefault); blink::kWebReferrerPolicyDefault);
std::string user_agent; std::string user_agent;
if (options.Get("userAgent", &user_agent)) if (options.Get("userAgent", &user_agent))
@ -1426,22 +1426,22 @@ void WebContents::SendInputEvent(v8::Isolate* isolate,
return; return;
int type = mate::GetWebInputEventType(isolate, input_event); int type = mate::GetWebInputEventType(isolate, input_event);
if (blink::WebInputEvent::isMouseEventType(type)) { if (blink::WebInputEvent::IsMouseEventType(type)) {
blink::WebMouseEvent mouse_event; blink::WebMouseEvent mouse_event;
if (mate::ConvertFromV8(isolate, input_event, &mouse_event)) { if (mate::ConvertFromV8(isolate, input_event, &mouse_event)) {
view->ProcessMouseEvent(mouse_event, ui::LatencyInfo()); view->ProcessMouseEvent(mouse_event, ui::LatencyInfo());
return; return;
} }
} else if (blink::WebInputEvent::isKeyboardEventType(type)) { } else if (blink::WebInputEvent::IsKeyboardEventType(type)) {
content::NativeWebKeyboardEvent keyboard_event( content::NativeWebKeyboardEvent keyboard_event(
blink::WebKeyboardEvent::RawKeyDown, blink::WebKeyboardEvent::kRawKeyDown,
blink::WebInputEvent::NoModifiers, blink::WebInputEvent::kNoModifiers,
ui::EventTimeForNow()); ui::EventTimeForNow());
if (mate::ConvertFromV8(isolate, input_event, &keyboard_event)) { if (mate::ConvertFromV8(isolate, input_event, &keyboard_event)) {
view->ProcessKeyboardEvent(keyboard_event); view->ProcessKeyboardEvent(keyboard_event);
return; return;
} }
} else if (type == blink::WebInputEvent::MouseWheel) { } else if (type == blink::WebInputEvent::kMouseWheel) {
blink::WebMouseWheelEvent mouse_wheel_event; blink::WebMouseWheelEvent mouse_wheel_event;
if (mate::ConvertFromV8(isolate, input_event, &mouse_wheel_event)) { if (mate::ConvertFromV8(isolate, input_event, &mouse_wheel_event)) {
view->ProcessMouseWheelEvent(mouse_wheel_event, ui::LatencyInfo()); view->ProcessMouseWheelEvent(mouse_wheel_event, ui::LatencyInfo());

View file

@ -20,11 +20,11 @@ void CommonWebContentsDelegate::HandleKeyboardEvent(
content::WebContents* source, content::WebContents* source,
const content::NativeWebKeyboardEvent& event) { const content::NativeWebKeyboardEvent& event) {
if (event.skip_in_browser || if (event.skip_in_browser ||
event.type() == content::NativeWebKeyboardEvent::Char) event.GetType() == content::NativeWebKeyboardEvent::kChar)
return; return;
// Escape exits tabbed fullscreen mode. // Escape exits tabbed fullscreen mode.
if (event.windowsKeyCode == ui::VKEY_ESCAPE && is_html_fullscreen()) if (event.windows_key_code == ui::VKEY_ESCAPE && is_html_fullscreen())
ExitFullscreenModeForTab(source); ExitFullscreenModeForTab(source);
if (!ignore_menu_shortcuts_) { if (!ignore_menu_shortcuts_) {

View file

@ -1604,10 +1604,10 @@ void NativeWindowMac::SetEscapeTouchBarItem(const mate::PersistentDictionary& it
} }
void NativeWindowMac::OnInputEvent(const blink::WebInputEvent& event) { void NativeWindowMac::OnInputEvent(const blink::WebInputEvent& event) {
switch (event.type()) { switch (event.GetType()) {
case blink::WebInputEvent::GestureScrollBegin: case blink::WebInputEvent::kGestureScrollBegin:
case blink::WebInputEvent::GestureScrollUpdate: case blink::WebInputEvent::kGestureScrollUpdate:
case blink::WebInputEvent::GestureScrollEnd: case blink::WebInputEvent::kGestureScrollEnd:
this->NotifyWindowScrollTouchEdge(); this->NotifyWindowScrollTouchEdge();
break; break;
default: default:

View file

@ -43,23 +43,23 @@ const int kFrameRetryLimit = 2;
ui::MouseEvent UiMouseEventFromWebMouseEvent(blink::WebMouseEvent event) { ui::MouseEvent UiMouseEventFromWebMouseEvent(blink::WebMouseEvent event) {
ui::EventType type = ui::EventType::ET_UNKNOWN; ui::EventType type = ui::EventType::ET_UNKNOWN;
switch (event.type()) { switch (event.GetType()) {
case blink::WebInputEvent::MouseDown: case blink::WebInputEvent::kMouseDown:
type = ui::EventType::ET_MOUSE_PRESSED; type = ui::EventType::ET_MOUSE_PRESSED;
break; break;
case blink::WebInputEvent::MouseUp: case blink::WebInputEvent::kMouseUp:
type = ui::EventType::ET_MOUSE_RELEASED; type = ui::EventType::ET_MOUSE_RELEASED;
break; break;
case blink::WebInputEvent::MouseMove: case blink::WebInputEvent::kMouseMove:
type = ui::EventType::ET_MOUSE_MOVED; type = ui::EventType::ET_MOUSE_MOVED;
break; break;
case blink::WebInputEvent::MouseEnter: case blink::WebInputEvent::kMouseEnter:
type = ui::EventType::ET_MOUSE_ENTERED; type = ui::EventType::ET_MOUSE_ENTERED;
break; break;
case blink::WebInputEvent::MouseLeave: case blink::WebInputEvent::kMouseLeave:
type = ui::EventType::ET_MOUSE_EXITED; type = ui::EventType::ET_MOUSE_EXITED;
break; break;
case blink::WebInputEvent::MouseWheel: case blink::WebInputEvent::kMouseWheel:
type = ui::EventType::ET_MOUSEWHEEL; type = ui::EventType::ET_MOUSEWHEEL;
break; break;
default: default:
@ -69,19 +69,19 @@ ui::MouseEvent UiMouseEventFromWebMouseEvent(blink::WebMouseEvent event) {
int button_flags = 0; int button_flags = 0;
switch (event.button) { switch (event.button) {
case blink::WebMouseEvent::Button::X1: case blink::WebMouseEvent::Button::kBack:
button_flags |= ui::EventFlags::EF_BACK_MOUSE_BUTTON; button_flags |= ui::EventFlags::EF_BACK_MOUSE_BUTTON;
break; break;
case blink::WebMouseEvent::Button::X2: case blink::WebMouseEvent::Button::kForward:
button_flags |= ui::EventFlags::EF_FORWARD_MOUSE_BUTTON; button_flags |= ui::EventFlags::EF_FORWARD_MOUSE_BUTTON;
break; break;
case blink::WebMouseEvent::Button::Left: case blink::WebMouseEvent::Button::kLeft:
button_flags |= ui::EventFlags::EF_LEFT_MOUSE_BUTTON; button_flags |= ui::EventFlags::EF_LEFT_MOUSE_BUTTON;
break; break;
case blink::WebMouseEvent::Button::Middle: case blink::WebMouseEvent::Button::kMiddle:
button_flags |= ui::EventFlags::EF_MIDDLE_MOUSE_BUTTON; button_flags |= ui::EventFlags::EF_MIDDLE_MOUSE_BUTTON;
break; break;
case blink::WebMouseEvent::Button::Right: case blink::WebMouseEvent::Button::kRight:
button_flags |= ui::EventFlags::EF_RIGHT_MOUSE_BUTTON; button_flags |= ui::EventFlags::EF_RIGHT_MOUSE_BUTTON;
break; break;
default: default:
@ -94,7 +94,7 @@ ui::MouseEvent UiMouseEventFromWebMouseEvent(blink::WebMouseEvent event) {
gfx::Point(std::floor(event.x), std::floor(event.y)), gfx::Point(std::floor(event.x), std::floor(event.y)),
ui::EventTimeForNow(), ui::EventTimeForNow(),
button_flags, button_flags); button_flags, button_flags);
ui_event.SetClickCount(event.clickCount); ui_event.SetClickCount(event.click_count);
return ui_event; return ui_event;
} }
@ -102,7 +102,7 @@ ui::MouseEvent UiMouseEventFromWebMouseEvent(blink::WebMouseEvent event) {
ui::MouseWheelEvent UiMouseWheelEventFromWebMouseEvent( ui::MouseWheelEvent UiMouseWheelEventFromWebMouseEvent(
blink::WebMouseWheelEvent event) { blink::WebMouseWheelEvent event) {
return ui::MouseWheelEvent(UiMouseEventFromWebMouseEvent(event), return ui::MouseWheelEvent(UiMouseEventFromWebMouseEvent(event),
std::floor(event.deltaX), std::floor(event.deltaY)); std::floor(event.delta_x), std::floor(event.delta_y));
} }
#if !defined(OS_MACOSX) #if !defined(OS_MACOSX)

View file

@ -224,7 +224,7 @@ class OffScreenRenderWidgetHostView
void OnProxyViewPaint(const gfx::Rect& damage_rect); void OnProxyViewPaint(const gfx::Rect& damage_rect);
bool IsPopupWidget() const { bool IsPopupWidget() const {
return popup_type_ != blink::WebPopupTypeNone; return popup_type_ != blink::kWebPopupTypeNone;
} }
void HoldResize(); void HoldResize();

View file

@ -132,7 +132,7 @@ class PdfViewerUI::ResourceRequester
request->set_method("GET"); request->set_method("GET");
content::ResourceDispatcherHostImpl::Get()->InitializeURLRequest( content::ResourceDispatcherHostImpl::Get()->InitializeURLRequest(
request.get(), content::Referrer(url, blink::WebReferrerPolicyDefault), request.get(), content::Referrer(url, blink::kWebReferrerPolicyDefault),
false, // download. false, // download.
render_process_id, render_view_id, render_frame_id, render_process_id, render_view_id, render_frame_id,
content::PREVIEWS_OFF, resource_context); content::PREVIEWS_OFF, resource_context);

View file

@ -19,11 +19,11 @@ namespace atom {
namespace { namespace {
content::RenderView* GetCurrentRenderView() { content::RenderView* GetCurrentRenderView() {
WebLocalFrame* frame = WebLocalFrame::frameForCurrentContext(); WebLocalFrame* frame = WebLocalFrame::FrameForCurrentContext();
if (!frame) if (!frame)
return nullptr; return nullptr;
WebView* view = frame->view(); WebView* view = frame->View();
if (!view) if (!view)
return nullptr; // can happen during closing. 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 WebEventModifiersToEventFlags(int modifiers) {
int flags = 0; int flags = 0;
if (modifiers & blink::WebInputEvent::ShiftKey) if (modifiers & blink::WebInputEvent::kShiftKey)
flags |= ui::EF_SHIFT_DOWN; flags |= ui::EF_SHIFT_DOWN;
if (modifiers & blink::WebInputEvent::ControlKey) if (modifiers & blink::WebInputEvent::kControlKey)
flags |= ui::EF_CONTROL_DOWN; flags |= ui::EF_CONTROL_DOWN;
if (modifiers & blink::WebInputEvent::AltKey) if (modifiers & blink::WebInputEvent::kAltKey)
flags |= ui::EF_ALT_DOWN; flags |= ui::EF_ALT_DOWN;
if (modifiers & blink::WebInputEvent::MetaKey) if (modifiers & blink::WebInputEvent::kMetaKey)
flags |= ui::EF_COMMAND_DOWN; flags |= ui::EF_COMMAND_DOWN;
if (modifiers & blink::WebInputEvent::CapsLockOn) if (modifiers & blink::WebInputEvent::kCapsLockOn)
flags |= ui::EF_CAPS_LOCK_ON; flags |= ui::EF_CAPS_LOCK_ON;
if (modifiers & blink::WebInputEvent::NumLockOn) if (modifiers & blink::WebInputEvent::kNumLockOn)
flags |= ui::EF_NUM_LOCK_ON; flags |= ui::EF_NUM_LOCK_ON;
if (modifiers & blink::WebInputEvent::ScrollLockOn) if (modifiers & blink::WebInputEvent::kScrollLockOn)
flags |= ui::EF_SCROLL_LOCK_ON; flags |= ui::EF_SCROLL_LOCK_ON;
if (modifiers & blink::WebInputEvent::LeftButtonDown) if (modifiers & blink::WebInputEvent::kLeftButtonDown)
flags |= ui::EF_LEFT_MOUSE_BUTTON; flags |= ui::EF_LEFT_MOUSE_BUTTON;
if (modifiers & blink::WebInputEvent::MiddleButtonDown) if (modifiers & blink::WebInputEvent::kMiddleButtonDown)
flags |= ui::EF_MIDDLE_MOUSE_BUTTON; flags |= ui::EF_MIDDLE_MOUSE_BUTTON;
if (modifiers & blink::WebInputEvent::RightButtonDown) if (modifiers & blink::WebInputEvent::kRightButtonDown)
flags |= ui::EF_RIGHT_MOUSE_BUTTON; flags |= ui::EF_RIGHT_MOUSE_BUTTON;
if (modifiers & blink::WebInputEvent::IsAutoRepeat) if (modifiers & blink::WebInputEvent::kIsAutoRepeat)
flags |= ui::EF_IS_REPEAT; flags |= ui::EF_IS_REPEAT;
return flags; return flags;

View file

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

View file

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

View file

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

View file

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

View file

@ -51,41 +51,41 @@ SpellCheckClient::SpellCheckClient(const std::string& language,
SpellCheckClient::~SpellCheckClient() {} SpellCheckClient::~SpellCheckClient() {}
void SpellCheckClient::checkSpelling( void SpellCheckClient::CheckSpelling(
const blink::WebString& text, const blink::WebString& text,
int& misspelling_start, int& misspelling_start,
int& misspelling_len, int& misspelling_len,
blink::WebVector<blink::WebString>* optional_suggestions) { blink::WebVector<blink::WebString>* optional_suggestions) {
std::vector<blink::WebTextCheckingResult> results; std::vector<blink::WebTextCheckingResult> results;
SpellCheckText(text.utf16(), true, &results); SpellCheckText(text.Utf16(), true, &results);
if (results.size() == 1) { if (results.size() == 1) {
misspelling_start = results[0].location; misspelling_start = results[0].location;
misspelling_len = results[0].length; misspelling_len = results[0].length;
} }
} }
void SpellCheckClient::requestCheckingOfText( void SpellCheckClient::RequestCheckingOfText(
const blink::WebString& textToCheck, const blink::WebString& textToCheck,
blink::WebTextCheckingCompletion* completionCallback) { blink::WebTextCheckingCompletion* completionCallback) {
base::string16 text(textToCheck.utf16()); base::string16 text(textToCheck.Utf16());
if (text.empty() || !HasWordCharacters(text, 0)) { if (text.empty() || !HasWordCharacters(text, 0)) {
completionCallback->didCancelCheckingText(); completionCallback->DidCancelCheckingText();
return; return;
} }
std::vector<blink::WebTextCheckingResult> results; std::vector<blink::WebTextCheckingResult> results;
SpellCheckText(text, false, &results); SpellCheckText(text, false, &results);
completionCallback->didFinishCheckingText(results); completionCallback->DidFinishCheckingText(results);
} }
void SpellCheckClient::showSpellingUI(bool show) { void SpellCheckClient::ShowSpellingUI(bool show) {
} }
bool SpellCheckClient::isShowingSpellingUI() { bool SpellCheckClient::IsShowingSpellingUI() {
return false; return false;
} }
void SpellCheckClient::updateSpellingUIWithMisspelledWord( void SpellCheckClient::UpdateSpellingUIWithMisspelledWord(
const blink::WebString& word) { const blink::WebString& word) {
} }

View file

@ -31,17 +31,17 @@ class SpellCheckClient : public blink::WebSpellCheckClient {
private: private:
// blink::WebSpellCheckClient: // blink::WebSpellCheckClient:
void checkSpelling( void CheckSpelling(
const blink::WebString& text, const blink::WebString& text,
int& misspelledOffset, int& misspelledOffset,
int& misspelledLength, int& misspelledLength,
blink::WebVector<blink::WebString>* optionalSuggestions) override; blink::WebVector<blink::WebString>* optionalSuggestions) override;
void requestCheckingOfText( void RequestCheckingOfText(
const blink::WebString& textToCheck, const blink::WebString& textToCheck,
blink::WebTextCheckingCompletion* completionCallback) override; blink::WebTextCheckingCompletion* completionCallback) override;
void showSpellingUI(bool show) override; void ShowSpellingUI(bool show) override;
bool isShowingSpellingUI() override; bool IsShowingSpellingUI() override;
void updateSpellingUIWithMisspelledWord( void UpdateSpellingUIWithMisspelledWord(
const blink::WebString& word) override; const blink::WebString& word) override;
// Check the spelling of text. // Check the spelling of text.

View file

@ -44,9 +44,9 @@ class ScriptExecutionCallback : public blink::WebScriptExecutionCallback {
: callback_(callback) {} : callback_(callback) {}
~ScriptExecutionCallback() override {} ~ScriptExecutionCallback() override {}
void completed( void Completed(
const blink::WebVector<v8::Local<v8::Value>>& result) override { const blink::WebVector<v8::Local<v8::Value>>& result) override {
if (!callback_.is_null() && !result.isEmpty() && !result[0].IsEmpty()) if (!callback_.is_null() && !result.IsEmpty() && !result[0].IsEmpty())
// Right now only single results per frame is supported. // Right now only single results per frame is supported.
callback_.Run(result[0]); callback_.Run(result[0]);
delete this; delete this;
@ -61,7 +61,7 @@ class ScriptExecutionCallback : public blink::WebScriptExecutionCallback {
} // namespace } // namespace
WebFrame::WebFrame(v8::Isolate* isolate) WebFrame::WebFrame(v8::Isolate* isolate)
: web_frame_(blink::WebLocalFrame::frameForCurrentContext()) { : web_frame_(blink::WebLocalFrame::FrameForCurrentContext()) {
Init(isolate); Init(isolate);
} }
@ -69,13 +69,13 @@ WebFrame::~WebFrame() {
} }
void WebFrame::SetName(const std::string& name) { void WebFrame::SetName(const std::string& name) {
web_frame_->setName(blink::WebString::fromUTF8(name)); web_frame_->SetName(blink::WebString::FromUTF8(name));
} }
double WebFrame::SetZoomLevel(double level) { double WebFrame::SetZoomLevel(double level) {
double result = 0.0; double result = 0.0;
content::RenderView* render_view = content::RenderView* render_view =
content::RenderView::FromWebView(web_frame_->view()); content::RenderView::FromWebView(web_frame_->View());
render_view->Send(new AtomViewHostMsg_SetTemporaryZoomLevel( render_view->Send(new AtomViewHostMsg_SetTemporaryZoomLevel(
render_view->GetRoutingID(), level, &result)); render_view->GetRoutingID(), level, &result));
return result; return result;
@ -84,34 +84,34 @@ double WebFrame::SetZoomLevel(double level) {
double WebFrame::GetZoomLevel() const { double WebFrame::GetZoomLevel() const {
double result = 0.0; double result = 0.0;
content::RenderView* render_view = content::RenderView* render_view =
content::RenderView::FromWebView(web_frame_->view()); content::RenderView::FromWebView(web_frame_->View());
render_view->Send( render_view->Send(
new AtomViewHostMsg_GetZoomLevel(render_view->GetRoutingID(), &result)); new AtomViewHostMsg_GetZoomLevel(render_view->GetRoutingID(), &result));
return result; return result;
} }
double WebFrame::SetZoomFactor(double factor) { double WebFrame::SetZoomFactor(double factor) {
return blink::WebView::zoomLevelToZoomFactor(SetZoomLevel( return blink::WebView::ZoomLevelToZoomFactor(SetZoomLevel(
blink::WebView::zoomFactorToZoomLevel(factor))); blink::WebView::ZoomFactorToZoomLevel(factor)));
} }
double WebFrame::GetZoomFactor() const { double WebFrame::GetZoomFactor() const {
return blink::WebView::zoomLevelToZoomFactor(GetZoomLevel()); return blink::WebView::ZoomLevelToZoomFactor(GetZoomLevel());
} }
void WebFrame::SetVisualZoomLevelLimits(double min_level, double max_level) { void WebFrame::SetVisualZoomLevelLimits(double min_level, double max_level) {
web_frame_->view()->setDefaultPageScaleLimits(min_level, max_level); web_frame_->View()->SetDefaultPageScaleLimits(min_level, max_level);
} }
void WebFrame::SetLayoutZoomLevelLimits(double min_level, double max_level) { void WebFrame::SetLayoutZoomLevelLimits(double min_level, double max_level) {
web_frame_->view()->zoomLimitsChanged(min_level, max_level); web_frame_->View()->ZoomLimitsChanged(min_level, max_level);
} }
v8::Local<v8::Value> WebFrame::RegisterEmbedderCustomElement( v8::Local<v8::Value> WebFrame::RegisterEmbedderCustomElement(
const base::string16& name, v8::Local<v8::Object> options) { const base::string16& name, v8::Local<v8::Object> options) {
blink::WebExceptionCode c = 0; blink::WebExceptionCode c = 0;
return web_frame_->document().registerEmbedderCustomElement( return web_frame_->GetDocument().RegisterEmbedderCustomElement(
blink::WebString::fromUTF16(name), options, c); blink::WebString::FromUTF16(name), options, c);
} }
void WebFrame::RegisterElementResizeCallback( void WebFrame::RegisterElementResizeCallback(
@ -141,19 +141,19 @@ void WebFrame::SetSpellCheckProvider(mate::Arguments* args,
spell_check_client_.reset(new SpellCheckClient( spell_check_client_.reset(new SpellCheckClient(
language, auto_spell_correct_turned_on, args->isolate(), provider)); language, auto_spell_correct_turned_on, args->isolate(), provider));
web_frame_->view()->setSpellCheckClient(spell_check_client_.get()); web_frame_->View()->SetSpellCheckClient(spell_check_client_.get());
} }
void WebFrame::RegisterURLSchemeAsSecure(const std::string& scheme) { void WebFrame::RegisterURLSchemeAsSecure(const std::string& scheme) {
// TODO(pfrazee): Remove 2.0 // TODO(pfrazee): Remove 2.0
blink::SchemeRegistry::registerURLSchemeAsSecure( blink::SchemeRegistry::RegisterURLSchemeAsSecure(
WTF::String::fromUTF8(scheme.data(), scheme.length())); WTF::String::FromUTF8(scheme.data(), scheme.length()));
} }
void WebFrame::RegisterURLSchemeAsBypassingCSP(const std::string& scheme) { void WebFrame::RegisterURLSchemeAsBypassingCSP(const std::string& scheme) {
// Register scheme to bypass pages's Content Security Policy. // Register scheme to bypass pages's Content Security Policy.
blink::SchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy( blink::SchemeRegistry::RegisterURLSchemeAsBypassingContentSecurityPolicy(
WTF::String::fromUTF8(scheme.data(), scheme.length())); WTF::String::FromUTF8(scheme.data(), scheme.length()));
} }
void WebFrame::RegisterURLSchemeAsPrivileged(const std::string& scheme, void WebFrame::RegisterURLSchemeAsPrivileged(const std::string& scheme,
@ -176,39 +176,39 @@ void WebFrame::RegisterURLSchemeAsPrivileged(const std::string& scheme,
} }
// Register scheme to privileged list (https, wss, data, chrome-extension) // Register scheme to privileged list (https, wss, data, chrome-extension)
WTF::String privileged_scheme( WTF::String privileged_scheme(
WTF::String::fromUTF8(scheme.data(), scheme.length())); WTF::String::FromUTF8(scheme.data(), scheme.length()));
if (secure) { if (secure) {
// TODO(pfrazee): Remove 2.0 // TODO(pfrazee): Remove 2.0
blink::SchemeRegistry::registerURLSchemeAsSecure(privileged_scheme); blink::SchemeRegistry::RegisterURLSchemeAsSecure(privileged_scheme);
} }
if (bypassCSP) { if (bypassCSP) {
blink::SchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy( blink::SchemeRegistry::RegisterURLSchemeAsBypassingContentSecurityPolicy(
privileged_scheme); privileged_scheme);
} }
if (allowServiceWorkers) { if (allowServiceWorkers) {
blink::SchemeRegistry::registerURLSchemeAsAllowingServiceWorkers( blink::SchemeRegistry::RegisterURLSchemeAsAllowingServiceWorkers(
privileged_scheme); privileged_scheme);
} }
if (supportFetchAPI) { if (supportFetchAPI) {
blink::SchemeRegistry::registerURLSchemeAsSupportingFetchAPI( blink::SchemeRegistry::RegisterURLSchemeAsSupportingFetchAPI(
privileged_scheme); privileged_scheme);
} }
if (corsEnabled) { if (corsEnabled) {
blink::SchemeRegistry::registerURLSchemeAsCORSEnabled(privileged_scheme); blink::SchemeRegistry::RegisterURLSchemeAsCORSEnabled(privileged_scheme);
} }
} }
void WebFrame::InsertText(const std::string& text) { void WebFrame::InsertText(const std::string& text) {
web_frame_->frameWidget() web_frame_->FrameWidget()
->getActiveWebInputMethodController() ->GetActiveWebInputMethodController()
->commitText(blink::WebString::fromUTF8(text), ->CommitText(blink::WebString::FromUTF8(text),
blink::WebVector<blink::WebCompositionUnderline>(), blink::WebVector<blink::WebCompositionUnderline>(),
blink::WebRange(), blink::WebRange(),
0); 0);
} }
void WebFrame::InsertCSS(const std::string& css) { void WebFrame::InsertCSS(const std::string& css) {
web_frame_->document().insertStyleSheet(blink::WebString::fromUTF8(css)); web_frame_->GetDocument().InsertStyleSheet(blink::WebString::FromUTF8(css));
} }
void WebFrame::ExecuteJavaScript(const base::string16& code, void WebFrame::ExecuteJavaScript(const base::string16& code,
@ -219,8 +219,8 @@ void WebFrame::ExecuteJavaScript(const base::string16& code,
args->GetNext(&completion_callback); args->GetNext(&completion_callback);
std::unique_ptr<blink::WebScriptExecutionCallback> callback( std::unique_ptr<blink::WebScriptExecutionCallback> callback(
new ScriptExecutionCallback(completion_callback)); new ScriptExecutionCallback(completion_callback));
web_frame_->requestExecuteScriptAndReturnValue( web_frame_->RequestExecuteScriptAndReturnValue(
blink::WebScriptSource(blink::WebString::fromUTF16(code)), blink::WebScriptSource(blink::WebString::FromUTF16(code)),
has_user_gesture, has_user_gesture,
callback.release()); callback.release());
} }
@ -233,13 +233,13 @@ mate::Handle<WebFrame> WebFrame::Create(v8::Isolate* isolate) {
blink::WebCache::ResourceTypeStats WebFrame::GetResourceUsage( blink::WebCache::ResourceTypeStats WebFrame::GetResourceUsage(
v8::Isolate* isolate) { v8::Isolate* isolate) {
blink::WebCache::ResourceTypeStats stats; blink::WebCache::ResourceTypeStats stats;
blink::WebCache::getResourceTypeStats(&stats); blink::WebCache::GetResourceTypeStats(&stats);
return stats; return stats;
} }
void WebFrame::ClearCache(v8::Isolate* isolate) { void WebFrame::ClearCache(v8::Isolate* isolate) {
isolate->IdleNotificationDeadline(0.5); isolate->IdleNotificationDeadline(0.5);
blink::WebCache::clear(); blink::WebCache::Clear();
base::MemoryPressureListener::NotifyMemoryPressure( base::MemoryPressureListener::NotifyMemoryPressure(
base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL); base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL);
} }

View file

@ -27,10 +27,10 @@ const size_t kMaxListSize = 512;
void GetDataListSuggestions(const blink::WebInputElement& element, void GetDataListSuggestions(const blink::WebInputElement& element,
std::vector<base::string16>* values, std::vector<base::string16>* values,
std::vector<base::string16>* labels) { std::vector<base::string16>* labels) {
for (const auto& option : element.filteredDataListOptions()) { for (const auto& option : element.FilteredDataListOptions()) {
values->push_back(option.value().utf16()); values->push_back(option.Value().Utf16());
if (option.value() != option.label()) if (option.Value() != option.Label())
labels->push_back(option.label().utf16()); labels->push_back(option.Label().Utf16());
else else
labels->push_back(base::string16()); labels->push_back(base::string16());
} }
@ -56,7 +56,7 @@ AutofillAgent::AutofillAgent(
focused_node_was_last_clicked_(false), focused_node_was_last_clicked_(false),
was_focused_before_now_(false), was_focused_before_now_(false),
weak_ptr_factory_(this) { weak_ptr_factory_(this) {
render_frame()->GetWebFrame()->setAutofillClient(this); render_frame()->GetWebFrame()->SetAutofillClient(this);
} }
void AutofillAgent::OnDestruct() { void AutofillAgent::OnDestruct() {
@ -73,34 +73,34 @@ void AutofillAgent::FocusedNodeChanged(const blink::WebNode&) {
HidePopup(); HidePopup();
} }
void AutofillAgent::textFieldDidEndEditing( void AutofillAgent::TextFieldDidEndEditing(
const blink::WebInputElement&) { const blink::WebInputElement&) {
HidePopup(); HidePopup();
} }
void AutofillAgent::textFieldDidChange( void AutofillAgent::TextFieldDidChange(
const blink::WebFormControlElement& element) { const blink::WebFormControlElement& element) {
if (!IsUserGesture() && !render_frame()->IsPasting()) if (!IsUserGesture() && !render_frame()->IsPasting())
return; return;
weak_ptr_factory_.InvalidateWeakPtrs(); weak_ptr_factory_.InvalidateWeakPtrs();
base::ThreadTaskRunnerHandle::Get()->PostTask( base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&AutofillAgent::textFieldDidChangeImpl, FROM_HERE, base::Bind(&AutofillAgent::TextFieldDidChangeImpl,
weak_ptr_factory_.GetWeakPtr(), element)); weak_ptr_factory_.GetWeakPtr(), element));
} }
void AutofillAgent::textFieldDidChangeImpl( void AutofillAgent::TextFieldDidChangeImpl(
const blink::WebFormControlElement& element) { const blink::WebFormControlElement& element) {
ShowSuggestionsOptions options; ShowSuggestionsOptions options;
options.requires_caret_at_end = true; options.requires_caret_at_end = true;
ShowSuggestions(element, options); ShowSuggestions(element, options);
} }
void AutofillAgent::textFieldDidReceiveKeyDown( void AutofillAgent::TextFieldDidReceiveKeyDown(
const blink::WebInputElement& element, const blink::WebInputElement& element,
const blink::WebKeyboardEvent& event) { const blink::WebKeyboardEvent& event) {
if (event.windowsKeyCode == ui::VKEY_DOWN || if (event.windows_key_code == ui::VKEY_DOWN ||
event.windowsKeyCode == ui::VKEY_UP) { event.windows_key_code == ui::VKEY_UP) {
ShowSuggestionsOptions options; ShowSuggestionsOptions options;
options.autofill_on_empty_values = true; options.autofill_on_empty_values = true;
options.requires_caret_at_end = true; options.requires_caret_at_end = true;
@ -108,16 +108,16 @@ void AutofillAgent::textFieldDidReceiveKeyDown(
} }
} }
void AutofillAgent::openTextDataListChooser( void AutofillAgent::OpenTextDataListChooser(
const blink::WebInputElement& element) { const blink::WebInputElement& element) {
ShowSuggestionsOptions options; ShowSuggestionsOptions options;
options.autofill_on_empty_values = true; options.autofill_on_empty_values = true;
ShowSuggestions(element, options); ShowSuggestions(element, options);
} }
void AutofillAgent::dataListOptionsChanged( void AutofillAgent::DataListOptionsChanged(
const blink::WebInputElement& element) { const blink::WebInputElement& element) {
if (!element.focused()) if (!element.Focused())
return; return;
ShowSuggestionsOptions options; ShowSuggestionsOptions options;
@ -133,20 +133,20 @@ AutofillAgent::ShowSuggestionsOptions::ShowSuggestionsOptions()
void AutofillAgent::ShowSuggestions( void AutofillAgent::ShowSuggestions(
const blink::WebFormControlElement& element, const blink::WebFormControlElement& element,
const ShowSuggestionsOptions& options) { const ShowSuggestionsOptions& options) {
if (!element.isEnabled() || element.isReadOnly()) if (!element.IsEnabled() || element.IsReadOnly())
return; return;
const blink::WebInputElement* input_element = toWebInputElement(&element); const blink::WebInputElement* input_element = ToWebInputElement(&element);
if (input_element) { if (input_element) {
if (!input_element->isTextField()) if (!input_element->IsTextField())
return; return;
} }
blink::WebString value = element.editingValue(); blink::WebString value = element.EditingValue();
if (value.length() > kMaxDataLength || if (value.length() > kMaxDataLength ||
(!options.autofill_on_empty_values && value.isEmpty()) || (!options.autofill_on_empty_values && value.IsEmpty()) ||
(options.requires_caret_at_end && (options.requires_caret_at_end &&
(element.selectionStart() != element.selectionEnd() || (element.SelectionStart() != element.SelectionEnd() ||
element.selectionEnd() != static_cast<int>(value.length())))) { element.SelectionEnd() != static_cast<int>(value.length())))) {
HidePopup(); HidePopup();
return; return;
} }
@ -169,7 +169,7 @@ AutofillAgent::Helper::Helper(AutofillAgent* agent)
} }
void AutofillAgent::Helper::OnMouseDown(const blink::WebNode& node) { void AutofillAgent::Helper::OnMouseDown(const blink::WebNode& node) {
agent_->focused_node_was_last_clicked_ = !node.isNull() && node.focused(); agent_->focused_node_was_last_clicked_ = !node.IsNull() && node.Focused();
} }
void AutofillAgent::Helper::FocusChangeComplete() { void AutofillAgent::Helper::FocusChangeComplete() {
@ -188,7 +188,7 @@ bool AutofillAgent::OnMessageReceived(const IPC::Message& message) {
} }
bool AutofillAgent::IsUserGesture() const { bool AutofillAgent::IsUserGesture() const {
return blink::WebUserGestureIndicator::isProcessingUserGesture(); return blink::WebUserGestureIndicator::IsProcessingUserGesture();
} }
void AutofillAgent::HidePopup() { void AutofillAgent::HidePopup() {
@ -206,22 +206,22 @@ void AutofillAgent::ShowPopup(
} }
void AutofillAgent::OnAcceptSuggestion(base::string16 suggestion) { void AutofillAgent::OnAcceptSuggestion(base::string16 suggestion) {
auto element = render_frame()->GetWebFrame()->document().focusedElement(); auto element = render_frame()->GetWebFrame()->GetDocument().FocusedElement();
if (element.isFormControlElement()) { if (element.IsFormControlElement()) {
toWebInputElement(&element)->setSuggestedValue( ToWebInputElement(&element)->SetSuggestedValue(
blink::WebString::fromUTF16(suggestion)); blink::WebString::FromUTF16(suggestion));
} }
} }
void AutofillAgent::DoFocusChangeComplete() { void AutofillAgent::DoFocusChangeComplete() {
auto element = render_frame()->GetWebFrame()->document().focusedElement(); auto element = render_frame()->GetWebFrame()->GetDocument().FocusedElement();
if (element.isNull() || !element.isFormControlElement()) if (element.IsNull() || !element.IsFormControlElement())
return; return;
if (focused_node_was_last_clicked_ && was_focused_before_now_) { if (focused_node_was_last_clicked_ && was_focused_before_now_) {
ShowSuggestionsOptions options; ShowSuggestionsOptions options;
options.autofill_on_empty_values = true; options.autofill_on_empty_values = true;
auto input_element = toWebInputElement(&element); auto input_element = ToWebInputElement(&element);
if (input_element) if (input_element)
ShowSuggestions(*input_element, options); ShowSuggestions(*input_element, options);
} }

View file

@ -52,13 +52,13 @@ class AutofillAgent : public content::RenderFrameObserver,
bool OnMessageReceived(const IPC::Message& message) override; bool OnMessageReceived(const IPC::Message& message) override;
// blink::WebAutofillClient: // blink::WebAutofillClient:
void textFieldDidEndEditing(const blink::WebInputElement&) override; void TextFieldDidEndEditing(const blink::WebInputElement&) override;
void textFieldDidChange(const blink::WebFormControlElement&) override; void TextFieldDidChange(const blink::WebFormControlElement&) override;
void textFieldDidChangeImpl(const blink::WebFormControlElement&); void TextFieldDidChangeImpl(const blink::WebFormControlElement&);
void textFieldDidReceiveKeyDown(const blink::WebInputElement&, void TextFieldDidReceiveKeyDown(const blink::WebInputElement&,
const blink::WebKeyboardEvent&) override; const blink::WebKeyboardEvent&) override;
void openTextDataListChooser(const blink::WebInputElement&) override; void OpenTextDataListChooser(const blink::WebInputElement&) override;
void dataListOptionsChanged(const blink::WebInputElement&) override; void DataListOptionsChanged(const blink::WebInputElement&) override;
bool IsUserGesture() const; bool IsUserGesture() const;
void HidePopup(); void HidePopup();

View file

@ -51,17 +51,17 @@ void AtomRenderFrameObserver::CreateIsolatedWorldContext() {
// This maps to the name shown in the context combo box in the Console tab // This maps to the name shown in the context combo box in the Console tab
// of the dev tools. // of the dev tools.
frame->setIsolatedWorldHumanReadableName( frame->SetIsolatedWorldHumanReadableName(
World::ISOLATED_WORLD, World::ISOLATED_WORLD,
blink::WebString::fromUTF8("Electron Isolated Context")); blink::WebString::FromUTF8("Electron Isolated Context"));
// Setup document's origin policy in isolated world // Setup document's origin policy in isolated world
frame->setIsolatedWorldSecurityOrigin( frame->SetIsolatedWorldSecurityOrigin(
World::ISOLATED_WORLD, frame->document().getSecurityOrigin()); World::ISOLATED_WORLD, frame->GetDocument().GetSecurityOrigin());
// Create initial script context in isolated world // Create initial script context in isolated world
blink::WebScriptSource source("void 0"); blink::WebScriptSource source("void 0");
frame->executeScriptInIsolatedWorld(World::ISOLATED_WORLD, &source, 1); frame->ExecuteScriptInIsolatedWorld(World::ISOLATED_WORLD, &source, 1);
} }
bool AtomRenderFrameObserver::IsMainWorld(int world_id) { bool AtomRenderFrameObserver::IsMainWorld(int world_id) {

View file

@ -87,10 +87,10 @@ AtomRenderViewObserver::~AtomRenderViewObserver() {
void AtomRenderViewObserver::EmitIPCEvent(blink::WebFrame* frame, void AtomRenderViewObserver::EmitIPCEvent(blink::WebFrame* frame,
const base::string16& channel, const base::string16& channel,
const base::ListValue& args) { const base::ListValue& args) {
if (!frame || frame->isWebRemoteFrame()) if (!frame || frame->IsWebRemoteFrame())
return; return;
v8::Isolate* isolate = blink::mainThreadIsolate(); v8::Isolate* isolate = blink::MainThreadIsolate();
v8::HandleScope handle_scope(isolate); v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> context = renderer_client_->GetContext(frame, isolate); v8::Local<v8::Context> context = renderer_client_->GetContext(frame, isolate);
@ -120,7 +120,7 @@ void AtomRenderViewObserver::DidCreateDocumentElement(
void AtomRenderViewObserver::DraggableRegionsChanged(blink::WebFrame* frame) { void AtomRenderViewObserver::DraggableRegionsChanged(blink::WebFrame* frame) {
blink::WebVector<blink::WebDraggableRegion> webregions = blink::WebVector<blink::WebDraggableRegion> webregions =
frame->document().draggableRegions(); frame->GetDocument().DraggableRegions();
std::vector<DraggableRegion> regions; std::vector<DraggableRegion> regions;
for (auto& webregion : webregions) { for (auto& webregion : webregions) {
DraggableRegion region; DraggableRegion region;
@ -156,22 +156,22 @@ void AtomRenderViewObserver::OnBrowserMessage(bool send_to_all,
if (!render_view()->GetWebView()) if (!render_view()->GetWebView())
return; return;
blink::WebFrame* frame = render_view()->GetWebView()->mainFrame(); blink::WebFrame* frame = render_view()->GetWebView()->MainFrame();
if (!frame || frame->isWebRemoteFrame()) if (!frame || frame->IsWebRemoteFrame())
return; return;
EmitIPCEvent(frame, channel, args); EmitIPCEvent(frame, channel, args);
// Also send the message to all sub-frames. // Also send the message to all sub-frames.
if (send_to_all) { if (send_to_all) {
for (blink::WebFrame* child = frame->firstChild(); child; for (blink::WebFrame* child = frame->FirstChild(); child;
child = child->nextSibling()) child = child->NextSibling())
EmitIPCEvent(child, channel, args); EmitIPCEvent(child, channel, args);
} }
} }
void AtomRenderViewObserver::OnOffscreen() { void AtomRenderViewObserver::OnOffscreen() {
blink::WebView::setUseExternalPopupMenus(false); blink::WebView::SetUseExternalPopupMenus(false);
} }
} // namespace atom } // namespace atom

View file

@ -31,7 +31,7 @@ namespace atom {
namespace { namespace {
bool IsDevToolsExtension(content::RenderFrame* render_frame) { bool IsDevToolsExtension(content::RenderFrame* render_frame) {
return static_cast<GURL>(render_frame->GetWebFrame()->document().url()) return static_cast<GURL>(render_frame->GetWebFrame()->GetDocument().Url())
.SchemeIs("chrome-extension"); .SchemeIs("chrome-extension");
} }
@ -174,9 +174,9 @@ void AtomRendererClient::WillDestroyWorkerContextOnWorkerThread(
v8::Local<v8::Context> AtomRendererClient::GetContext( v8::Local<v8::Context> AtomRendererClient::GetContext(
blink::WebFrame* frame, v8::Isolate* isolate) { blink::WebFrame* frame, v8::Isolate* isolate) {
if (isolated_world()) if (isolated_world())
return frame->worldScriptContext(isolate, World::ISOLATED_WORLD); return frame->WorldScriptContext(isolate, World::ISOLATED_WORLD);
else else
return frame->mainWorldScriptContext(); return frame->MainWorldScriptContext();
} }
void AtomRendererClient::SetupMainWorldOverrides( void AtomRendererClient::SetupMainWorldOverrides(

View file

@ -110,12 +110,12 @@ class AtomSandboxedRenderViewObserver : public AtomRenderViewObserver {
void EmitIPCEvent(blink::WebFrame* frame, void EmitIPCEvent(blink::WebFrame* frame,
const base::string16& channel, const base::string16& channel,
const base::ListValue& args) override { const base::ListValue& args) override {
if (!frame || frame->isWebRemoteFrame()) if (!frame || frame->IsWebRemoteFrame())
return; return;
auto isolate = blink::mainThreadIsolate(); auto isolate = blink::MainThreadIsolate();
v8::HandleScope handle_scope(isolate); v8::HandleScope handle_scope(isolate);
auto context = frame->mainWorldScriptContext(); auto context = frame->MainWorldScriptContext();
v8::Context::Scope context_scope(context); v8::Context::Scope context_scope(context);
v8::Local<v8::Value> argv[] = { v8::Local<v8::Value> argv[] = {
mate::ConvertToV8(isolate, channel), mate::ConvertToV8(isolate, channel),

View file

@ -14,45 +14,45 @@ namespace atom {
ContentSettingsObserver::ContentSettingsObserver( ContentSettingsObserver::ContentSettingsObserver(
content::RenderFrame* render_frame) content::RenderFrame* render_frame)
: content::RenderFrameObserver(render_frame) { : content::RenderFrameObserver(render_frame) {
render_frame->GetWebFrame()->setContentSettingsClient(this); render_frame->GetWebFrame()->SetContentSettingsClient(this);
} }
ContentSettingsObserver::~ContentSettingsObserver() { ContentSettingsObserver::~ContentSettingsObserver() {
} }
bool ContentSettingsObserver::allowDatabase( bool ContentSettingsObserver::AllowDatabase(
const blink::WebString& name, const blink::WebString& name,
const blink::WebString& display_name, const blink::WebString& display_name,
unsigned estimated_size) { unsigned estimated_size) {
blink::WebFrame* frame = render_frame()->GetWebFrame(); blink::WebFrame* frame = render_frame()->GetWebFrame();
if (frame->getSecurityOrigin().isUnique() || if (frame->GetSecurityOrigin().IsUnique() ||
frame->top()->getSecurityOrigin().isUnique()) frame->Top()->GetSecurityOrigin().IsUnique())
return false; return false;
auto origin = blink::WebStringToGURL(frame->getSecurityOrigin().toString()); auto origin = blink::WebStringToGURL(frame->GetSecurityOrigin().ToString());
if (!origin.IsStandard()) if (!origin.IsStandard())
return false; return false;
return true; return true;
} }
bool ContentSettingsObserver::allowStorage(bool local) { bool ContentSettingsObserver::AllowStorage(bool local) {
blink::WebFrame* frame = render_frame()->GetWebFrame(); blink::WebFrame* frame = render_frame()->GetWebFrame();
if (frame->getSecurityOrigin().isUnique() || if (frame->GetSecurityOrigin().IsUnique() ||
frame->top()->getSecurityOrigin().isUnique()) frame->Top()->GetSecurityOrigin().IsUnique())
return false; return false;
auto origin = blink::WebStringToGURL(frame->getSecurityOrigin().toString()); auto origin = blink::WebStringToGURL(frame->GetSecurityOrigin().ToString());
if (!origin.IsStandard()) if (!origin.IsStandard())
return false; return false;
return true; return true;
} }
bool ContentSettingsObserver::allowIndexedDB( bool ContentSettingsObserver::AllowIndexedDB(
const blink::WebString& name, const blink::WebString& name,
const blink::WebSecurityOrigin& security_origin) { const blink::WebSecurityOrigin& security_origin) {
blink::WebFrame* frame = render_frame()->GetWebFrame(); blink::WebFrame* frame = render_frame()->GetWebFrame();
if (frame->getSecurityOrigin().isUnique() || if (frame->GetSecurityOrigin().IsUnique() ||
frame->top()->getSecurityOrigin().isUnique()) frame->Top()->GetSecurityOrigin().IsUnique())
return false; return false;
auto origin = blink::WebStringToGURL(frame->getSecurityOrigin().toString()); auto origin = blink::WebStringToGURL(frame->GetSecurityOrigin().ToString());
if (!origin.IsStandard()) if (!origin.IsStandard())
return false; return false;
return true; return true;

View file

@ -18,11 +18,11 @@ class ContentSettingsObserver : public content::RenderFrameObserver,
~ContentSettingsObserver() override; ~ContentSettingsObserver() override;
// blink::WebContentSettingsClient implementation. // blink::WebContentSettingsClient implementation.
bool allowDatabase(const blink::WebString& name, bool AllowDatabase(const blink::WebString& name,
const blink::WebString& display_name, const blink::WebString& display_name,
unsigned estimated_size) override; unsigned estimated_size) override;
bool allowStorage(bool local) override; bool AllowStorage(bool local) override;
bool allowIndexedDB(const blink::WebString& name, bool AllowIndexedDB(const blink::WebString& name,
const blink::WebSecurityOrigin& security_origin) override; const blink::WebSecurityOrigin& security_origin) override;
private: private:

View file

@ -84,15 +84,15 @@ void RendererClientBase::AddRenderBindings(
} }
void RendererClientBase::RenderThreadStarted() { void RendererClientBase::RenderThreadStarted() {
blink::WebCustomElement::addEmbedderCustomElementName("webview"); blink::WebCustomElement::AddEmbedderCustomElementName("webview");
blink::WebCustomElement::addEmbedderCustomElementName("browserplugin"); blink::WebCustomElement::AddEmbedderCustomElementName("browserplugin");
// Parse --secure-schemes=scheme1,scheme2 // Parse --secure-schemes=scheme1,scheme2
std::vector<std::string> secure_schemes_list = std::vector<std::string> secure_schemes_list =
ParseSchemesCLISwitch(switches::kSecureSchemes); ParseSchemesCLISwitch(switches::kSecureSchemes);
for (const std::string& scheme : secure_schemes_list) for (const std::string& scheme : secure_schemes_list)
blink::SchemeRegistry::registerURLSchemeAsSecure( blink::SchemeRegistry::RegisterURLSchemeAsSecure(
WTF::String::fromUTF8(scheme.data(), scheme.length())); WTF::String::FromUTF8(scheme.data(), scheme.length()));
preferences_manager_.reset(new PreferencesManager); preferences_manager_.reset(new PreferencesManager);
@ -128,13 +128,13 @@ void RendererClientBase::RenderFrameCreated(
// Allow file scheme to handle service worker by default. // Allow file scheme to handle service worker by default.
// FIXME(zcbenz): Can this be moved elsewhere? // FIXME(zcbenz): Can this be moved elsewhere?
blink::WebSecurityPolicy::registerURLSchemeAsAllowingServiceWorkers("file"); blink::WebSecurityPolicy::RegisterURLSchemeAsAllowingServiceWorkers("file");
// This is required for widevine plugin detection provided during runtime. // This is required for widevine plugin detection provided during runtime.
blink::resetPluginCache(); blink::ResetPluginCache();
// Allow access to file scheme from pdf viewer. // Allow access to file scheme from pdf viewer.
blink::WebSecurityPolicy::addOriginAccessWhitelistEntry( blink::WebSecurityPolicy::AddOriginAccessWhitelistEntry(
GURL(kPdfViewerUIOrigin), "file", "", true); GURL(kPdfViewerUIOrigin), "file", "", true);
} }
@ -145,20 +145,20 @@ void RendererClientBase::RenderViewCreated(content::RenderView* render_view) {
base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); base::CommandLine* cmd = base::CommandLine::ForCurrentProcess();
if (cmd->HasSwitch(switches::kGuestInstanceID)) { // webview. if (cmd->HasSwitch(switches::kGuestInstanceID)) { // webview.
web_frame_widget->setBaseBackgroundColor(SK_ColorTRANSPARENT); web_frame_widget->SetBaseBackgroundColor(SK_ColorTRANSPARENT);
} else { // normal window. } else { // normal window.
// If backgroundColor is specified then use it. // If backgroundColor is specified then use it.
std::string name = cmd->GetSwitchValueASCII(switches::kBackgroundColor); std::string name = cmd->GetSwitchValueASCII(switches::kBackgroundColor);
// Otherwise use white background. // Otherwise use white background.
SkColor color = name.empty() ? SK_ColorWHITE : ParseHexColor(name); SkColor color = name.empty() ? SK_ColorWHITE : ParseHexColor(name);
web_frame_widget->setBaseBackgroundColor(color); web_frame_widget->SetBaseBackgroundColor(color);
} }
} }
void RendererClientBase::DidClearWindowObject( void RendererClientBase::DidClearWindowObject(
content::RenderFrame* render_frame) { content::RenderFrame* render_frame) {
// Make sure every page will get a script context created. // Make sure every page will get a script context created.
render_frame->GetWebFrame()->executeScript(blink::WebScriptSource("void 0")); render_frame->GetWebFrame()->ExecuteScript(blink::WebScriptSource("void 0"));
} }
blink::WebSpeechSynthesizer* RendererClientBase::OverrideSpeechSynthesizer( blink::WebSpeechSynthesizer* RendererClientBase::OverrideSpeechSynthesizer(
@ -172,8 +172,8 @@ bool RendererClientBase::OverrideCreatePlugin(
const blink::WebPluginParams& params, const blink::WebPluginParams& params,
blink::WebPlugin** plugin) { blink::WebPlugin** plugin) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (params.mimeType.utf8() == content::kBrowserPluginMimeType || if (params.mime_type.Utf8() == content::kBrowserPluginMimeType ||
params.mimeType.utf8() == kPdfPluginMimeType || params.mime_type.Utf8() == kPdfPluginMimeType ||
command_line->HasSwitch(switches::kEnablePlugins)) command_line->HasSwitch(switches::kEnablePlugins))
return false; return false;

View file

@ -107,7 +107,8 @@ void SecurityStateTabHelper::VisibleSecurityStateChanged() {
void SecurityStateTabHelper::DidStartNavigation( void SecurityStateTabHelper::DidStartNavigation(
content::NavigationHandle* navigation_handle) { content::NavigationHandle* navigation_handle) {
if (time_of_http_warning_on_current_navigation_.is_null() || if (time_of_http_warning_on_current_navigation_.is_null() ||
!navigation_handle->IsInMainFrame() || navigation_handle->IsSamePage()) { !navigation_handle->IsInMainFrame() ||
navigation_handle->IsSameDocument()) {
return; return;
} }
// Record how quickly a user leaves a site after encountering an // Record how quickly a user leaves a site after encountering an
@ -126,7 +127,8 @@ void SecurityStateTabHelper::DidStartNavigation(
void SecurityStateTabHelper::DidFinishNavigation( void SecurityStateTabHelper::DidFinishNavigation(
content::NavigationHandle* navigation_handle) { content::NavigationHandle* navigation_handle) {
if (navigation_handle->IsInMainFrame() && !navigation_handle->IsSamePage()) { if (navigation_handle->IsInMainFrame() &&
!navigation_handle->IsSameDocument()) {
// Only reset the console message flag for main-frame navigations, // Only reset the console message flag for main-frame navigations,
// and not for same-page navigations like reference fragments and pushState. // and not for same-page navigations like reference fragments and pushState.
logged_http_warning_on_current_navigation_ = false; logged_http_warning_on_current_navigation_ = false;

View file

@ -22,7 +22,7 @@ PrintMsg_Print_Params::PrintMsg_Print_Params()
preview_ui_id(-1), preview_ui_id(-1),
preview_request_id(0), preview_request_id(0),
is_first_request(false), is_first_request(false),
print_scaling_option(blink::WebPrintScalingOptionSourceSize), print_scaling_option(blink::kWebPrintScalingOptionSourceSize),
print_to_pdf(false), print_to_pdf(false),
display_header_footer(false), display_header_footer(false),
title(), title(),
@ -48,7 +48,7 @@ void PrintMsg_Print_Params::Reset() {
preview_ui_id = -1; preview_ui_id = -1;
preview_request_id = 0; preview_request_id = 0;
is_first_request = false; is_first_request = false;
print_scaling_option = blink::WebPrintScalingOptionSourceSize; print_scaling_option = blink::kWebPrintScalingOptionSourceSize;
print_to_pdf = false; print_to_pdf = false;
display_header_footer = false; display_header_footer = false;
title = base::string16(); title = base::string16();

View file

@ -79,7 +79,7 @@ IPC_ENUM_TRAITS_MIN_MAX_VALUE(printing::DuplexMode,
printing::UNKNOWN_DUPLEX_MODE, printing::UNKNOWN_DUPLEX_MODE,
printing::SHORT_EDGE) printing::SHORT_EDGE)
IPC_ENUM_TRAITS_MAX_VALUE(blink::WebPrintScalingOption, IPC_ENUM_TRAITS_MAX_VALUE(blink::WebPrintScalingOption,
blink::WebPrintScalingOptionLast) blink::kWebPrintScalingOptionLast)
// Parameters for a render request. // Parameters for a render request.
IPC_STRUCT_TRAITS_BEGIN(PrintMsg_Print_Params) IPC_STRUCT_TRAITS_BEGIN(PrintMsg_Print_Params)

View file

@ -96,7 +96,7 @@ PrintMsg_Print_Params GetCssPrintParams(
dpi, kPixelsPerInch); dpi, kPixelsPerInch);
if (frame) { if (frame) {
frame->pageSizeAndMarginsInPixels(page_index, frame->PageSizeAndMarginsInPixels(page_index,
page_size_in_pixels, page_size_in_pixels,
margin_top_in_pixels, margin_top_in_pixels,
margin_right_in_pixels, margin_right_in_pixels,
@ -104,9 +104,9 @@ PrintMsg_Print_Params GetCssPrintParams(
margin_left_in_pixels); margin_left_in_pixels);
} }
double new_content_width = page_size_in_pixels.width() - double new_content_width = page_size_in_pixels.Width() -
margin_left_in_pixels - margin_right_in_pixels; margin_left_in_pixels - margin_right_in_pixels;
double new_content_height = page_size_in_pixels.height() - double new_content_height = page_size_in_pixels.Height() -
margin_top_in_pixels - margin_bottom_in_pixels; margin_top_in_pixels - margin_bottom_in_pixels;
// Invalid page size and/or margins. We just use the default setting. // Invalid page size and/or margins. We just use the default setting.
@ -117,8 +117,8 @@ PrintMsg_Print_Params GetCssPrintParams(
} }
page_css_params.page_size = page_css_params.page_size =
gfx::Size(ConvertUnit(page_size_in_pixels.width(), kPixelsPerInch, dpi), gfx::Size(ConvertUnit(page_size_in_pixels.Width(), kPixelsPerInch, dpi),
ConvertUnit(page_size_in_pixels.height(), kPixelsPerInch, dpi)); ConvertUnit(page_size_in_pixels.Height(), kPixelsPerInch, dpi));
page_css_params.content_size = page_css_params.content_size =
gfx::Size(ConvertUnit(new_content_width, kPixelsPerInch, dpi), gfx::Size(ConvertUnit(new_content_width, kPixelsPerInch, dpi),
ConvertUnit(new_content_height, kPixelsPerInch, dpi)); ConvertUnit(new_content_height, kPixelsPerInch, dpi));
@ -214,53 +214,53 @@ void ComputeWebKitPrintParamsInDesiredDpi(
const PrintMsg_Print_Params& print_params, const PrintMsg_Print_Params& print_params,
blink::WebPrintParams* webkit_print_params) { blink::WebPrintParams* webkit_print_params) {
int dpi = GetDPI(&print_params); int dpi = GetDPI(&print_params);
webkit_print_params->printerDPI = dpi; webkit_print_params->printer_dpi = dpi;
webkit_print_params->printScalingOption = print_params.print_scaling_option; webkit_print_params->print_scaling_option = print_params.print_scaling_option;
webkit_print_params->printContentArea.width = webkit_print_params->print_content_area.width =
ConvertUnit(print_params.content_size.width(), dpi, ConvertUnit(print_params.content_size.width(), dpi,
print_params.desired_dpi); print_params.desired_dpi);
webkit_print_params->printContentArea.height = webkit_print_params->print_content_area.height =
ConvertUnit(print_params.content_size.height(), dpi, ConvertUnit(print_params.content_size.height(), dpi,
print_params.desired_dpi); print_params.desired_dpi);
webkit_print_params->printableArea.x = webkit_print_params->printable_area.x =
ConvertUnit(print_params.printable_area.x(), dpi, ConvertUnit(print_params.printable_area.x(), dpi,
print_params.desired_dpi); print_params.desired_dpi);
webkit_print_params->printableArea.y = webkit_print_params->printable_area.y =
ConvertUnit(print_params.printable_area.y(), dpi, ConvertUnit(print_params.printable_area.y(), dpi,
print_params.desired_dpi); print_params.desired_dpi);
webkit_print_params->printableArea.width = webkit_print_params->printable_area.width =
ConvertUnit(print_params.printable_area.width(), dpi, ConvertUnit(print_params.printable_area.width(), dpi,
print_params.desired_dpi); print_params.desired_dpi);
webkit_print_params->printableArea.height = webkit_print_params->printable_area.height =
ConvertUnit(print_params.printable_area.height(), ConvertUnit(print_params.printable_area.height(),
dpi, print_params.desired_dpi); dpi, print_params.desired_dpi);
webkit_print_params->paperSize.width = webkit_print_params->paper_size.width =
ConvertUnit(print_params.page_size.width(), dpi, ConvertUnit(print_params.page_size.width(), dpi,
print_params.desired_dpi); print_params.desired_dpi);
webkit_print_params->paperSize.height = webkit_print_params->paper_size.height =
ConvertUnit(print_params.page_size.height(), dpi, ConvertUnit(print_params.page_size.height(), dpi,
print_params.desired_dpi); print_params.desired_dpi);
} }
blink::WebPlugin* GetPlugin(const blink::WebFrame* frame) { blink::WebPlugin* GetPlugin(const blink::WebFrame* frame) {
return frame->document().isPluginDocument() ? return frame->GetDocument().IsPluginDocument() ?
frame->document().to<blink::WebPluginDocument>().plugin() : NULL; frame->GetDocument().To<blink::WebPluginDocument>().Plugin() : NULL;
} }
bool PrintingNodeOrPdfFrame(const blink::WebFrame* frame, bool PrintingNodeOrPdfFrame(const blink::WebFrame* frame,
const blink::WebNode& node) { const blink::WebNode& node) {
if (!node.isNull()) if (!node.IsNull())
return true; return true;
blink::WebPlugin* plugin = GetPlugin(frame); blink::WebPlugin* plugin = GetPlugin(frame);
return plugin && plugin->supportsPaginatedPrint(); return plugin && plugin->SupportsPaginatedPrint();
} }
MarginType GetMarginsForPdf(blink::WebFrame* frame, MarginType GetMarginsForPdf(blink::WebFrame* frame,
const blink::WebNode& node) { const blink::WebNode& node) {
if (frame->isPrintScalingDisabledForPlugin(node)) if (frame->IsPrintScalingDisabledForPlugin(node))
return NO_MARGINS; return NO_MARGINS;
else else
return PRINTABLE_AREA_MARGINS; return PRINTABLE_AREA_MARGINS;
@ -324,7 +324,7 @@ FrameReference::~FrameReference() {
void FrameReference::Reset(blink::WebLocalFrame* frame) { void FrameReference::Reset(blink::WebLocalFrame* frame) {
if (frame) { if (frame) {
view_ = frame->view(); view_ = frame->View();
frame_ = frame; frame_ = frame;
} else { } else {
view_ = NULL; view_ = NULL;
@ -335,8 +335,8 @@ void FrameReference::Reset(blink::WebLocalFrame* frame) {
blink::WebLocalFrame* FrameReference::GetFrame() { blink::WebLocalFrame* FrameReference::GetFrame() {
if (view_ == NULL || frame_ == NULL) if (view_ == NULL || frame_ == NULL)
return NULL; return NULL;
for (blink::WebFrame* frame = view_->mainFrame(); frame != NULL; for (blink::WebFrame* frame = view_->MainFrame(); frame != NULL;
frame = frame->traverseNext()) { frame = frame->TraverseNext()) {
if (frame == frame_) if (frame == frame_)
return frame_; return frame_;
} }
@ -357,7 +357,7 @@ float PrintWebViewHelper::RenderPageContent(blink::WebFrame* frame,
SkAutoCanvasRestore auto_restore(canvas, true); SkAutoCanvasRestore auto_restore(canvas, true);
canvas->translate((content_area.x() - canvas_area.x()) / scale_factor, canvas->translate((content_area.x() - canvas_area.x()) / scale_factor,
(content_area.y() - canvas_area.y()) / scale_factor); (content_area.y() - canvas_area.y()) / scale_factor);
return frame->printPage(page_number, canvas); return frame->PrintPage(page_number, canvas);
} }
// Class that calls the Begin and End print functions on the frame and changes // Class that calls the Begin and End print functions on the frame and changes
@ -395,16 +395,16 @@ class PrepareFrameAndViewForPrint : public blink::WebViewClient,
bool IsLoadingSelection() { bool IsLoadingSelection() {
// It's not selection if not |owns_web_view_|. // It's not selection if not |owns_web_view_|.
return owns_web_view_ && frame() && frame()->isLoading(); return owns_web_view_ && frame() && frame()->IsLoading();
} }
protected: protected:
// blink::WebViewClient override: // blink::WebViewClient override:
void didStopLoading() override; void DidStopLoading() override;
bool allowsBrokenNullLayerTreeView() const override; bool AllowsBrokenNullLayerTreeView() const override;
// blink::WebFrameClient: // blink::WebFrameClient:
blink::WebLocalFrame* createChildFrame( blink::WebLocalFrame* CreateChildFrame(
blink::WebLocalFrame* parent, blink::WebLocalFrame* parent,
blink::WebTreeScopeType scope, blink::WebTreeScopeType scope,
const blink::WebString& name, const blink::WebString& name,
@ -453,13 +453,13 @@ PrepareFrameAndViewForPrint::PrepareFrameAndViewForPrint(
!PrintingNodeOrPdfFrame(frame, node_to_print_)) { !PrintingNodeOrPdfFrame(frame, node_to_print_)) {
bool fit_to_page = ignore_css_margins && bool fit_to_page = ignore_css_margins &&
print_params.print_scaling_option == print_params.print_scaling_option ==
blink::WebPrintScalingOptionFitToPrintableArea; blink::kWebPrintScalingOptionFitToPrintableArea;
ComputeWebKitPrintParamsInDesiredDpi(params, &web_print_params_); ComputeWebKitPrintParamsInDesiredDpi(params, &web_print_params_);
frame->printBegin(web_print_params_, node_to_print_); frame->PrintBegin(web_print_params_, node_to_print_);
print_params = CalculatePrintParamsForCss(frame, 0, print_params, print_params = CalculatePrintParamsForCss(frame, 0, print_params,
ignore_css_margins, fit_to_page, ignore_css_margins, fit_to_page,
NULL); NULL);
frame->printEnd(); frame->PrintEnd();
} }
ComputeWebKitPrintParamsInDesiredDpi(print_params, &web_print_params_); ComputeWebKitPrintParamsInDesiredDpi(print_params, &web_print_params_);
} }
@ -475,8 +475,8 @@ void PrepareFrameAndViewForPrint::ResizeForPrinting() {
// minimum (default) scaling. // minimum (default) scaling.
// This is important for sites that try to fill the page. // This is important for sites that try to fill the page.
// The 1.25 value is |printingMinimumShrinkFactor|. // The 1.25 value is |printingMinimumShrinkFactor|.
gfx::Size print_layout_size(web_print_params_.printContentArea.width, gfx::Size print_layout_size(web_print_params_.print_content_area.width,
web_print_params_.printContentArea.height); web_print_params_.print_content_area.height);
print_layout_size.set_height( print_layout_size.set_height(
static_cast<int>(static_cast<double>(print_layout_size.height()) * 1.25)); static_cast<int>(static_cast<double>(print_layout_size.height()) * 1.25));
@ -485,22 +485,22 @@ void PrepareFrameAndViewForPrint::ResizeForPrinting() {
// Backup size and offset if it's a local frame. // Backup size and offset if it's a local frame.
blink::WebView* web_view = frame_.view(); blink::WebView* web_view = frame_.view();
if (blink::WebFrame* web_frame = web_view->mainFrame()) { if (blink::WebFrame* web_frame = web_view->MainFrame()) {
if (web_frame->isWebLocalFrame()) if (web_frame->IsWebLocalFrame())
prev_scroll_offset_ = web_frame->getScrollOffset(); prev_scroll_offset_ = web_frame->GetScrollOffset();
} }
prev_view_size_ = web_view->size(); prev_view_size_ = web_view->Size();
web_view->resize(print_layout_size); web_view->Resize(print_layout_size);
} }
void PrepareFrameAndViewForPrint::StartPrinting() { void PrepareFrameAndViewForPrint::StartPrinting() {
ResizeForPrinting(); ResizeForPrinting();
blink::WebView* web_view = frame_.view(); blink::WebView* web_view = frame_.view();
web_view->settings()->setShouldPrintBackgrounds(should_print_backgrounds_); web_view->GetSettings()->SetShouldPrintBackgrounds(should_print_backgrounds_);
expected_pages_count_ = expected_pages_count_ =
frame()->printBegin(web_print_params_, node_to_print_); frame()->PrintBegin(web_print_params_, node_to_print_);
is_printing_started_ = true; is_printing_started_ = true;
} }
@ -521,7 +521,7 @@ void PrepareFrameAndViewForPrint::CopySelection(
ResizeForPrinting(); ResizeForPrinting();
std::string url_str = "data:text/html;charset=utf-8,"; std::string url_str = "data:text/html;charset=utf-8,";
url_str.append( url_str.append(
net::EscapeQueryParamValue(frame()->selectionAsMarkup().utf8(), false)); net::EscapeQueryParamValue(frame()->SelectionAsMarkup().Utf8(), false));
RestoreSize(); RestoreSize();
// Create a new WebView with the same settings as the current display one. // Create a new WebView with the same settings as the current display one.
// Except that we disable javascript (don't want any active content running // Except that we disable javascript (don't want any active content running
@ -530,44 +530,44 @@ void PrepareFrameAndViewForPrint::CopySelection(
prefs.javascript_enabled = false; prefs.javascript_enabled = false;
blink::WebView* web_view = blink::WebView* web_view =
blink::WebView::create(this, blink::WebPageVisibilityStateVisible); blink::WebView::Create(this, blink::kWebPageVisibilityStateVisible);
owns_web_view_ = true; owns_web_view_ = true;
content::RenderView::ApplyWebPreferences(prefs, web_view); content::RenderView::ApplyWebPreferences(prefs, web_view);
blink::WebLocalFrame* main_frame = blink::WebLocalFrame::create( blink::WebLocalFrame* main_frame = blink::WebLocalFrame::Create(
blink::WebTreeScopeType::Document, this, nullptr, nullptr); blink::WebTreeScopeType::kDocument, this, nullptr, nullptr);
web_view->setMainFrame(main_frame); web_view->SetMainFrame(main_frame);
blink::WebFrameWidget::create(this, web_view, main_frame); blink::WebFrameWidget::Create(this, web_view, main_frame);
frame_.Reset(web_view->mainFrame()->toWebLocalFrame()); frame_.Reset(web_view->MainFrame()->ToWebLocalFrame());
node_to_print_.reset(); node_to_print_.Reset();
// When loading is done this will call didStopLoading() and that will do the // When loading is done this will call DidStopLoading() and that will do the
// actual printing. // actual printing.
frame()->loadRequest(blink::WebURLRequest(GURL(url_str))); frame()->LoadRequest(blink::WebURLRequest(GURL(url_str)));
} }
bool PrepareFrameAndViewForPrint::allowsBrokenNullLayerTreeView() const { bool PrepareFrameAndViewForPrint::AllowsBrokenNullLayerTreeView() const {
return true; return true;
} }
void PrepareFrameAndViewForPrint::didStopLoading() { void PrepareFrameAndViewForPrint::DidStopLoading() {
DCHECK(!on_ready_.is_null()); DCHECK(!on_ready_.is_null());
// Don't call callback here, because it can delete |this| and WebView that is // Don't call callback here, because it can delete |this| and WebView that is
// called didStopLoading. // called DidStopLoading.
base::ThreadTaskRunnerHandle::Get()->PostTask( base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&PrepareFrameAndViewForPrint::CallOnReady, FROM_HERE, base::Bind(&PrepareFrameAndViewForPrint::CallOnReady,
weak_ptr_factory_.GetWeakPtr())); weak_ptr_factory_.GetWeakPtr()));
} }
blink::WebLocalFrame* PrepareFrameAndViewForPrint::createChildFrame( blink::WebLocalFrame* PrepareFrameAndViewForPrint::CreateChildFrame(
blink::WebLocalFrame* parent, blink::WebLocalFrame* parent,
blink::WebTreeScopeType scope, blink::WebTreeScopeType scope,
const blink::WebString& name, const blink::WebString& name,
const blink::WebString& unique_name, const blink::WebString& unique_name,
blink::WebSandboxFlags sandbox_flags, blink::WebSandboxFlags sandbox_flags,
const blink::WebFrameOwnerProperties& frame_owner_properties) { const blink::WebFrameOwnerProperties& frame_owner_properties) {
blink::WebLocalFrame* frame = blink::WebLocalFrame::create( blink::WebLocalFrame* frame = blink::WebLocalFrame::Create(
scope, this, nullptr, nullptr); scope, this, nullptr, nullptr);
parent->appendChild(frame); parent->AppendChild(frame);
return frame; return frame;
} }
@ -579,30 +579,30 @@ void PrepareFrameAndViewForPrint::RestoreSize() {
if (!frame()) if (!frame())
return; return;
blink::WebView* web_view = frame_.GetFrame()->view(); blink::WebView* web_view = frame_.GetFrame()->View();
web_view->resize(prev_view_size_); web_view->Resize(prev_view_size_);
if (blink::WebFrame* web_frame = web_view->mainFrame()) { if (blink::WebFrame* web_frame = web_view->MainFrame()) {
if (web_frame->isWebLocalFrame()) if (web_frame->IsWebLocalFrame())
web_frame->setScrollOffset(prev_scroll_offset_); web_frame->SetScrollOffset(prev_scroll_offset_);
} }
} }
void PrepareFrameAndViewForPrint::FinishPrinting() { void PrepareFrameAndViewForPrint::FinishPrinting() {
blink::WebLocalFrame* frame = frame_.GetFrame(); blink::WebLocalFrame* frame = frame_.GetFrame();
if (frame) { if (frame) {
blink::WebView* web_view = frame->view(); blink::WebView* web_view = frame->View();
if (is_printing_started_) { if (is_printing_started_) {
is_printing_started_ = false; is_printing_started_ = false;
frame->printEnd(); frame->PrintEnd();
if (!owns_web_view_) { if (!owns_web_view_) {
web_view->settings()->setShouldPrintBackgrounds(false); web_view->GetSettings()->SetShouldPrintBackgrounds(false);
RestoreSize(); RestoreSize();
} }
} }
if (owns_web_view_) { if (owns_web_view_) {
DCHECK(!frame->isLoading()); DCHECK(!frame->IsLoading());
owns_web_view_ = false; owns_web_view_ = false;
web_view->close(); web_view->Close();
} }
} }
frame_.Reset(NULL); frame_.Reset(NULL);
@ -825,7 +825,7 @@ bool PrintWebViewHelper::FinalizePrintReadyDocument() {
} }
void PrintWebViewHelper::PrintNode(const blink::WebNode& node) { void PrintWebViewHelper::PrintNode(const blink::WebNode& node) {
if (node.isNull() || !node.document().frame()) { if (node.IsNull() || !node.GetDocument().GetFrame()) {
// This can occur when the context menu refers to an invalid WebNode. // This can occur when the context menu refers to an invalid WebNode.
// See http://crbug.com/100890#c17 for a repro case. // See http://crbug.com/100890#c17 for a repro case.
return; return;
@ -840,7 +840,7 @@ void PrintWebViewHelper::PrintNode(const blink::WebNode& node) {
print_node_in_progress_ = true; print_node_in_progress_ = true;
blink::WebNode duplicate_node(node); blink::WebNode duplicate_node(node);
Print(duplicate_node.document().frame(), duplicate_node); Print(duplicate_node.GetDocument().GetFrame(), duplicate_node);
print_node_in_progress_ = false; print_node_in_progress_ = false;
} }
@ -988,7 +988,7 @@ void PrintWebViewHelper::ComputePageLayoutInPointsForCss(
PrintMsg_Print_Params params = CalculatePrintParamsForCss( PrintMsg_Print_Params params = CalculatePrintParamsForCss(
frame, page_index, page_params, ignore_css_margins, frame, page_index, page_params, ignore_css_margins,
page_params.print_scaling_option == page_params.print_scaling_option ==
blink::WebPrintScalingOptionFitToPrintableArea, blink::kWebPrintScalingOptionFitToPrintableArea,
scale_factor); scale_factor);
CalculatePageLayoutFromPrintParams(params, page_layout_in_points); CalculatePageLayoutFromPrintParams(params, page_layout_in_points);
} }
@ -1015,10 +1015,10 @@ bool PrintWebViewHelper::InitPrintSettings(bool fit_to_paper_size,
settings.pages.clear(); settings.pages.clear();
settings.params.print_scaling_option = settings.params.print_scaling_option =
blink::WebPrintScalingOptionSourceSize; blink::kWebPrintScalingOptionSourceSize;
if (fit_to_paper_size) { if (fit_to_paper_size) {
settings.params.print_scaling_option = settings.params.print_scaling_option =
blink::WebPrintScalingOptionFitToPrintableArea; blink::kWebPrintScalingOptionFitToPrintableArea;
} }
SetPrintPagesParams(settings); SetPrintPagesParams(settings);
@ -1092,7 +1092,7 @@ bool PrintWebViewHelper::UpdatePrintSettings(
settings.params.print_to_pdf = true; settings.params.print_to_pdf = true;
UpdateFrameMarginsCssInfo(*job_settings); UpdateFrameMarginsCssInfo(*job_settings);
settings.params.print_scaling_option = settings.params.print_scaling_option =
blink::WebPrintScalingOptionSourceSize; blink::kWebPrintScalingOptionSourceSize;
} }
SetPrintPagesParams(settings); SetPrintPagesParams(settings);
@ -1114,7 +1114,7 @@ bool PrintWebViewHelper::GetPrintSettingsFromUser(blink::WebLocalFrame* frame,
PrintMsg_PrintPages_Params print_settings; PrintMsg_PrintPages_Params print_settings;
params.cookie = print_pages_params_->params.document_cookie; params.cookie = print_pages_params_->params.document_cookie;
params.has_selection = frame->hasSelection(); params.has_selection = frame->HasSelection();
params.expected_pages_count = expected_pages_count; params.expected_pages_count = expected_pages_count;
MarginType margin_type = DEFAULT_MARGINS; MarginType margin_type = DEFAULT_MARGINS;
if (PrintingNodeOrPdfFrame(frame, node)) if (PrintingNodeOrPdfFrame(frame, node))
@ -1225,16 +1225,16 @@ void PrintWebViewHelper::PrintPreviewContext::InitWithFrame(
DCHECK(!IsRendering()); DCHECK(!IsRendering());
state_ = INITIALIZED; state_ = INITIALIZED;
source_frame_.Reset(web_frame); source_frame_.Reset(web_frame);
source_node_.reset(); source_node_.Reset();
} }
void PrintWebViewHelper::PrintPreviewContext::InitWithNode( void PrintWebViewHelper::PrintPreviewContext::InitWithNode(
const blink::WebNode& web_node) { const blink::WebNode& web_node) {
DCHECK(!web_node.isNull()); DCHECK(!web_node.IsNull());
DCHECK(web_node.document().frame()); DCHECK(web_node.GetDocument().GetFrame());
DCHECK(!IsRendering()); DCHECK(!IsRendering());
state_ = INITIALIZED; state_ = INITIALIZED;
source_frame_.Reset(web_node.document().frame()); source_frame_.Reset(web_node.GetDocument().GetFrame());
source_node_ = web_node; source_node_ = web_node;
} }
@ -1367,7 +1367,7 @@ bool PrintWebViewHelper::PrintPreviewContext::IsModifiable() {
} }
bool PrintWebViewHelper::PrintPreviewContext::HasSelection() { bool PrintWebViewHelper::PrintPreviewContext::HasSelection() {
return IsModifiable() && source_frame()->hasSelection(); return IsModifiable() && source_frame()->HasSelection();
} }
bool PrintWebViewHelper::PrintPreviewContext::IsLastPageOfPrintReadyMetafile() bool PrintWebViewHelper::PrintPreviewContext::IsLastPageOfPrintReadyMetafile()

View file

@ -94,7 +94,7 @@ void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params,
gfx::Size* page_size, gfx::Size* page_size,
gfx::Rect* content_rect) { gfx::Rect* content_rect) {
double scale_factor = 1.0f; double scale_factor = 1.0f;
double webkit_shrink_factor = frame->getPrintPageShrink(page_number); double webkit_shrink_factor = frame->GetPrintPageShrink(page_number);
PageSizeMargins page_layout_in_points; PageSizeMargins page_layout_in_points;
gfx::Rect content_area; gfx::Rect content_area;

View file

@ -52,35 +52,35 @@ bool TtsDispatcher::OnControlMessageReceived(const IPC::Message& message) {
return false; return false;
} }
void TtsDispatcher::updateVoiceList() { void TtsDispatcher::UpdateVoiceList() {
RenderThread::Get()->Send(new TtsHostMsg_InitializeVoiceList()); RenderThread::Get()->Send(new TtsHostMsg_InitializeVoiceList());
} }
void TtsDispatcher::speak(const WebSpeechSynthesisUtterance& web_utterance) { void TtsDispatcher::Speak(const WebSpeechSynthesisUtterance& web_utterance) {
int id = next_utterance_id_++; int id = next_utterance_id_++;
utterance_id_map_[id] = web_utterance; utterance_id_map_[id] = web_utterance;
TtsUtteranceRequest utterance; TtsUtteranceRequest utterance;
utterance.id = id; utterance.id = id;
utterance.text = web_utterance.text().utf8(); utterance.text = web_utterance.GetText().Utf8();
utterance.lang = web_utterance.lang().utf8(); utterance.lang = web_utterance.Lang().Utf8();
utterance.voice = web_utterance.voice().utf8(); utterance.voice = web_utterance.Voice().Utf8();
utterance.volume = web_utterance.volume(); utterance.volume = web_utterance.Volume();
utterance.rate = web_utterance.rate(); utterance.rate = web_utterance.Rate();
utterance.pitch = web_utterance.pitch(); utterance.pitch = web_utterance.Pitch();
RenderThread::Get()->Send(new TtsHostMsg_Speak(utterance)); RenderThread::Get()->Send(new TtsHostMsg_Speak(utterance));
} }
void TtsDispatcher::pause() { void TtsDispatcher::Pause() {
RenderThread::Get()->Send(new TtsHostMsg_Pause()); RenderThread::Get()->Send(new TtsHostMsg_Pause());
} }
void TtsDispatcher::resume() { void TtsDispatcher::Resume() {
RenderThread::Get()->Send(new TtsHostMsg_Resume()); RenderThread::Get()->Send(new TtsHostMsg_Resume());
} }
void TtsDispatcher::cancel() { void TtsDispatcher::Cancel() {
RenderThread::Get()->Send(new TtsHostMsg_Cancel()); RenderThread::Get()->Send(new TtsHostMsg_Cancel());
} }
@ -96,13 +96,13 @@ void TtsDispatcher::OnSetVoiceList(const std::vector<TtsVoice>& voices) {
WebVector<WebSpeechSynthesisVoice> out_voices(voices.size()); WebVector<WebSpeechSynthesisVoice> out_voices(voices.size());
for (size_t i = 0; i < voices.size(); ++i) { for (size_t i = 0; i < voices.size(); ++i) {
out_voices[i] = WebSpeechSynthesisVoice(); out_voices[i] = WebSpeechSynthesisVoice();
out_voices[i].setVoiceURI(WebString::fromUTF8(voices[i].voice_uri)); out_voices[i].SetVoiceURI(WebString::FromUTF8(voices[i].voice_uri));
out_voices[i].setName(WebString::fromUTF8(voices[i].name)); out_voices[i].SetName(WebString::FromUTF8(voices[i].name));
out_voices[i].setLanguage(WebString::fromUTF8(voices[i].lang)); out_voices[i].SetLanguage(WebString::FromUTF8(voices[i].lang));
out_voices[i].setIsLocalService(voices[i].local_service); out_voices[i].SetIsLocalService(voices[i].local_service);
out_voices[i].setIsDefault(voices[i].is_default); out_voices[i].SetIsDefault(voices[i].is_default);
} }
synthesizer_client_->setVoiceList(out_voices); synthesizer_client_->SetVoiceList(out_voices);
} }
void TtsDispatcher::OnDidStartSpeaking(int utterance_id) { void TtsDispatcher::OnDidStartSpeaking(int utterance_id) {
@ -110,45 +110,45 @@ void TtsDispatcher::OnDidStartSpeaking(int utterance_id) {
return; return;
WebSpeechSynthesisUtterance utterance = FindUtterance(utterance_id); WebSpeechSynthesisUtterance utterance = FindUtterance(utterance_id);
if (utterance.isNull()) if (utterance.IsNull())
return; return;
synthesizer_client_->didStartSpeaking(utterance); synthesizer_client_->DidStartSpeaking(utterance);
} }
void TtsDispatcher::OnDidFinishSpeaking(int utterance_id) { void TtsDispatcher::OnDidFinishSpeaking(int utterance_id) {
WebSpeechSynthesisUtterance utterance = FindUtterance(utterance_id); WebSpeechSynthesisUtterance utterance = FindUtterance(utterance_id);
if (utterance.isNull()) if (utterance.IsNull())
return; return;
synthesizer_client_->didFinishSpeaking(utterance); synthesizer_client_->DidFinishSpeaking(utterance);
utterance_id_map_.erase(utterance_id); utterance_id_map_.erase(utterance_id);
} }
void TtsDispatcher::OnDidPauseSpeaking(int utterance_id) { void TtsDispatcher::OnDidPauseSpeaking(int utterance_id) {
WebSpeechSynthesisUtterance utterance = FindUtterance(utterance_id); WebSpeechSynthesisUtterance utterance = FindUtterance(utterance_id);
if (utterance.isNull()) if (utterance.IsNull())
return; return;
synthesizer_client_->didPauseSpeaking(utterance); synthesizer_client_->DidPauseSpeaking(utterance);
} }
void TtsDispatcher::OnDidResumeSpeaking(int utterance_id) { void TtsDispatcher::OnDidResumeSpeaking(int utterance_id) {
WebSpeechSynthesisUtterance utterance = FindUtterance(utterance_id); WebSpeechSynthesisUtterance utterance = FindUtterance(utterance_id);
if (utterance.isNull()) if (utterance.IsNull())
return; return;
synthesizer_client_->didResumeSpeaking(utterance); synthesizer_client_->DidResumeSpeaking(utterance);
} }
void TtsDispatcher::OnWordBoundary(int utterance_id, int char_index) { void TtsDispatcher::OnWordBoundary(int utterance_id, int char_index) {
CHECK(char_index >= 0); CHECK(char_index >= 0);
WebSpeechSynthesisUtterance utterance = FindUtterance(utterance_id); WebSpeechSynthesisUtterance utterance = FindUtterance(utterance_id);
if (utterance.isNull()) if (utterance.IsNull())
return; return;
synthesizer_client_->wordBoundaryEventOccurred( synthesizer_client_->WordBoundaryEventOccurred(
utterance, static_cast<unsigned>(char_index)); utterance, static_cast<unsigned>(char_index));
} }
@ -156,10 +156,10 @@ void TtsDispatcher::OnSentenceBoundary(int utterance_id, int char_index) {
CHECK(char_index >= 0); CHECK(char_index >= 0);
WebSpeechSynthesisUtterance utterance = FindUtterance(utterance_id); WebSpeechSynthesisUtterance utterance = FindUtterance(utterance_id);
if (utterance.isNull()) if (utterance.IsNull())
return; return;
synthesizer_client_->sentenceBoundaryEventOccurred( synthesizer_client_->SentenceBoundaryEventOccurred(
utterance, static_cast<unsigned>(char_index)); utterance, static_cast<unsigned>(char_index));
} }
@ -169,31 +169,31 @@ void TtsDispatcher::OnMarkerEvent(int utterance_id, int char_index) {
void TtsDispatcher::OnWasInterrupted(int utterance_id) { void TtsDispatcher::OnWasInterrupted(int utterance_id) {
WebSpeechSynthesisUtterance utterance = FindUtterance(utterance_id); WebSpeechSynthesisUtterance utterance = FindUtterance(utterance_id);
if (utterance.isNull()) if (utterance.IsNull())
return; return;
// The web speech API doesn't support "interrupted". // The web speech API doesn't support "interrupted".
synthesizer_client_->didFinishSpeaking(utterance); synthesizer_client_->DidFinishSpeaking(utterance);
utterance_id_map_.erase(utterance_id); utterance_id_map_.erase(utterance_id);
} }
void TtsDispatcher::OnWasCancelled(int utterance_id) { void TtsDispatcher::OnWasCancelled(int utterance_id) {
WebSpeechSynthesisUtterance utterance = FindUtterance(utterance_id); WebSpeechSynthesisUtterance utterance = FindUtterance(utterance_id);
if (utterance.isNull()) if (utterance.IsNull())
return; return;
// The web speech API doesn't support "cancelled". // The web speech API doesn't support "cancelled".
synthesizer_client_->didFinishSpeaking(utterance); synthesizer_client_->DidFinishSpeaking(utterance);
utterance_id_map_.erase(utterance_id); utterance_id_map_.erase(utterance_id);
} }
void TtsDispatcher::OnSpeakingErrorOccurred(int utterance_id, void TtsDispatcher::OnSpeakingErrorOccurred(int utterance_id,
const std::string& error_message) { const std::string& error_message) {
WebSpeechSynthesisUtterance utterance = FindUtterance(utterance_id); WebSpeechSynthesisUtterance utterance = FindUtterance(utterance_id);
if (utterance.isNull()) if (utterance.IsNull())
return; return;
// The web speech API doesn't support an error message. // The web speech API doesn't support an error message.
synthesizer_client_->speakingErrorOccurred(utterance); synthesizer_client_->SpeakingErrorOccurred(utterance);
utterance_id_map_.erase(utterance_id); utterance_id_map_.erase(utterance_id);
} }

View file

@ -38,12 +38,12 @@ class TtsDispatcher
virtual bool OnControlMessageReceived(const IPC::Message& message) override; virtual bool OnControlMessageReceived(const IPC::Message& message) override;
// blink::WebSpeechSynthesizer implementation. // blink::WebSpeechSynthesizer implementation.
virtual void updateVoiceList() override; virtual void UpdateVoiceList() override;
virtual void speak(const blink::WebSpeechSynthesisUtterance& utterance) virtual void Speak(const blink::WebSpeechSynthesisUtterance& utterance)
override; override;
virtual void pause() override; virtual void Pause() override;
virtual void resume() override; virtual void Resume() override;
virtual void cancel() override; virtual void Cancel() override;
blink::WebSpeechSynthesisUtterance FindUtterance(int utterance_id); blink::WebSpeechSynthesisUtterance FindUtterance(int utterance_id);

View file

@ -75,7 +75,7 @@ int32_t PepperPDFHost::OnHostMsgSaveAs(
GURL url = instance->GetPluginURL(); GURL url = instance->GetPluginURL();
content::Referrer referrer; content::Referrer referrer;
referrer.url = url; referrer.url = url;
referrer.policy = blink::WebReferrerPolicyDefault; referrer.policy = blink::kWebReferrerPolicyDefault;
referrer = content::Referrer::SanitizeForRequest(url, referrer); referrer = content::Referrer::SanitizeForRequest(url, referrer);
render_frame->Send( render_frame->Send(
new PDFHostMsg_PDFSaveURLAs(render_frame->GetRoutingID(), url, referrer)); new PDFHostMsg_PDFSaveURLAs(render_frame->GetRoutingID(), url, referrer));