| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/tab_contents/web_drag_source_win.h" | 5 #include "chrome/browser/tab_contents/web_drag_source_win.h" |
| 6 | 6 |
| 7 #include "base/task.h" | 7 #include "base/task.h" |
| 8 #include "chrome/browser/browser_thread.h" | 8 #include "chrome/browser/browser_thread.h" |
| 9 #include "chrome/browser/renderer_host/render_view_host.h" | 9 #include "chrome/browser/renderer_host/render_view_host.h" |
| 10 #include "chrome/browser/tab_contents/tab_contents.h" | 10 #include "chrome/browser/tab_contents/tab_contents.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 client->SetPoint(cursor_pos.x, cursor_pos.y); | 25 client->SetPoint(cursor_pos.x, cursor_pos.y); |
| 26 } | 26 } |
| 27 | 27 |
| 28 } // namespace | 28 } // namespace |
| 29 | 29 |
| 30 /////////////////////////////////////////////////////////////////////////////// | 30 /////////////////////////////////////////////////////////////////////////////// |
| 31 // WebDragSource, public: | 31 // WebDragSource, public: |
| 32 | 32 |
| 33 WebDragSource::WebDragSource(gfx::NativeWindow source_wnd, | 33 WebDragSource::WebDragSource(gfx::NativeWindow source_wnd, |
| 34 TabContents* tab_contents) | 34 TabContents* tab_contents) |
| 35 : BaseDragSource(), | 35 : app::win::DragSource(), |
| 36 source_wnd_(source_wnd), | 36 source_wnd_(source_wnd), |
| 37 render_view_host_(tab_contents->render_view_host()), | 37 render_view_host_(tab_contents->render_view_host()), |
| 38 effect_(DROPEFFECT_NONE) { | 38 effect_(DROPEFFECT_NONE) { |
| 39 registrar_.Add(this, NotificationType::TAB_CONTENTS_SWAPPED, | 39 registrar_.Add(this, NotificationType::TAB_CONTENTS_SWAPPED, |
| 40 Source<TabContents>(tab_contents)); | 40 Source<TabContents>(tab_contents)); |
| 41 registrar_.Add(this, NotificationType::TAB_CONTENTS_DISCONNECTED, | 41 registrar_.Add(this, NotificationType::TAB_CONTENTS_DISCONNECTED, |
| 42 Source<TabContents>(tab_contents)); | 42 Source<TabContents>(tab_contents)); |
| 43 } | 43 } |
| 44 | 44 |
| 45 WebDragSource::~WebDragSource() { |
| 46 } |
| 47 |
| 45 void WebDragSource::OnDragSourceCancel() { | 48 void WebDragSource::OnDragSourceCancel() { |
| 46 // Delegate to the UI thread if we do drag-and-drop in the background thread. | 49 // Delegate to the UI thread if we do drag-and-drop in the background thread. |
| 47 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 50 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
| 48 BrowserThread::PostTask( | 51 BrowserThread::PostTask( |
| 49 BrowserThread::UI, FROM_HERE, | 52 BrowserThread::UI, FROM_HERE, |
| 50 NewRunnableMethod(this, &WebDragSource::OnDragSourceCancel)); | 53 NewRunnableMethod(this, &WebDragSource::OnDragSourceCancel)); |
| 51 return; | 54 return; |
| 52 } | 55 } |
| 53 | 56 |
| 54 if (!render_view_host_) | 57 if (!render_view_host_) |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // That's OK, we can continue the drag, we just can't send messages back to | 114 // That's OK, we can continue the drag, we just can't send messages back to |
| 112 // our drag source. | 115 // our drag source. |
| 113 render_view_host_ = NULL; | 116 render_view_host_ = NULL; |
| 114 } else if (NotificationType::TAB_CONTENTS_DISCONNECTED == type) { | 117 } else if (NotificationType::TAB_CONTENTS_DISCONNECTED == type) { |
| 115 // This could be possible when we close the tab and the source is still | 118 // This could be possible when we close the tab and the source is still |
| 116 // being used in DoDragDrop at the time that the virtual file is being | 119 // being used in DoDragDrop at the time that the virtual file is being |
| 117 // downloaded. | 120 // downloaded. |
| 118 render_view_host_ = NULL; | 121 render_view_host_ = NULL; |
| 119 } | 122 } |
| 120 } | 123 } |
| OLD | NEW |