| 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 DWORD effect; | 343 DWORD effect; |
| 344 { | 344 { |
| 345 // Keep a reference count such that |drag_source_| will not get deleted | 345 // Keep a reference count such that |drag_source_| will not get deleted |
| 346 // if the contents view window is gone in the nested message loop invoked | 346 // if the contents view window is gone in the nested message loop invoked |
| 347 // from DoDragDrop. | 347 // from DoDragDrop. |
| 348 scoped_refptr<WebDragSource> retain_this(drag_source_); | 348 scoped_refptr<WebDragSource> retain_this(drag_source_); |
| 349 | 349 |
| 350 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); | 350 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); |
| 351 DoDragDrop(ui::OSExchangeDataProviderWin::GetIDataObject(data), | 351 DoDragDrop(ui::OSExchangeDataProviderWin::GetIDataObject(data), |
| 352 drag_source_, | 352 drag_source_, |
| 353 web_drag_utils_win::WebDragOpMaskToWinDragOpMask(ops), | 353 WebDragOpMaskToWinDragOpMask(ops), |
| 354 &effect); | 354 &effect); |
| 355 } | 355 } |
| 356 | 356 |
| 357 // Bail out immediately if the contents view window is gone. | 357 // Bail out immediately if the contents view window is gone. |
| 358 if (!IsWindow(native_window)) | 358 if (!IsWindow(native_window)) |
| 359 return false; | 359 return false; |
| 360 | 360 |
| 361 // Normally, the drop and dragend events get dispatched in the system | 361 // Normally, the drop and dragend events get dispatched in the system |
| 362 // DoDragDrop message loop so it'd be too late to set the effect to send back | 362 // DoDragDrop message loop so it'd be too late to set the effect to send back |
| 363 // to the renderer here. However, we use PostTask to delay the execution of | 363 // to the renderer here. However, we use PostTask to delay the execution of |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 | 411 |
| 412 // The drag-and-drop thread is only closed after OLE is done with | 412 // The drag-and-drop thread is only closed after OLE is done with |
| 413 // DataObjectImpl. | 413 // DataObjectImpl. |
| 414 BrowserThread::PostTask( | 414 BrowserThread::PostTask( |
| 415 BrowserThread::UI, | 415 BrowserThread::UI, |
| 416 FROM_HERE, | 416 FROM_HERE, |
| 417 base::Bind(&WebContentsDragWin::CloseThread, this)); | 417 base::Bind(&WebContentsDragWin::CloseThread, this)); |
| 418 } | 418 } |
| 419 | 419 |
| 420 } // namespace content | 420 } // namespace content |
| OLD | NEW |