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

Unified Diff: content/browser/web_contents/web_drag_source_win.cc

Issue 14294003: Touch-initiated drag-out to download file but fails. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase to trunk Created 7 years, 7 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/web_contents/web_drag_source_win.h ('k') | ui/base/dragdrop/drag_source_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « content/browser/web_contents/web_drag_source_win.h ('k') | ui/base/dragdrop/drag_source_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698