| 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 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 } | 239 } |
| 240 | 240 |
| 241 // static | 241 // static |
| 242 IDataObject* OSExchangeDataProviderWin::GetIDataObject( | 242 IDataObject* OSExchangeDataProviderWin::GetIDataObject( |
| 243 const OSExchangeData& data) { | 243 const OSExchangeData& data) { |
| 244 return static_cast<const OSExchangeDataProviderWin*>(&data.provider())-> | 244 return static_cast<const OSExchangeDataProviderWin*>(&data.provider())-> |
| 245 data_object(); | 245 data_object(); |
| 246 } | 246 } |
| 247 | 247 |
| 248 // static | 248 // static |
| 249 IAsyncOperation* OSExchangeDataProviderWin::GetIAsyncOperation( | 249 IDataObjectAsyncCapability* OSExchangeDataProviderWin::GetIAsyncOperation( |
| 250 const OSExchangeData& data) { | 250 const OSExchangeData& data) { |
| 251 return static_cast<const OSExchangeDataProviderWin*>(&data.provider())-> | 251 return static_cast<const OSExchangeDataProviderWin*>(&data.provider())-> |
| 252 async_operation(); | 252 async_operation(); |
| 253 } | 253 } |
| 254 | 254 |
| 255 OSExchangeDataProviderWin::OSExchangeDataProviderWin(IDataObject* source) | 255 OSExchangeDataProviderWin::OSExchangeDataProviderWin(IDataObject* source) |
| 256 : data_(new DataObjectImpl()), | 256 : data_(new DataObjectImpl()), |
| 257 source_object_(source) { | 257 source_object_(source) { |
| 258 } | 258 } |
| 259 | 259 |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 | 747 |
| 748 HRESULT DataObjectImpl::DUnadvise(DWORD connection) { | 748 HRESULT DataObjectImpl::DUnadvise(DWORD connection) { |
| 749 return OLE_E_ADVISENOTSUPPORTED; | 749 return OLE_E_ADVISENOTSUPPORTED; |
| 750 } | 750 } |
| 751 | 751 |
| 752 HRESULT DataObjectImpl::EnumDAdvise(IEnumSTATDATA** enumerator) { | 752 HRESULT DataObjectImpl::EnumDAdvise(IEnumSTATDATA** enumerator) { |
| 753 return OLE_E_ADVISENOTSUPPORTED; | 753 return OLE_E_ADVISENOTSUPPORTED; |
| 754 } | 754 } |
| 755 | 755 |
| 756 /////////////////////////////////////////////////////////////////////////////// | 756 /////////////////////////////////////////////////////////////////////////////// |
| 757 // DataObjectImpl, IAsyncOperation implementation: | 757 // DataObjectImpl, IDataObjectAsyncCapability implementation: |
| 758 | 758 |
| 759 HRESULT DataObjectImpl::EndOperation( | 759 HRESULT DataObjectImpl::EndOperation( |
| 760 HRESULT result, IBindCtx* reserved, DWORD effects) { | 760 HRESULT result, IBindCtx* reserved, DWORD effects) { |
| 761 async_operation_started_ = false; | 761 async_operation_started_ = false; |
| 762 return S_OK; | 762 return S_OK; |
| 763 } | 763 } |
| 764 | 764 |
| 765 HRESULT DataObjectImpl::GetAsyncMode(BOOL* is_op_async) { | 765 HRESULT DataObjectImpl::GetAsyncMode(BOOL* is_op_async) { |
| 766 *is_op_async = in_async_mode_ ? TRUE : FALSE; | 766 *is_op_async = in_async_mode_ ? TRUE : FALSE; |
| 767 return S_OK; | 767 return S_OK; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 783 } | 783 } |
| 784 | 784 |
| 785 /////////////////////////////////////////////////////////////////////////////// | 785 /////////////////////////////////////////////////////////////////////////////// |
| 786 // DataObjectImpl, IUnknown implementation: | 786 // DataObjectImpl, IUnknown implementation: |
| 787 | 787 |
| 788 HRESULT DataObjectImpl::QueryInterface(const IID& iid, void** object) { | 788 HRESULT DataObjectImpl::QueryInterface(const IID& iid, void** object) { |
| 789 if (!object) | 789 if (!object) |
| 790 return E_POINTER; | 790 return E_POINTER; |
| 791 if (IsEqualIID(iid, IID_IDataObject) || IsEqualIID(iid, IID_IUnknown)) { | 791 if (IsEqualIID(iid, IID_IDataObject) || IsEqualIID(iid, IID_IUnknown)) { |
| 792 *object = static_cast<IDataObject*>(this); | 792 *object = static_cast<IDataObject*>(this); |
| 793 } else if (in_async_mode_ && IsEqualIID(iid, IID_IAsyncOperation)) { | 793 } else if (in_async_mode_ && |
| 794 *object = static_cast<IAsyncOperation*>(this); | 794 IsEqualIID(iid, IID_IDataObjectAsyncCapability)) { |
| 795 *object = static_cast<IDataObjectAsyncCapability*>(this); |
| 795 } else { | 796 } else { |
| 796 *object = NULL; | 797 *object = NULL; |
| 797 return E_NOINTERFACE; | 798 return E_NOINTERFACE; |
| 798 } | 799 } |
| 799 AddRef(); | 800 AddRef(); |
| 800 return S_OK; | 801 return S_OK; |
| 801 } | 802 } |
| 802 | 803 |
| 803 ULONG DataObjectImpl::AddRef() { | 804 ULONG DataObjectImpl::AddRef() { |
| 804 base::RefCountedThreadSafe<DownloadFileObserver>::AddRef(); | 805 base::RefCountedThreadSafe<DownloadFileObserver>::AddRef(); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 return new OSExchangeDataProviderWin(); | 942 return new OSExchangeDataProviderWin(); |
| 942 } | 943 } |
| 943 | 944 |
| 944 // static | 945 // static |
| 945 OSExchangeData::CustomFormat OSExchangeData::RegisterCustomFormat( | 946 OSExchangeData::CustomFormat OSExchangeData::RegisterCustomFormat( |
| 946 const std::string& type) { | 947 const std::string& type) { |
| 947 return RegisterClipboardFormat(ASCIIToUTF16(type).c_str()); | 948 return RegisterClipboardFormat(ASCIIToUTF16(type).c_str()); |
| 948 } | 949 } |
| 949 | 950 |
| 950 } // namespace ui | 951 } // namespace ui |
| OLD | NEW |