| 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 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1260 observer.FocusChangeComplete(); | 1260 observer.FocusChangeComplete(); |
| 1261 } | 1261 } |
| 1262 | 1262 |
| 1263 bool RenderViewImpl::DoesRenderWidgetHaveTouchEventHandlersAt( | 1263 bool RenderViewImpl::DoesRenderWidgetHaveTouchEventHandlersAt( |
| 1264 const gfx::Point& point) const { | 1264 const gfx::Point& point) const { |
| 1265 if (!webview()) | 1265 if (!webview()) |
| 1266 return false; | 1266 return false; |
| 1267 return webview()->hasTouchEventHandlersAt(point); | 1267 return webview()->hasTouchEventHandlersAt(point); |
| 1268 } | 1268 } |
| 1269 | 1269 |
| 1270 bool RenderViewImpl::RenderWidgetWillHandleGestureEvent( | |
| 1271 const blink::WebGestureEvent& event) { | |
| 1272 possible_drag_event_info_.event_source = | |
| 1273 ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH; | |
| 1274 possible_drag_event_info_.event_location = | |
| 1275 gfx::Point(event.globalX, event.globalY); | |
| 1276 return false; | |
| 1277 } | |
| 1278 | |
| 1279 bool RenderViewImpl::RenderWidgetWillHandleMouseEvent( | 1270 bool RenderViewImpl::RenderWidgetWillHandleMouseEvent( |
| 1280 const blink::WebMouseEvent& event) { | 1271 const blink::WebMouseEvent& event) { |
| 1281 possible_drag_event_info_.event_source = | |
| 1282 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE; | |
| 1283 possible_drag_event_info_.event_location = | |
| 1284 gfx::Point(event.globalX, event.globalY); | |
| 1285 | |
| 1286 // If the mouse is locked, only the current owner of the mouse lock can | 1272 // If the mouse is locked, only the current owner of the mouse lock can |
| 1287 // process mouse events. | 1273 // process mouse events. |
| 1288 return mouse_lock_dispatcher_->WillHandleMouseEvent(event); | 1274 return mouse_lock_dispatcher_->WillHandleMouseEvent(event); |
| 1289 } | 1275 } |
| 1290 | 1276 |
| 1291 // IPC::Listener implementation ---------------------------------------------- | 1277 // IPC::Listener implementation ---------------------------------------------- |
| 1292 | 1278 |
| 1293 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { | 1279 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { |
| 1294 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; | 1280 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; |
| 1295 if (main_frame && main_frame->isWebLocalFrame()) | 1281 if (main_frame && main_frame->isWebLocalFrame()) |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1816 void RenderViewImpl::setMouseOverURL(const WebURL& url) { | 1802 void RenderViewImpl::setMouseOverURL(const WebURL& url) { |
| 1817 mouse_over_url_ = GURL(url); | 1803 mouse_over_url_ = GURL(url); |
| 1818 UpdateTargetURL(mouse_over_url_, focus_url_); | 1804 UpdateTargetURL(mouse_over_url_, focus_url_); |
| 1819 } | 1805 } |
| 1820 | 1806 |
| 1821 void RenderViewImpl::setKeyboardFocusURL(const WebURL& url) { | 1807 void RenderViewImpl::setKeyboardFocusURL(const WebURL& url) { |
| 1822 focus_url_ = GURL(url); | 1808 focus_url_ = GURL(url); |
| 1823 UpdateTargetURL(focus_url_, mouse_over_url_); | 1809 UpdateTargetURL(focus_url_, mouse_over_url_); |
| 1824 } | 1810 } |
| 1825 | 1811 |
| 1826 void RenderViewImpl::startDragging(WebLocalFrame* frame, | |
| 1827 const WebDragData& data, | |
| 1828 WebDragOperationsMask mask, | |
| 1829 const WebImage& image, | |
| 1830 const WebPoint& webImageOffset) { | |
| 1831 blink::WebRect offset_in_window(webImageOffset.x, webImageOffset.y, 0, 0); | |
| 1832 ConvertViewportToWindowViaWidget(&offset_in_window); | |
| 1833 DropData drop_data(DropDataBuilder::Build(data)); | |
| 1834 drop_data.referrer_policy = frame->document().referrerPolicy(); | |
| 1835 gfx::Vector2d imageOffset(offset_in_window.x, offset_in_window.y); | |
| 1836 Send(new DragHostMsg_StartDragging(GetRoutingID(), drop_data, mask, | |
| 1837 image.getSkBitmap(), imageOffset, | |
| 1838 possible_drag_event_info_)); | |
| 1839 } | |
| 1840 | |
| 1841 bool RenderViewImpl::acceptsLoadDrops() { | 1812 bool RenderViewImpl::acceptsLoadDrops() { |
| 1842 return renderer_preferences_.can_accept_load_drops; | 1813 return renderer_preferences_.can_accept_load_drops; |
| 1843 } | 1814 } |
| 1844 | 1815 |
| 1845 void RenderViewImpl::focusNext() { | 1816 void RenderViewImpl::focusNext() { |
| 1846 Send(new ViewHostMsg_TakeFocus(GetRoutingID(), false)); | 1817 Send(new ViewHostMsg_TakeFocus(GetRoutingID(), false)); |
| 1847 } | 1818 } |
| 1848 | 1819 |
| 1849 void RenderViewImpl::focusPrevious() { | 1820 void RenderViewImpl::focusPrevious() { |
| 1850 Send(new ViewHostMsg_TakeFocus(GetRoutingID(), true)); | 1821 Send(new ViewHostMsg_TakeFocus(GetRoutingID(), true)); |
| (...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2995 NotifyInputEventHandled(input_event->type, | 2966 NotifyInputEventHandled(input_event->type, |
| 2996 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 2967 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 2997 } | 2968 } |
| 2998 | 2969 |
| 2999 std::unique_ptr<InputEventAck> ack( | 2970 std::unique_ptr<InputEventAck> ack( |
| 3000 new InputEventAck(input_event->type, INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); | 2971 new InputEventAck(input_event->type, INPUT_EVENT_ACK_STATE_NOT_CONSUMED)); |
| 3001 OnInputEventAck(std::move(ack)); | 2972 OnInputEventAck(std::move(ack)); |
| 3002 } | 2973 } |
| 3003 | 2974 |
| 3004 } // namespace content | 2975 } // namespace content |
| OLD | NEW |