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 53df4e81725e0984a3f09e7ec496eb022174095f..22f86abd50d779a55a10cbc5dc28593e754bb1f8 100644 |
--- a/content/browser/web_contents/web_drag_source_win.cc |
+++ b/content/browser/web_contents/web_drag_source_win.cc |
@@ -7,6 +7,7 @@ |
#include "base/bind.h" |
#include "content/browser/renderer_host/render_view_host_impl.h" |
#include "content/browser/web_contents/web_contents_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" |
@@ -66,6 +67,7 @@ void WebDragSource::OnDragSourceCancel() { |
web_contents_->DragSourceEndedAt(client.x(), client.y(), |
screen.x(), screen.y(), |
WebDragOperationNone); |
+ OnDragSourceEnded(); |
} |
void WebDragSource::OnDragSourceDrop() { |
@@ -84,12 +86,23 @@ void WebDragSource::OnDragSourceDrop() { |
void WebDragSource::DelayedOnDragSourceDrop() { |
if (!web_contents_) |
return; |
- |
gfx::Point client; |
gfx::Point screen; |
GetCursorPositions(source_wnd_, &client, &screen); |
web_contents_->DragSourceEndedAt(client.x(), client.y(), screen.x(), |
screen.y(), WinDragOpToWebDragOp(effect_)); |
+ OnDragSourceEnded(); |
+} |
+ |
+void WebDragSource::OnDragSourceEnded() { |
+ RenderViewHost* render_view_host = web_contents_->GetRenderViewHost(); |
+ if (!render_view_host) |
+ return; |
+ |
+ RenderWidgetHostViewWin* rwhv = |
+ static_cast<RenderWidgetHostViewWin*>(render_view_host->GetView()); |
+ if (rwhv->in_long_press_gesture()) |
+ rwhv->CancelLongPressGesture(); |
} |
void WebDragSource::OnDragSourceMove() { |
@@ -103,7 +116,6 @@ void WebDragSource::OnDragSourceMove() { |
if (!web_contents_) |
return; |
- |
gfx::Point client; |
gfx::Point screen; |
GetCursorPositions(source_wnd_, &client, &screen); |
@@ -111,6 +123,16 @@ 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. |
+ LOG(INFO) << "call WebDragSource::ShouldDropDragSource: key_state: " |
+ << key_state; |
+ |
+ return !(key_state & MK_LBUTTON) && !(key_state & MK_RBUTTON); |
+} |
+ |
void WebDragSource::Observe(int type, |
const NotificationSource& source, |
const NotificationDetails& details) { |