summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorarv@google.com <arv@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-08 02:38:03 +0000
committerarv@google.com <arv@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-08 02:38:03 +0000
commit5f9ae6c55bb6cf325bcd85465a370d7fc32bd47a (patch)
treebb9b9e7c5ef78e47dafb968bea5491ca54d2965b /chrome/browser
parent8f04ff93eba6678ed17b7157f805212d9438507b (diff)
downloadchromium_src-5f9ae6c55bb6cf325bcd85465a370d7fc32bd47a.zip
chromium_src-5f9ae6c55bb6cf325bcd85465a370d7fc32bd47a.tar.gz
chromium_src-5f9ae6c55bb6cf325bcd85465a370d7fc32bd47a.tar.bz2
Make the cancelling of drag and drop match Safari for Windows. This is
a follow up CL to http://codereview.chromium.org/149038 as well as to https://bugs.webkit.org/show_bug.cgi?id=26699 With this change we use DragOperationNone (instead of DragOperationCopy) and NoButton (instead of LeftButton) when the user presses Escape. BUG=12018 TEST=On the new new tab page drag one of the thumbnails out of the window and press escape. The thumbnail should move back to its starting position. Review URL: http://codereview.chromium.org/149296 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20125 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc13
-rw-r--r--chrome/browser/renderer_host/render_view_host.h5
-rw-r--r--chrome/browser/tab_contents/web_drag_source.cc4
3 files changed, 18 insertions, 4 deletions
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index c06d4fa..cd23770 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -579,13 +579,22 @@ void RenderViewHost::CopyImageAt(int x, int y) {
Send(new ViewMsg_CopyImageAt(routing_id(), x, y));
}
+void RenderViewHost::DragSourceCancelledAt(
+ int client_x, int client_y, int screen_x, int screen_y) {
+ Send(new ViewMsg_DragSourceEndedOrMoved(
+ routing_id(),
+ gfx::Point(client_x, client_y),
+ gfx::Point(screen_x, screen_y),
+ true, true));
+}
+
void RenderViewHost::DragSourceEndedAt(
int client_x, int client_y, int screen_x, int screen_y) {
Send(new ViewMsg_DragSourceEndedOrMoved(
routing_id(),
gfx::Point(client_x, client_y),
gfx::Point(screen_x, screen_y),
- true));
+ true, false));
}
void RenderViewHost::DragSourceMovedTo(
@@ -594,7 +603,7 @@ void RenderViewHost::DragSourceMovedTo(
routing_id(),
gfx::Point(client_x, client_y),
gfx::Point(screen_x, screen_y),
- false));
+ false, false));
}
void RenderViewHost::DragSourceSystemDragEnded() {
diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h
index ddae3b1..e7e6a81 100644
--- a/chrome/browser/renderer_host/render_view_host.h
+++ b/chrome/browser/renderer_host/render_view_host.h
@@ -291,6 +291,11 @@ class RenderViewHost : public RenderWidgetHost,
// Copies the image at the specified point.
void CopyImageAt(int x, int y);
+ // Notifies the renderer that a drag and drop was cancelled. This is
+ // necessary because the render may be the one that started the drag.
+ void DragSourceCancelledAt(
+ int client_x, int client_y, int screen_x, int screen_y);
+
// Notifies the renderer that a drop occurred. This is necessary because the
// render may be the one that started the drag.
void DragSourceEndedAt(
diff --git a/chrome/browser/tab_contents/web_drag_source.cc b/chrome/browser/tab_contents/web_drag_source.cc
index 0abf968..d61f3ba2 100644
--- a/chrome/browser/tab_contents/web_drag_source.cc
+++ b/chrome/browser/tab_contents/web_drag_source.cc
@@ -48,8 +48,8 @@ void WebDragSource::OnDragSourceCancel() {
gfx::Point client;
gfx::Point screen;
GetCursorPositions(source_wnd_, &client, &screen);
- render_view_host_->DragSourceEndedAt(client.x(), client.y(),
- screen.x(), screen.y());
+ render_view_host_->DragSourceCancelledAt(client.x(), client.y(),
+ screen.x(), screen.y());
}
void WebDragSource::OnDragSourceDrop() {