| 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_contents_drag_win.h" | 5 #include "content/browser/web_contents/web_contents_drag_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "content/browser/web_contents/web_drag_source_win.h" | 21 #include "content/browser/web_contents/web_drag_source_win.h" |
| 22 #include "content/browser/web_contents/web_drag_utils_win.h" | 22 #include "content/browser/web_contents/web_drag_utils_win.h" |
| 23 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 24 #include "content/public/browser/content_browser_client.h" | 24 #include "content/public/browser/content_browser_client.h" |
| 25 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
| 26 #include "content/public/browser/web_drag_dest_delegate.h" | 26 #include "content/public/browser/web_drag_dest_delegate.h" |
| 27 #include "net/base/net_util.h" | 27 #include "net/base/net_util.h" |
| 28 #include "ui/base/clipboard/clipboard_util_win.h" | 28 #include "ui/base/clipboard/clipboard_util_win.h" |
| 29 #include "ui/base/clipboard/custom_data_helper.h" | 29 #include "ui/base/clipboard/custom_data_helper.h" |
| 30 #include "ui/base/dragdrop/drag_utils.h" | 30 #include "ui/base/dragdrop/drag_utils.h" |
| 31 #include "ui/gfx/image/image_skia.h" |
| 31 #include "ui/gfx/size.h" | 32 #include "ui/gfx/size.h" |
| 32 #include "webkit/glue/webdropdata.h" | 33 #include "webkit/glue/webdropdata.h" |
| 33 | 34 |
| 34 using content::BrowserThread; | 35 using content::BrowserThread; |
| 35 using WebKit::WebDragOperationsMask; | 36 using WebKit::WebDragOperationsMask; |
| 36 using WebKit::WebDragOperationCopy; | 37 using WebKit::WebDragOperationCopy; |
| 37 using WebKit::WebDragOperationLink; | 38 using WebKit::WebDragOperationLink; |
| 38 using WebKit::WebDragOperationMove; | 39 using WebKit::WebDragOperationMove; |
| 39 | 40 |
| 40 namespace { | 41 namespace { |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 if (!drop_data.custom_data.empty()) { | 291 if (!drop_data.custom_data.empty()) { |
| 291 Pickle pickle; | 292 Pickle pickle; |
| 292 ui::WriteCustomDataToPickle(drop_data.custom_data, &pickle); | 293 ui::WriteCustomDataToPickle(drop_data.custom_data, &pickle); |
| 293 data.SetPickledData(ui::ClipboardUtil::GetWebCustomDataFormat()->cfFormat, | 294 data.SetPickledData(ui::ClipboardUtil::GetWebCustomDataFormat()->cfFormat, |
| 294 pickle); | 295 pickle); |
| 295 } | 296 } |
| 296 } | 297 } |
| 297 | 298 |
| 298 // Set drag image. | 299 // Set drag image. |
| 299 if (!image.isNull()) { | 300 if (!image.isNull()) { |
| 300 drag_utils::SetDragImageOnDataObject( | 301 drag_utils::SetDragImageOnDataObject(gfx::ImageSkia(image), |
| 301 image, gfx::Size(image.width(), image.height()), image_offset, &data); | 302 gfx::Size(image.width(), image.height()), image_offset, &data); |
| 302 } | 303 } |
| 303 | 304 |
| 304 // We need to enable recursive tasks on the message loop so we can get | 305 // We need to enable recursive tasks on the message loop so we can get |
| 305 // updates while in the system DoDragDrop loop. | 306 // updates while in the system DoDragDrop loop. |
| 306 DWORD effect; | 307 DWORD effect; |
| 307 { | 308 { |
| 308 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); | 309 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); |
| 309 DoDragDrop(ui::OSExchangeDataProviderWin::GetIDataObject(data), | 310 DoDragDrop(ui::OSExchangeDataProviderWin::GetIDataObject(data), |
| 310 drag_source_, | 311 drag_source_, |
| 311 web_drag_utils_win::WebDragOpMaskToWinDragOpMask(ops), | 312 web_drag_utils_win::WebDragOpMaskToWinDragOpMask(ops), |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 void WebContentsDragWin::OnDataObjectDisposed() { | 364 void WebContentsDragWin::OnDataObjectDisposed() { |
| 364 DCHECK(drag_drop_thread_id_ == base::PlatformThread::CurrentId()); | 365 DCHECK(drag_drop_thread_id_ == base::PlatformThread::CurrentId()); |
| 365 | 366 |
| 366 // The drag-and-drop thread is only closed after OLE is done with | 367 // The drag-and-drop thread is only closed after OLE is done with |
| 367 // DataObjectImpl. | 368 // DataObjectImpl. |
| 368 BrowserThread::PostTask( | 369 BrowserThread::PostTask( |
| 369 BrowserThread::UI, | 370 BrowserThread::UI, |
| 370 FROM_HERE, | 371 FROM_HERE, |
| 371 base::Bind(&WebContentsDragWin::CloseThread, this)); | 372 base::Bind(&WebContentsDragWin::CloseThread, this)); |
| 372 } | 373 } |
| OLD | NEW |