Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1266 | 1266 |
| 1267 bool RenderViewImpl::DoesRenderWidgetHaveTouchEventHandlersAt( | 1267 bool RenderViewImpl::DoesRenderWidgetHaveTouchEventHandlersAt( |
| 1268 const gfx::Point& point) const { | 1268 const gfx::Point& point) const { |
| 1269 if (!webview()) | 1269 if (!webview()) |
| 1270 return false; | 1270 return false; |
| 1271 return webview()->hasTouchEventHandlersAt(point); | 1271 return webview()->hasTouchEventHandlersAt(point); |
| 1272 } | 1272 } |
| 1273 | 1273 |
| 1274 bool RenderViewImpl::RenderWidgetWillHandleGestureEvent( | 1274 bool RenderViewImpl::RenderWidgetWillHandleGestureEvent( |
| 1275 const blink::WebGestureEvent& event) { | 1275 const blink::WebGestureEvent& event) { |
| 1276 possible_drag_event_info_.event_source = | 1276 GetWidget()->set_possible_drag_event_info( |
| 1277 ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH; | 1277 ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH, |
| 1278 possible_drag_event_info_.event_location = | 1278 gfx::Point(event.globalX, event.globalY)); |
| 1279 gfx::Point(event.globalX, event.globalY); | |
| 1280 return false; | 1279 return false; |
| 1281 } | 1280 } |
| 1282 | 1281 |
| 1283 bool RenderViewImpl::RenderWidgetWillHandleMouseEvent( | 1282 bool RenderViewImpl::RenderWidgetWillHandleMouseEvent( |
| 1284 const blink::WebMouseEvent& event) { | 1283 const blink::WebMouseEvent& event) { |
| 1285 possible_drag_event_info_.event_source = | 1284 GetWidget()->set_possible_drag_event_info( |
|
dcheng
2016/11/03 21:22:52
Does this still need to go through the RenderWidge
paulmeyer
2016/11/04 19:01:18
Done.
| |
| 1286 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE; | 1285 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE, |
| 1287 possible_drag_event_info_.event_location = | 1286 gfx::Point(event.globalX, event.globalY)); |
| 1288 gfx::Point(event.globalX, event.globalY); | |
| 1289 | 1287 |
| 1290 // If the mouse is locked, only the current owner of the mouse lock can | 1288 // If the mouse is locked, only the current owner of the mouse lock can |
| 1291 // process mouse events. | 1289 // process mouse events. |
| 1292 return mouse_lock_dispatcher_->WillHandleMouseEvent(event); | 1290 return mouse_lock_dispatcher_->WillHandleMouseEvent(event); |
| 1293 } | 1291 } |
| 1294 | 1292 |
| 1295 // IPC::Listener implementation ---------------------------------------------- | 1293 // IPC::Listener implementation ---------------------------------------------- |
| 1296 | 1294 |
| 1297 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { | 1295 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { |
| 1298 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; | 1296 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1815 void RenderViewImpl::setMouseOverURL(const WebURL& url) { | 1813 void RenderViewImpl::setMouseOverURL(const WebURL& url) { |
| 1816 mouse_over_url_ = GURL(url); | 1814 mouse_over_url_ = GURL(url); |
| 1817 UpdateTargetURL(mouse_over_url_, focus_url_); | 1815 UpdateTargetURL(mouse_over_url_, focus_url_); |
| 1818 } | 1816 } |
| 1819 | 1817 |
| 1820 void RenderViewImpl::setKeyboardFocusURL(const WebURL& url) { | 1818 void RenderViewImpl::setKeyboardFocusURL(const WebURL& url) { |
| 1821 focus_url_ = GURL(url); | 1819 focus_url_ = GURL(url); |
| 1822 UpdateTargetURL(focus_url_, mouse_over_url_); | 1820 UpdateTargetURL(focus_url_, mouse_over_url_); |
| 1823 } | 1821 } |
| 1824 | 1822 |
| 1825 void RenderViewImpl::startDragging(WebLocalFrame* frame, | |
| 1826 const WebDragData& data, | |
| 1827 WebDragOperationsMask mask, | |
| 1828 const WebImage& image, | |
| 1829 const WebPoint& webImageOffset) { | |
| 1830 blink::WebRect offset_in_window(webImageOffset.x, webImageOffset.y, 0, 0); | |
| 1831 ConvertViewportToWindowViaWidget(&offset_in_window); | |
| 1832 DropData drop_data(DropDataBuilder::Build(data)); | |
| 1833 drop_data.referrer_policy = frame->document().referrerPolicy(); | |
| 1834 gfx::Vector2d imageOffset(offset_in_window.x, offset_in_window.y); | |
| 1835 Send(new DragHostMsg_StartDragging(GetRoutingID(), drop_data, mask, | |
| 1836 image.getSkBitmap(), imageOffset, | |
| 1837 possible_drag_event_info_)); | |
| 1838 } | |
| 1839 | |
| 1840 bool RenderViewImpl::acceptsLoadDrops() { | 1823 bool RenderViewImpl::acceptsLoadDrops() { |
| 1841 return renderer_preferences_.can_accept_load_drops; | 1824 return renderer_preferences_.can_accept_load_drops; |
| 1842 } | 1825 } |
| 1843 | 1826 |
| 1844 void RenderViewImpl::focusNext() { | 1827 void RenderViewImpl::focusNext() { |
| 1845 Send(new ViewHostMsg_TakeFocus(GetRoutingID(), false)); | 1828 Send(new ViewHostMsg_TakeFocus(GetRoutingID(), false)); |
| 1846 } | 1829 } |
| 1847 | 1830 |
| 1848 void RenderViewImpl::focusPrevious() { | 1831 void RenderViewImpl::focusPrevious() { |
| 1849 Send(new ViewHostMsg_TakeFocus(GetRoutingID(), true)); | 1832 Send(new ViewHostMsg_TakeFocus(GetRoutingID(), true)); |
| (...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3043 NotifyInputEventHandled(input_event->type, | 3026 NotifyInputEventHandled(input_event->type, |
| 3044 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3027 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3045 } | 3028 } |
| 3046 | 3029 |
| 3047 std::unique_ptr<InputEventAck> ack( | 3030 std::unique_ptr<InputEventAck> ack( |
| 3048 new InputEventAck(input_event->type, INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); | 3031 new InputEventAck(input_event->type, INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); |
| 3049 OnInputEventAck(std::move(ack)); | 3032 OnInputEventAck(std::move(ack)); |
| 3050 } | 3033 } |
| 3051 | 3034 |
| 3052 } // namespace content | 3035 } // namespace content |
| OLD | NEW |