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 "ui/base/dragdrop/os_exchange_data_provider_win.h" | 5 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 // think we always synthesize one in WebContentsDragWin. | 524 // think we always synthesize one in WebContentsDragWin. |
525 STGMEDIUM* storage = NULL; | 525 STGMEDIUM* storage = NULL; |
526 if (!download.filename.empty()) | 526 if (!download.filename.empty()) |
527 storage = GetStorageForFileName(download.filename); | 527 storage = GetStorageForFileName(download.filename); |
528 | 528 |
529 // Add CF_HDROP. | 529 // Add CF_HDROP. |
530 DataObjectImpl::StoredDataInfo* info = new DataObjectImpl::StoredDataInfo( | 530 DataObjectImpl::StoredDataInfo* info = new DataObjectImpl::StoredDataInfo( |
531 Clipboard::GetCFHDropFormatType().ToFormatEtc(), storage); | 531 Clipboard::GetCFHDropFormatType().ToFormatEtc(), storage); |
532 info->downloader = download.downloader; | 532 info->downloader = download.downloader; |
533 data_->contents_.push_back(info); | 533 data_->contents_.push_back(info); |
| 534 |
| 535 // Adding a download file always enables async mode. |
| 536 data_->SetAsyncMode(VARIANT_TRUE); |
534 } | 537 } |
535 | 538 |
536 void OSExchangeDataProviderWin::SetDragImage( | 539 void OSExchangeDataProviderWin::SetDragImage( |
537 const gfx::ImageSkia& image, | 540 const gfx::ImageSkia& image, |
538 const gfx::Vector2d& cursor_offset) { | 541 const gfx::Vector2d& cursor_offset) { |
539 drag_image_ = image; | 542 drag_image_ = image; |
540 drag_image_offset_ = cursor_offset; | 543 drag_image_offset_ = cursor_offset; |
541 } | 544 } |
542 | 545 |
543 const gfx::ImageSkia& OSExchangeDataProviderWin::GetDragImage() const { | 546 const gfx::ImageSkia& OSExchangeDataProviderWin::GetDragImage() const { |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 /////////////////////////////////////////////////////////////////////////////// | 816 /////////////////////////////////////////////////////////////////////////////// |
814 // DataObjectImpl, IDataObjectAsyncCapability implementation: | 817 // DataObjectImpl, IDataObjectAsyncCapability implementation: |
815 | 818 |
816 HRESULT DataObjectImpl::EndOperation( | 819 HRESULT DataObjectImpl::EndOperation( |
817 HRESULT result, IBindCtx* reserved, DWORD effects) { | 820 HRESULT result, IBindCtx* reserved, DWORD effects) { |
818 async_operation_started_ = false; | 821 async_operation_started_ = false; |
819 return S_OK; | 822 return S_OK; |
820 } | 823 } |
821 | 824 |
822 HRESULT DataObjectImpl::GetAsyncMode(BOOL* is_op_async) { | 825 HRESULT DataObjectImpl::GetAsyncMode(BOOL* is_op_async) { |
823 *is_op_async = in_async_mode_ ? TRUE : FALSE; | 826 *is_op_async = in_async_mode_ ? VARIANT_TRUE : VARIANT_FALSE; |
824 return S_OK; | 827 return S_OK; |
825 } | 828 } |
826 | 829 |
827 HRESULT DataObjectImpl::InOperation(BOOL* in_async_op) { | 830 HRESULT DataObjectImpl::InOperation(BOOL* in_async_op) { |
828 *in_async_op = async_operation_started_ ? TRUE : FALSE; | 831 *in_async_op = async_operation_started_ ? VARIANT_TRUE : VARIANT_FALSE; |
829 return S_OK; | 832 return S_OK; |
830 } | 833 } |
831 | 834 |
832 HRESULT DataObjectImpl::SetAsyncMode(BOOL do_op_async) { | 835 HRESULT DataObjectImpl::SetAsyncMode(BOOL do_op_async) { |
833 in_async_mode_ = (do_op_async == TRUE); | 836 in_async_mode_ = !!do_op_async; |
834 return S_OK; | 837 return S_OK; |
835 } | 838 } |
836 | 839 |
837 HRESULT DataObjectImpl::StartOperation(IBindCtx* reserved) { | 840 HRESULT DataObjectImpl::StartOperation(IBindCtx* reserved) { |
838 async_operation_started_ = true; | 841 async_operation_started_ = true; |
839 return S_OK; | 842 return S_OK; |
840 } | 843 } |
841 | 844 |
842 /////////////////////////////////////////////////////////////////////////////// | 845 /////////////////////////////////////////////////////////////////////////////// |
843 // DataObjectImpl, IUnknown implementation: | 846 // DataObjectImpl, IUnknown implementation: |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 | 1050 |
1048 /////////////////////////////////////////////////////////////////////////////// | 1051 /////////////////////////////////////////////////////////////////////////////// |
1049 // OSExchangeData, public: | 1052 // OSExchangeData, public: |
1050 | 1053 |
1051 // static | 1054 // static |
1052 OSExchangeData::Provider* OSExchangeData::CreateProvider() { | 1055 OSExchangeData::Provider* OSExchangeData::CreateProvider() { |
1053 return new OSExchangeDataProviderWin(); | 1056 return new OSExchangeDataProviderWin(); |
1054 } | 1057 } |
1055 | 1058 |
1056 } // namespace ui | 1059 } // namespace ui |
OLD | NEW |