Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: ui/base/dragdrop/os_exchange_data_provider_win.cc

Issue 1062803003: Enable async mode for DownloadURL drags. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: true, TRUE, VARIANT_TRUE Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 != VARIANT_FALSE);
dcheng 2015/04/07 21:04:00 Even though this is a bit harder to read, I think
sadrul 2015/04/07 21:06:03 Maybe check for both FALSE and VARIANT_FALSE?
dcheng 2015/04/07 21:08:49 My understanding is VARIANT_FALSE / FALSE / false
scottmg 2015/04/07 21:27:15 !! is relatively common to convert from BOOL to bo
dcheng 2015/04/07 21:31:00 I'll just use !! since I find it a bit easier to r
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698