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..790c086c283e09a5395c0c970ad4111bdb5bdcb7 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_contents_impl.h" |
#include "content/browser/web_contents/web_drag_utils_win.h" |
#include "content/public/browser/browser_thread.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(); |
dcheng
2013/05/24 01:10:37
Why not just GetRenderWidgetHostView() directly?
Hongbo Min
2013/05/27 14:51:41
Done.
|
+ 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() { |
@@ -111,6 +124,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); |
dcheng
2013/05/24 01:10:37
I would prefer to see the right-mouse button check
Hongbo Min
2013/05/27 14:51:41
Good suggestion, thanks. Done!
|
+} |
+ |
void WebDragSource::Observe(int type, |
const NotificationSource& source, |
const NotificationDetails& details) { |