Index: content/browser/web_contents/web_drag_source_win.cc |
diff --git a/content/browser/web_contents/web_drag_source_win.cc b/content/browser/web_contents/web_drag_source_win.cc |
index 18c18819da7ffdd4d85c4a5e9f853005dda425f5..c4fd776823c668e9d7722c32a7866526e385b551 100644 |
--- a/content/browser/web_contents/web_drag_source_win.cc |
+++ b/content/browser/web_contents/web_drag_source_win.cc |
@@ -6,6 +6,7 @@ |
#include "base/bind.h" |
#include "content/browser/renderer_host/render_view_host_impl.h" |
+#include "content/browser/renderer_host/render_widget_host_view_win.h" |
#include "content/browser/web_contents/web_drag_utils_win.h" |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/notification_source.h" |
@@ -64,6 +65,7 @@ void WebDragSource::OnDragSourceCancel() { |
render_view_host_->DragSourceEndedAt(client.x(), client.y(), |
screen.x(), screen.y(), |
WebDragOperationNone); |
+ OnDragSourceEnded(); |
} |
void WebDragSource::OnDragSourceDrop() { |
@@ -80,13 +82,23 @@ void WebDragSource::OnDragSourceDrop() { |
void WebDragSource::DelayedOnDragSourceDrop() { |
if (!render_view_host_) |
return; |
- |
gfx::Point client; |
gfx::Point screen; |
GetCursorPositions(source_wnd_, &client, &screen); |
render_view_host_->DragSourceEndedAt( |
client.x(), client.y(), screen.x(), screen.y(), |
WinDragOpToWebDragOp(effect_)); |
+ OnDragSourceEnded(); |
+} |
+ |
+void WebDragSource::OnDragSourceEnded() { |
+ if (!render_view_host_) |
+ return; |
+ |
+ RenderWidgetHostViewWin* rwhv = |
+ static_cast<RenderWidgetHostViewWin*>(render_view_host_->GetView()); |
+ if (rwhv->has_valid_long_press_gesture()) |
+ rwhv->CancelLongPressGesture(); |
} |
void WebDragSource::OnDragSourceMove() { |
@@ -100,7 +112,6 @@ void WebDragSource::OnDragSourceMove() { |
if (!render_view_host_) |
return; |
- |
gfx::Point client; |
gfx::Point screen; |
GetCursorPositions(source_wnd_, &client, &screen); |
@@ -108,6 +119,13 @@ void WebDragSource::OnDragSourceMove() { |
screen.x(), screen.y()); |
} |
+bool WebDragSource::ShouldDropDragSource( |
+ BOOL escape_pressed, DWORD key_state) { |
+ // We also care about right mouse button state since long press gesture is |
+ // simulated as right mouse button down/up. |
+ return !(key_state & MK_LBUTTON) && !(key_state & MK_RBUTTON); |
+} |
+ |
void WebDragSource::Observe(int type, |
const NotificationSource& source, |
const NotificationDetails& details) { |