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

Unified Diff: chrome/browser/tab_contents/web_drag_source_win.cc

Issue 351029: Support dragging a virtual file out of the browser. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 12 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 | « chrome/browser/renderer_host/resource_message_filter.cc ('k') | chrome/browser/views/download_item_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/web_drag_source_win.cc
===================================================================
--- chrome/browser/tab_contents/web_drag_source_win.cc (revision 35459)
+++ chrome/browser/tab_contents/web_drag_source_win.cc (working copy)
@@ -4,6 +4,8 @@
#include "chrome/browser/tab_contents/web_drag_source_win.h"
+#include "base/task.h"
+#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/notification_type.h"
@@ -24,6 +26,7 @@
}
} // namespace
+
///////////////////////////////////////////////////////////////////////////////
// WebDragSource, public:
@@ -39,6 +42,14 @@
}
void WebDragSource::OnDragSourceCancel() {
+ // 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::OnDragSourceCancel));
+ return;
+ }
+
if (!render_view_host_)
return;
@@ -51,6 +62,14 @@
}
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;
+ }
+
if (!render_view_host_)
return;
@@ -64,6 +83,14 @@
}
void WebDragSource::OnDragSourceMove() {
+ // 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::OnDragSourceMove));
+ return;
+ }
+
if (!render_view_host_)
return;
@@ -82,6 +109,9 @@
// our drag source.
render_view_host_ = NULL;
} else if (NotificationType::TAB_CONTENTS_DISCONNECTED == type) {
- NOTREACHED();
+ // This could be possible when we close the tab and the source is still
+ // being used in DoDragDrop at the time that the virtual file is being
+ // downloaded.
+ render_view_host_ = NULL;
}
}
« no previous file with comments | « chrome/browser/renderer_host/resource_message_filter.cc ('k') | chrome/browser/views/download_item_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698