| 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_widget.h" | 5 #include "content/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/feature_list.h" | 13 #include "base/feature_list.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
| 17 #include "base/memory/singleton.h" | 17 #include "base/memory/singleton.h" |
| 18 #include "base/message_loop/message_loop.h" | 18 #include "base/message_loop/message_loop.h" |
| 19 #include "base/metrics/histogram_macros.h" | 19 #include "base/metrics/histogram_macros.h" |
| 20 #include "base/stl_util.h" | 20 #include "base/stl_util.h" |
| 21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 22 #include "base/sys_info.h" | 22 #include "base/sys_info.h" |
| 23 #include "base/trace_event/trace_event.h" | 23 #include "base/trace_event/trace_event.h" |
| 24 #include "base/trace_event/trace_event_synthetic_delay.h" | 24 #include "base/trace_event/trace_event_synthetic_delay.h" |
| 25 #include "build/build_config.h" | 25 #include "build/build_config.h" |
| 26 #include "cc/output/compositor_frame_sink.h" | 26 #include "cc/output/compositor_frame_sink.h" |
| 27 #include "cc/output/copy_output_request.h" | 27 #include "cc/output/copy_output_request.h" |
| 28 #include "cc/scheduler/begin_frame_source.h" | 28 #include "cc/scheduler/begin_frame_source.h" |
| 29 #include "content/common/content_switches_internal.h" | 29 #include "content/common/content_switches_internal.h" |
| 30 #include "content/common/drag_event_source_info.h" |
| 31 #include "content/common/drag_messages.h" |
| 30 #include "content/common/input/synthetic_gesture_packet.h" | 32 #include "content/common/input/synthetic_gesture_packet.h" |
| 31 #include "content/common/input_messages.h" | 33 #include "content/common/input_messages.h" |
| 32 #include "content/common/render_message_filter.mojom.h" | 34 #include "content/common/render_message_filter.mojom.h" |
| 33 #include "content/common/swapped_out_messages.h" | 35 #include "content/common/swapped_out_messages.h" |
| 34 #include "content/common/text_input_state.h" | 36 #include "content/common/text_input_state.h" |
| 35 #include "content/common/view_messages.h" | 37 #include "content/common/view_messages.h" |
| 36 #include "content/public/common/content_features.h" | 38 #include "content/public/common/content_features.h" |
| 37 #include "content/public/common/content_switches.h" | 39 #include "content/public/common/content_switches.h" |
| 38 #include "content/public/common/context_menu_params.h" | 40 #include "content/public/common/context_menu_params.h" |
| 39 #include "content/renderer/cursor_utils.h" | 41 #include "content/renderer/cursor_utils.h" |
| 40 #include "content/renderer/devtools/render_widget_screen_metrics_emulator.h" | 42 #include "content/renderer/devtools/render_widget_screen_metrics_emulator.h" |
| 43 #include "content/renderer/drop_data_builder.h" |
| 41 #include "content/renderer/external_popup_menu.h" | 44 #include "content/renderer/external_popup_menu.h" |
| 42 #include "content/renderer/gpu/frame_swap_message_queue.h" | 45 #include "content/renderer/gpu/frame_swap_message_queue.h" |
| 43 #include "content/renderer/gpu/queue_message_swap_promise.h" | 46 #include "content/renderer/gpu/queue_message_swap_promise.h" |
| 44 #include "content/renderer/gpu/render_widget_compositor.h" | 47 #include "content/renderer/gpu/render_widget_compositor.h" |
| 45 #include "content/renderer/ime_event_guard.h" | 48 #include "content/renderer/ime_event_guard.h" |
| 46 #include "content/renderer/input/input_handler_manager.h" | 49 #include "content/renderer/input/input_handler_manager.h" |
| 47 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 50 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
| 48 #include "content/renderer/render_frame_impl.h" | 51 #include "content/renderer/render_frame_impl.h" |
| 49 #include "content/renderer/render_frame_proxy.h" | 52 #include "content/renderer/render_frame_proxy.h" |
| 50 #include "content/renderer/render_process.h" | 53 #include "content/renderer/render_process.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 #include "content/renderer/mus/render_widget_mus_connection.h" | 100 #include "content/renderer/mus/render_widget_mus_connection.h" |
| 98 #endif | 101 #endif |
| 99 | 102 |
| 100 #if defined(OS_MACOSX) | 103 #if defined(OS_MACOSX) |
| 101 #include "content/renderer/text_input_client_observer.h" | 104 #include "content/renderer/text_input_client_observer.h" |
| 102 #endif | 105 #endif |
| 103 | 106 |
| 104 using blink::WebCompositionUnderline; | 107 using blink::WebCompositionUnderline; |
| 105 using blink::WebCursorInfo; | 108 using blink::WebCursorInfo; |
| 106 using blink::WebDeviceEmulationParams; | 109 using blink::WebDeviceEmulationParams; |
| 110 using blink::WebDragOperationsMask; |
| 111 using blink::WebDragData; |
| 107 using blink::WebGestureEvent; | 112 using blink::WebGestureEvent; |
| 113 using blink::WebImage; |
| 108 using blink::WebInputEvent; | 114 using blink::WebInputEvent; |
| 109 using blink::WebInputEventResult; | 115 using blink::WebInputEventResult; |
| 110 using blink::WebKeyboardEvent; | 116 using blink::WebKeyboardEvent; |
| 117 using blink::WebLocalFrame; |
| 111 using blink::WebMouseEvent; | 118 using blink::WebMouseEvent; |
| 112 using blink::WebMouseWheelEvent; | 119 using blink::WebMouseWheelEvent; |
| 113 using blink::WebNavigationPolicy; | 120 using blink::WebNavigationPolicy; |
| 114 using blink::WebNode; | 121 using blink::WebNode; |
| 115 using blink::WebPagePopup; | 122 using blink::WebPagePopup; |
| 116 using blink::WebPoint; | 123 using blink::WebPoint; |
| 117 using blink::WebPopupType; | 124 using blink::WebPopupType; |
| 118 using blink::WebRange; | 125 using blink::WebRange; |
| 119 using blink::WebRect; | 126 using blink::WebRect; |
| 120 using blink::WebSize; | 127 using blink::WebSize; |
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 | 964 |
| 958 text_input_info_ = new_info; | 965 text_input_info_ = new_info; |
| 959 text_input_type_ = new_type; | 966 text_input_type_ = new_type; |
| 960 text_input_mode_ = new_mode; | 967 text_input_mode_ = new_mode; |
| 961 can_compose_inline_ = new_can_compose_inline; | 968 can_compose_inline_ = new_can_compose_inline; |
| 962 text_input_flags_ = new_info.flags; | 969 text_input_flags_ = new_info.flags; |
| 963 } | 970 } |
| 964 } | 971 } |
| 965 | 972 |
| 966 bool RenderWidget::WillHandleGestureEvent(const blink::WebGestureEvent& event) { | 973 bool RenderWidget::WillHandleGestureEvent(const blink::WebGestureEvent& event) { |
| 967 if (owner_delegate_) | 974 possible_drag_event_info_.event_source = |
| 968 return owner_delegate_->RenderWidgetWillHandleGestureEvent(event); | 975 ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH; |
| 976 possible_drag_event_info_.event_location = |
| 977 gfx::Point(event.globalX, event.globalY); |
| 969 | 978 |
| 970 return false; | 979 return false; |
| 971 } | 980 } |
| 972 | 981 |
| 973 bool RenderWidget::WillHandleMouseEvent(const blink::WebMouseEvent& event) { | 982 bool RenderWidget::WillHandleMouseEvent(const blink::WebMouseEvent& event) { |
| 974 for (auto& observer : render_frames_) | 983 for (auto& observer : render_frames_) |
| 975 observer.RenderWidgetWillHandleMouseEvent(); | 984 observer.RenderWidgetWillHandleMouseEvent(); |
| 976 | 985 |
| 986 possible_drag_event_info_.event_source = |
| 987 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE; |
| 988 possible_drag_event_info_.event_location = |
| 989 gfx::Point(event.globalX, event.globalY); |
| 990 |
| 977 if (owner_delegate_) | 991 if (owner_delegate_) |
| 978 return owner_delegate_->RenderWidgetWillHandleMouseEvent(event); | 992 return owner_delegate_->RenderWidgetWillHandleMouseEvent(event); |
| 979 | 993 |
| 980 return false; | 994 return false; |
| 981 } | 995 } |
| 982 | 996 |
| 983 /////////////////////////////////////////////////////////////////////////////// | 997 /////////////////////////////////////////////////////////////////////////////// |
| 984 // RenderWidgetScreenMetricsDelegate | 998 // RenderWidgetScreenMetricsDelegate |
| 985 | 999 |
| 986 void RenderWidget::Redraw() { | 1000 void RenderWidget::Redraw() { |
| (...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2062 | 2076 |
| 2063 void RenderWidget::requestPointerUnlock() { | 2077 void RenderWidget::requestPointerUnlock() { |
| 2064 mouse_lock_dispatcher_->UnlockMouse(webwidget_mouse_lock_target_.get()); | 2078 mouse_lock_dispatcher_->UnlockMouse(webwidget_mouse_lock_target_.get()); |
| 2065 } | 2079 } |
| 2066 | 2080 |
| 2067 bool RenderWidget::isPointerLocked() { | 2081 bool RenderWidget::isPointerLocked() { |
| 2068 return mouse_lock_dispatcher_->IsMouseLockedTo( | 2082 return mouse_lock_dispatcher_->IsMouseLockedTo( |
| 2069 webwidget_mouse_lock_target_.get()); | 2083 webwidget_mouse_lock_target_.get()); |
| 2070 } | 2084 } |
| 2071 | 2085 |
| 2086 void RenderWidget::startDragging(blink::WebReferrerPolicy policy, |
| 2087 const WebDragData& data, |
| 2088 WebDragOperationsMask mask, |
| 2089 const WebImage& image, |
| 2090 const WebPoint& webImageOffset) { |
| 2091 blink::WebRect offset_in_window(webImageOffset.x, webImageOffset.y, 0, 0); |
| 2092 convertViewportToWindow(&offset_in_window); |
| 2093 DropData drop_data(DropDataBuilder::Build(data)); |
| 2094 drop_data.referrer_policy = policy; |
| 2095 gfx::Vector2d imageOffset(offset_in_window.x, offset_in_window.y); |
| 2096 Send(new DragHostMsg_StartDragging(routing_id_, drop_data, mask, |
| 2097 image.getSkBitmap(), imageOffset, |
| 2098 possible_drag_event_info_)); |
| 2099 } |
| 2100 |
| 2072 blink::WebWidget* RenderWidget::GetWebWidget() const { | 2101 blink::WebWidget* RenderWidget::GetWebWidget() const { |
| 2073 return webwidget_internal_; | 2102 return webwidget_internal_; |
| 2074 } | 2103 } |
| 2075 | 2104 |
| 2076 } // namespace content | 2105 } // namespace content |
| OLD | NEW |