| 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 <windows.h> | 5 #include <windows.h> |
| 6 #include <shlobj.h> | 6 #include <shlobj.h> |
| 7 | 7 |
| 8 #include "chrome/browser/tab_contents/web_drop_target.h" | 8 #include "chrome/browser/tab_contents/web_drop_target.h" |
| 9 | 9 |
| 10 #include "base/clipboard_util.h" | 10 #include "base/clipboard_util.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 129 |
| 130 if (web_contents_->showing_interstitial_page()) | 130 if (web_contents_->showing_interstitial_page()) |
| 131 return interstitial_drop_target_->OnDragOver(data_object, effect); | 131 return interstitial_drop_target_->OnDragOver(data_object, effect); |
| 132 | 132 |
| 133 POINT client_pt = cursor_position; | 133 POINT client_pt = cursor_position; |
| 134 ScreenToClient(GetHWND(), &client_pt); | 134 ScreenToClient(GetHWND(), &client_pt); |
| 135 web_contents_->render_view_host()->DragTargetDragOver( | 135 web_contents_->render_view_host()->DragTargetDragOver( |
| 136 gfx::Point(client_pt.x, client_pt.y), | 136 gfx::Point(client_pt.x, client_pt.y), |
| 137 gfx::Point(cursor_position.x, cursor_position.y)); | 137 gfx::Point(cursor_position.x, cursor_position.y)); |
| 138 | 138 |
| 139 // Again we don't wait on the renderer to respond, but this can lead to | |
| 140 // a race condition. If the renderer does not want the drop data, then | |
| 141 // we won't know until the response from the renderer arrives. So if a | |
| 142 // drop happens before the response arrives, we drop on a renderer that | |
| 143 // doesn't want the data. TODO(noel): fix this. | |
| 144 | |
| 145 if (!is_drop_target_) | 139 if (!is_drop_target_) |
| 146 return DROPEFFECT_NONE; | 140 return DROPEFFECT_NONE; |
| 147 | 141 |
| 148 return GetPreferredDropEffect(effect); | 142 return GetPreferredDropEffect(effect); |
| 149 } | 143 } |
| 150 | 144 |
| 151 void WebDropTarget::OnDragLeave(IDataObject* data_object) { | 145 void WebDropTarget::OnDragLeave(IDataObject* data_object) { |
| 152 DCHECK(current_rvh_); | 146 DCHECK(current_rvh_); |
| 153 if (current_rvh_ != web_contents_->render_view_host()) | 147 if (current_rvh_ != web_contents_->render_view_host()) |
| 154 return; | 148 return; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 179 web_contents_->render_view_host()->DragTargetDrop( | 173 web_contents_->render_view_host()->DragTargetDrop( |
| 180 gfx::Point(client_pt.x, client_pt.y), | 174 gfx::Point(client_pt.x, client_pt.y), |
| 181 gfx::Point(cursor_position.x, cursor_position.y)); | 175 gfx::Point(cursor_position.x, cursor_position.y)); |
| 182 | 176 |
| 183 current_rvh_ = NULL; | 177 current_rvh_ = NULL; |
| 184 | 178 |
| 185 // We lie and always claim that the drop operation didn't happen because we | 179 // We lie and always claim that the drop operation didn't happen because we |
| 186 // don't want to wait for the renderer to respond. | 180 // don't want to wait for the renderer to respond. |
| 187 return DROPEFFECT_NONE; | 181 return DROPEFFECT_NONE; |
| 188 } | 182 } |
| OLD | NEW |