| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_drop_target_win.h" | 5 #include "chrome/browser/tab_contents/web_drop_target_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shlobj.h> | 8 #include <shlobj.h> |
| 9 | 9 |
| 10 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 10 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 current_rvh_ = tab_contents_->render_view_host(); | 99 current_rvh_ = tab_contents_->render_view_host(); |
| 100 | 100 |
| 101 // Don't pass messages to the renderer if an interstitial page is showing | 101 // Don't pass messages to the renderer if an interstitial page is showing |
| 102 // because we don't want the interstitial page to navigate. Instead, | 102 // because we don't want the interstitial page to navigate. Instead, |
| 103 // pass the messages on to a separate interstitial DropTarget handler. | 103 // pass the messages on to a separate interstitial DropTarget handler. |
| 104 if (tab_contents_->showing_interstitial_page()) | 104 if (tab_contents_->showing_interstitial_page()) |
| 105 return interstitial_drop_target_->OnDragEnter(data_object, effects); | 105 return interstitial_drop_target_->OnDragEnter(data_object, effects); |
| 106 | 106 |
| 107 // TODO(tc): PopulateWebDropData can be slow depending on what is in the | 107 // TODO(tc): PopulateWebDropData can be slow depending on what is in the |
| 108 // IDataObject. Maybe we can do this in a background thread. | 108 // IDataObject. Maybe we can do this in a background thread. |
| 109 WebDropData drop_data(GetDragIdentity()); | 109 WebDropData drop_data; |
| 110 WebDropData::PopulateWebDropData(data_object, &drop_data); | 110 WebDropData::PopulateWebDropData(data_object, &drop_data); |
| 111 | 111 |
| 112 if (drop_data.url.is_empty()) | 112 if (drop_data.url.is_empty()) |
| 113 ui::OSExchangeDataProviderWin::GetPlainTextURL(data_object, &drop_data.url); | 113 ui::OSExchangeDataProviderWin::GetPlainTextURL(data_object, &drop_data.url); |
| 114 | 114 |
| 115 drag_cursor_ = WebDragOperationNone; | 115 drag_cursor_ = WebDragOperationNone; |
| 116 | 116 |
| 117 POINT client_pt = cursor_position; | 117 POINT client_pt = cursor_position; |
| 118 ScreenToClient(GetHWND(), &client_pt); | 118 ScreenToClient(GetHWND(), &client_pt); |
| 119 tab_contents_->render_view_host()->DragTargetDragEnter(drop_data, | 119 tab_contents_->render_view_host()->DragTargetDragEnter(drop_data, |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 tab_contents_->GetBookmarkDragDelegate()->OnDrop(bookmark_drag_data); | 213 tab_contents_->GetBookmarkDragDelegate()->OnDrop(bookmark_drag_data); |
| 214 } | 214 } |
| 215 | 215 |
| 216 current_rvh_ = NULL; | 216 current_rvh_ = NULL; |
| 217 | 217 |
| 218 // This isn't always correct, but at least it's a close approximation. | 218 // This isn't always correct, but at least it's a close approximation. |
| 219 // For now, we always map a move to a copy to prevent potential data loss. | 219 // For now, we always map a move to a copy to prevent potential data loss. |
| 220 DWORD drop_effect = web_drag_utils_win::WebDragOpToWinDragOp(drag_cursor_); | 220 DWORD drop_effect = web_drag_utils_win::WebDragOpToWinDragOp(drag_cursor_); |
| 221 return drop_effect != DROPEFFECT_MOVE ? drop_effect : DROPEFFECT_COPY; | 221 return drop_effect != DROPEFFECT_MOVE ? drop_effect : DROPEFFECT_COPY; |
| 222 } | 222 } |
| OLD | NEW |