diff options
-rw-r--r-- | chrome/browser/tab_contents/web_drag_source_win.cc | 17 | ||||
-rw-r--r-- | chrome/browser/tab_contents/web_drag_source_win.h | 4 |
2 files changed, 14 insertions, 7 deletions
diff --git a/chrome/browser/tab_contents/web_drag_source_win.cc b/chrome/browser/tab_contents/web_drag_source_win.cc index 0f47aac..62fe910 100644 --- a/chrome/browser/tab_contents/web_drag_source_win.cc +++ b/chrome/browser/tab_contents/web_drag_source_win.cc @@ -62,14 +62,17 @@ void WebDragSource::OnDragSourceCancel() { } void WebDragSource::OnDragSourceDrop() { - // Delegate to the UI thread if we do drag-and-drop in the background thread. - if (!ChromeThread::CurrentlyOn(ChromeThread::UI)) { - ChromeThread::PostTask( - ChromeThread::UI, FROM_HERE, - NewRunnableMethod(this, &WebDragSource::OnDragSourceDrop)); - return; - } + // On Windows, we check for drag end in IDropSource::QueryContinueDrag which + // happens before IDropTarget::Drop is called. HTML5 requires the "dragend" + // event to happen after the "drop" event. Since Windows calls these two + // directly after each other we can just post a task to handle the + // OnDragSourceDrop after the current task. + ChromeThread::PostTask( + ChromeThread::UI, FROM_HERE, + NewRunnableMethod(this, &WebDragSource::DelayedOnDragSourceDrop)); +} +void WebDragSource::DelayedOnDragSourceDrop() { if (!render_view_host_) return; diff --git a/chrome/browser/tab_contents/web_drag_source_win.h b/chrome/browser/tab_contents/web_drag_source_win.h index c851142..c0a8eb0 100644 --- a/chrome/browser/tab_contents/web_drag_source_win.h +++ b/chrome/browser/tab_contents/web_drag_source_win.h @@ -46,6 +46,10 @@ class WebDragSource : public BaseDragSource, // Cannot construct thusly. WebDragSource(); + // OnDragSourceDrop schedules its main work to be done after IDropTarget::Drop + // by posting a task to this function. + void DelayedOnDragSourceDrop(); + // Keep a reference to the window so we can translate the cursor position. gfx::NativeWindow source_wnd_; |