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 23 matching lines...) Expand all Loading... |
34 return DROPEFFECT_COPY; | 34 return DROPEFFECT_COPY; |
35 if (effect & DROPEFFECT_LINK) | 35 if (effect & DROPEFFECT_LINK) |
36 return DROPEFFECT_LINK; | 36 return DROPEFFECT_LINK; |
37 if (effect & DROPEFFECT_MOVE) | 37 if (effect & DROPEFFECT_MOVE) |
38 return DROPEFFECT_MOVE; | 38 return DROPEFFECT_MOVE; |
39 return DROPEFFECT_NONE; | 39 return DROPEFFECT_NONE; |
40 } | 40 } |
41 | 41 |
42 } // namespace | 42 } // namespace |
43 | 43 |
44 // InterstitialDropTarget is like a app::win::DropTarget implementation that | 44 // InterstitialDropTarget is like a base::win::DropTarget implementation that |
45 // WebDropTarget passes through to if an interstitial is showing. Rather than | 45 // WebDropTarget passes through to if an interstitial is showing. Rather than |
46 // passing messages on to the renderer, we just check to see if there's a link | 46 // passing messages on to the renderer, we just check to see if there's a link |
47 // in the drop data and handle links as navigations. | 47 // in the drop data and handle links as navigations. |
48 class InterstitialDropTarget { | 48 class InterstitialDropTarget { |
49 public: | 49 public: |
50 explicit InterstitialDropTarget(TabContents* tab_contents) | 50 explicit InterstitialDropTarget(TabContents* tab_contents) |
51 : tab_contents_(tab_contents) {} | 51 : tab_contents_(tab_contents) {} |
52 | 52 |
53 DWORD OnDragEnter(IDataObject* data_object, DWORD effect) { | 53 DWORD OnDragEnter(IDataObject* data_object, DWORD effect) { |
54 return ui::ClipboardUtil::HasUrl(data_object) ? | 54 return ui::ClipboardUtil::HasUrl(data_object) ? |
(...skipping 158 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 |