OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/web_contents/web_drag_source_win.h" | 5 #include "content/browser/web_contents/web_drag_source_win.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "content/browser/renderer_host/render_view_host_impl.h" | 8 #include "content/browser/renderer_host/render_view_host_impl.h" |
9 #include "content/browser/web_contents/web_drag_utils_win.h" | 9 #include "content/browser/web_contents/web_drag_utils_win.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 gfx::Point screen; | 106 gfx::Point screen; |
107 GetCursorPositions(source_wnd_, &client, &screen); | 107 GetCursorPositions(source_wnd_, &client, &screen); |
108 render_view_host_->DragSourceMovedTo(client.x(), client.y(), | 108 render_view_host_->DragSourceMovedTo(client.x(), client.y(), |
109 screen.x(), screen.y()); | 109 screen.x(), screen.y()); |
110 } | 110 } |
111 | 111 |
112 void WebDragSource::Observe(int type, | 112 void WebDragSource::Observe(int type, |
113 const content::NotificationSource& source, | 113 const content::NotificationSource& source, |
114 const content::NotificationDetails& details) { | 114 const content::NotificationDetails& details) { |
115 if (content::NOTIFICATION_WEB_CONTENTS_SWAPPED == type) { | 115 if (content::NOTIFICATION_WEB_CONTENTS_SWAPPED == type) { |
116 // When the tab contents get swapped, our render view host goes away. | 116 // When the WebContents get swapped, our render view host goes away. |
117 // That's OK, we can continue the drag, we just can't send messages back to | 117 // That's OK, we can continue the drag, we just can't send messages back to |
118 // our drag source. | 118 // our drag source. |
119 render_view_host_ = NULL; | 119 render_view_host_ = NULL; |
120 } else if (content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED == type) { | 120 } else if (content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED == type) { |
121 // This could be possible when we close the tab and the source is still | 121 // This could be possible when we close the tab and the source is still |
122 // being used in DoDragDrop at the time that the virtual file is being | 122 // being used in DoDragDrop at the time that the virtual file is being |
123 // downloaded. | 123 // downloaded. |
124 render_view_host_ = NULL; | 124 render_view_host_ = NULL; |
125 } | 125 } |
126 } | 126 } |
OLD | NEW |