OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_win.h" | 8 #include "chrome/browser/tab_contents/web_drop_target_win.h" |
9 | 9 |
10 #include "app/clipboard/clipboard_util_win.h" | 10 #include "app/clipboard/clipboard_util_win.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 : DROPEFFECT_NONE; | 60 : DROPEFFECT_NONE; |
61 } | 61 } |
62 | 62 |
63 void OnDragLeave(IDataObject* data_object) { | 63 void OnDragLeave(IDataObject* data_object) { |
64 } | 64 } |
65 | 65 |
66 DWORD OnDrop(IDataObject* data_object, DWORD effect) { | 66 DWORD OnDrop(IDataObject* data_object, DWORD effect) { |
67 if (ClipboardUtil::HasUrl(data_object)) { | 67 if (ClipboardUtil::HasUrl(data_object)) { |
68 std::wstring url; | 68 std::wstring url; |
69 std::wstring title; | 69 std::wstring title; |
70 ClipboardUtil::GetUrl(data_object, &url, &title); | 70 ClipboardUtil::GetUrl(data_object, &url, &title, true); |
71 tab_contents_->OpenURL(GURL(url), GURL(), CURRENT_TAB, | 71 tab_contents_->OpenURL(GURL(url), GURL(), CURRENT_TAB, |
72 PageTransition::AUTO_BOOKMARK); | 72 PageTransition::AUTO_BOOKMARK); |
73 return GetPreferredDropEffect(effect); | 73 return GetPreferredDropEffect(effect); |
74 } | 74 } |
75 return DROPEFFECT_NONE; | 75 return DROPEFFECT_NONE; |
76 } | 76 } |
77 | 77 |
78 private: | 78 private: |
79 TabContents* tab_contents_; | 79 TabContents* tab_contents_; |
80 | 80 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 tab_contents_->GetBookmarkDragDelegate()->OnDrop(bookmark_drag_data); | 212 tab_contents_->GetBookmarkDragDelegate()->OnDrop(bookmark_drag_data); |
213 } | 213 } |
214 | 214 |
215 current_rvh_ = NULL; | 215 current_rvh_ = NULL; |
216 | 216 |
217 // This isn't always correct, but at least it's a close approximation. | 217 // This isn't always correct, but at least it's a close approximation. |
218 // For now, we always map a move to a copy to prevent potential data loss. | 218 // For now, we always map a move to a copy to prevent potential data loss. |
219 DWORD drop_effect = web_drag_utils_win::WebDragOpToWinDragOp(drag_cursor_); | 219 DWORD drop_effect = web_drag_utils_win::WebDragOpToWinDragOp(drag_cursor_); |
220 return drop_effect != DROPEFFECT_MOVE ? drop_effect : DROPEFFECT_COPY; | 220 return drop_effect != DROPEFFECT_MOVE ? drop_effect : DROPEFFECT_COPY; |
221 } | 221 } |
OLD | NEW |