Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: content/renderer/render_widget.cc

Issue 2475443003: Drag-and-drop: Move startDrag out of WebView/RenderView. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/swapped_out_messages.h" 34 #include "content/common/swapped_out_messages.h"
33 #include "content/common/text_input_state.h" 35 #include "content/common/text_input_state.h"
34 #include "content/common/view_messages.h" 36 #include "content/common/view_messages.h"
35 #include "content/public/common/content_features.h" 37 #include "content/public/common/content_features.h"
36 #include "content/public/common/content_switches.h" 38 #include "content/public/common/content_switches.h"
37 #include "content/public/common/context_menu_params.h" 39 #include "content/public/common/context_menu_params.h"
38 #include "content/renderer/cursor_utils.h" 40 #include "content/renderer/cursor_utils.h"
39 #include "content/renderer/devtools/render_widget_screen_metrics_emulator.h" 41 #include "content/renderer/devtools/render_widget_screen_metrics_emulator.h"
42 #include "content/renderer/drop_data_builder.h"
40 #include "content/renderer/external_popup_menu.h" 43 #include "content/renderer/external_popup_menu.h"
41 #include "content/renderer/gpu/frame_swap_message_queue.h" 44 #include "content/renderer/gpu/frame_swap_message_queue.h"
42 #include "content/renderer/gpu/queue_message_swap_promise.h" 45 #include "content/renderer/gpu/queue_message_swap_promise.h"
43 #include "content/renderer/gpu/render_widget_compositor.h" 46 #include "content/renderer/gpu/render_widget_compositor.h"
44 #include "content/renderer/ime_event_guard.h" 47 #include "content/renderer/ime_event_guard.h"
45 #include "content/renderer/input/input_handler_manager.h" 48 #include "content/renderer/input/input_handler_manager.h"
46 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" 49 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
47 #include "content/renderer/render_frame_impl.h" 50 #include "content/renderer/render_frame_impl.h"
48 #include "content/renderer/render_frame_proxy.h" 51 #include "content/renderer/render_frame_proxy.h"
49 #include "content/renderer/render_process.h" 52 #include "content/renderer/render_process.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 #include "content/renderer/mus/render_widget_mus_connection.h" 99 #include "content/renderer/mus/render_widget_mus_connection.h"
97 #endif 100 #endif
98 101
99 #if defined(OS_MACOSX) 102 #if defined(OS_MACOSX)
100 #include "content/renderer/text_input_client_observer.h" 103 #include "content/renderer/text_input_client_observer.h"
101 #endif 104 #endif
102 105
103 using blink::WebCompositionUnderline; 106 using blink::WebCompositionUnderline;
104 using blink::WebCursorInfo; 107 using blink::WebCursorInfo;
105 using blink::WebDeviceEmulationParams; 108 using blink::WebDeviceEmulationParams;
109 using blink::WebDragOperationsMask;
110 using blink::WebDragData;
106 using blink::WebGestureEvent; 111 using blink::WebGestureEvent;
112 using blink::WebImage;
107 using blink::WebInputEvent; 113 using blink::WebInputEvent;
108 using blink::WebInputEventResult; 114 using blink::WebInputEventResult;
109 using blink::WebKeyboardEvent; 115 using blink::WebKeyboardEvent;
116 using blink::WebLocalFrame;
110 using blink::WebMouseEvent; 117 using blink::WebMouseEvent;
111 using blink::WebMouseWheelEvent; 118 using blink::WebMouseWheelEvent;
112 using blink::WebNavigationPolicy; 119 using blink::WebNavigationPolicy;
113 using blink::WebNode; 120 using blink::WebNode;
114 using blink::WebPagePopup; 121 using blink::WebPagePopup;
115 using blink::WebPoint; 122 using blink::WebPoint;
116 using blink::WebPopupType; 123 using blink::WebPopupType;
117 using blink::WebRange; 124 using blink::WebRange;
118 using blink::WebRect; 125 using blink::WebRect;
119 using blink::WebSize; 126 using blink::WebSize;
(...skipping 1963 matching lines...) Expand 10 before | Expand all | Expand 10 after
2083 2090
2084 void RenderWidget::requestPointerUnlock() { 2091 void RenderWidget::requestPointerUnlock() {
2085 mouse_lock_dispatcher_->UnlockMouse(webwidget_mouse_lock_target_.get()); 2092 mouse_lock_dispatcher_->UnlockMouse(webwidget_mouse_lock_target_.get());
2086 } 2093 }
2087 2094
2088 bool RenderWidget::isPointerLocked() { 2095 bool RenderWidget::isPointerLocked() {
2089 return mouse_lock_dispatcher_->IsMouseLockedTo( 2096 return mouse_lock_dispatcher_->IsMouseLockedTo(
2090 webwidget_mouse_lock_target_.get()); 2097 webwidget_mouse_lock_target_.get());
2091 } 2098 }
2092 2099
2100 void RenderWidget::startDragging(WebLocalFrame* frame,
2101 const WebDragData& data,
2102 WebDragOperationsMask mask,
2103 const WebImage& image,
2104 const WebPoint& webImageOffset) {
2105 blink::WebRect offset_in_window(webImageOffset.x, webImageOffset.y, 0, 0);
2106 convertViewportToWindow(&offset_in_window);
2107 DropData drop_data(DropDataBuilder::Build(data));
2108 drop_data.referrer_policy = frame->document().referrerPolicy();
2109 gfx::Vector2d imageOffset(offset_in_window.x, offset_in_window.y);
2110 Send(new DragHostMsg_StartDragging(routing_id_, drop_data, mask,
2111 image.getSkBitmap(), imageOffset,
2112 possible_drag_event_info_));
2113 }
2114
2093 blink::WebWidget* RenderWidget::GetWebWidget() const { 2115 blink::WebWidget* RenderWidget::GetWebWidget() const {
2094 return webwidget_internal_; 2116 return webwidget_internal_;
2095 } 2117 }
2096 2118
2097 } // namespace content 2119 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698