| 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 #ifndef UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_WIN_H_ | 5 #ifndef UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_WIN_H_ |
| 6 #define UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_WIN_H_ | 6 #define UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_WIN_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <objidl.h> | 9 #include <objidl.h> |
| 10 #include <shlobj.h> | 10 #include <shlobj.h> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 // Win8 SDK compatibility, see http://goo.gl/fufvl for more information. |
| 14 // "Note: This interface has been renamed IDataObjectAsyncCapability." |
| 15 // If we're building on pre-8 we define it to its old name. It's documented as |
| 16 // being binary compatible. |
| 17 #ifndef __IDataObjectAsyncCapability_FWD_DEFINED__ |
| 18 #define IDataObjectAsyncCapability IAsyncOperation |
| 19 #define IID_IDataObjectAsyncCapability IID_IAsyncOperation |
| 20 #endif |
| 21 |
| 13 #include "base/win/scoped_comptr.h" | 22 #include "base/win/scoped_comptr.h" |
| 14 #include "ui/base/dragdrop/os_exchange_data.h" | 23 #include "ui/base/dragdrop/os_exchange_data.h" |
| 15 #include "ui/base/ui_export.h" | 24 #include "ui/base/ui_export.h" |
| 16 | 25 |
| 17 namespace ui { | 26 namespace ui { |
| 18 | 27 |
| 19 class DataObjectImpl : public DownloadFileObserver, | 28 class DataObjectImpl : public DownloadFileObserver, |
| 20 public IDataObject, | 29 public IDataObject, |
| 21 public IAsyncOperation { | 30 public IDataObjectAsyncCapability { |
| 22 public: | 31 public: |
| 23 class Observer { | 32 class Observer { |
| 24 public: | 33 public: |
| 25 virtual void OnWaitForData() = 0; | 34 virtual void OnWaitForData() = 0; |
| 26 virtual void OnDataObjectDisposed() = 0; | 35 virtual void OnDataObjectDisposed() = 0; |
| 27 protected: | 36 protected: |
| 28 virtual ~Observer() { } | 37 virtual ~Observer() { } |
| 29 }; | 38 }; |
| 30 | 39 |
| 31 DataObjectImpl(); | 40 DataObjectImpl(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 48 FORMATETC* format_etc, FORMATETC* result); | 57 FORMATETC* format_etc, FORMATETC* result); |
| 49 HRESULT __stdcall SetData( | 58 HRESULT __stdcall SetData( |
| 50 FORMATETC* format_etc, STGMEDIUM* medium, BOOL should_release); | 59 FORMATETC* format_etc, STGMEDIUM* medium, BOOL should_release); |
| 51 HRESULT __stdcall EnumFormatEtc( | 60 HRESULT __stdcall EnumFormatEtc( |
| 52 DWORD direction, IEnumFORMATETC** enumerator); | 61 DWORD direction, IEnumFORMATETC** enumerator); |
| 53 HRESULT __stdcall DAdvise(FORMATETC* format_etc, DWORD advf, | 62 HRESULT __stdcall DAdvise(FORMATETC* format_etc, DWORD advf, |
| 54 IAdviseSink* sink, DWORD* connection); | 63 IAdviseSink* sink, DWORD* connection); |
| 55 HRESULT __stdcall DUnadvise(DWORD connection); | 64 HRESULT __stdcall DUnadvise(DWORD connection); |
| 56 HRESULT __stdcall EnumDAdvise(IEnumSTATDATA** enumerator); | 65 HRESULT __stdcall EnumDAdvise(IEnumSTATDATA** enumerator); |
| 57 | 66 |
| 58 // IAsyncOperation implementation: | 67 // IDataObjectAsyncCapability implementation: |
| 59 HRESULT __stdcall EndOperation( | 68 HRESULT __stdcall EndOperation( |
| 60 HRESULT result, IBindCtx* reserved, DWORD effects); | 69 HRESULT result, IBindCtx* reserved, DWORD effects); |
| 61 HRESULT __stdcall GetAsyncMode(BOOL* is_op_async); | 70 HRESULT __stdcall GetAsyncMode(BOOL* is_op_async); |
| 62 HRESULT __stdcall InOperation(BOOL* in_async_op); | 71 HRESULT __stdcall InOperation(BOOL* in_async_op); |
| 63 HRESULT __stdcall SetAsyncMode(BOOL do_op_async); | 72 HRESULT __stdcall SetAsyncMode(BOOL do_op_async); |
| 64 HRESULT __stdcall StartOperation(IBindCtx* reserved); | 73 HRESULT __stdcall StartOperation(IBindCtx* reserved); |
| 65 | 74 |
| 66 // IUnknown implementation: | 75 // IUnknown implementation: |
| 67 HRESULT __stdcall QueryInterface(const IID& iid, void** object); | 76 HRESULT __stdcall QueryInterface(const IID& iid, void** object); |
| 68 ULONG __stdcall AddRef(); | 77 ULONG __stdcall AddRef(); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 public: | 140 public: |
| 132 // Returns true if source has plain text that is a valid url. | 141 // Returns true if source has plain text that is a valid url. |
| 133 static bool HasPlainTextURL(IDataObject* source); | 142 static bool HasPlainTextURL(IDataObject* source); |
| 134 | 143 |
| 135 // Returns true if source has plain text that is a valid URL and sets url to | 144 // Returns true if source has plain text that is a valid URL and sets url to |
| 136 // that url. | 145 // that url. |
| 137 static bool GetPlainTextURL(IDataObject* source, GURL* url); | 146 static bool GetPlainTextURL(IDataObject* source, GURL* url); |
| 138 | 147 |
| 139 static DataObjectImpl* GetDataObjectImpl(const OSExchangeData& data); | 148 static DataObjectImpl* GetDataObjectImpl(const OSExchangeData& data); |
| 140 static IDataObject* GetIDataObject(const OSExchangeData& data); | 149 static IDataObject* GetIDataObject(const OSExchangeData& data); |
| 141 static IAsyncOperation* GetIAsyncOperation(const OSExchangeData& data); | 150 static IDataObjectAsyncCapability* GetIAsyncOperation( |
| 151 const OSExchangeData& data); |
| 142 | 152 |
| 143 explicit OSExchangeDataProviderWin(IDataObject* source); | 153 explicit OSExchangeDataProviderWin(IDataObject* source); |
| 144 OSExchangeDataProviderWin(); | 154 OSExchangeDataProviderWin(); |
| 145 | 155 |
| 146 virtual ~OSExchangeDataProviderWin(); | 156 virtual ~OSExchangeDataProviderWin(); |
| 147 | 157 |
| 148 IDataObject* data_object() const { return data_.get(); } | 158 IDataObject* data_object() const { return data_.get(); } |
| 149 IAsyncOperation* async_operation() const { return data_.get(); } | 159 IDataObjectAsyncCapability* async_operation() const { return data_.get(); } |
| 150 | 160 |
| 151 // OSExchangeData::Provider methods. | 161 // OSExchangeData::Provider methods. |
| 152 virtual void SetString(const string16& data); | 162 virtual void SetString(const string16& data); |
| 153 virtual void SetURL(const GURL& url, const string16& title); | 163 virtual void SetURL(const GURL& url, const string16& title); |
| 154 virtual void SetFilename(const FilePath& path); | 164 virtual void SetFilename(const FilePath& path); |
| 155 virtual void SetFilenames( | 165 virtual void SetFilenames( |
| 156 const std::vector<OSExchangeData::FileInfo>& filenames) { | 166 const std::vector<OSExchangeData::FileInfo>& filenames) { |
| 157 NOTREACHED(); | 167 NOTREACHED(); |
| 158 } | 168 } |
| 159 virtual void SetPickledData(OSExchangeData::CustomFormat format, | 169 virtual void SetPickledData(OSExchangeData::CustomFormat format, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 187 private: | 197 private: |
| 188 scoped_refptr<DataObjectImpl> data_; | 198 scoped_refptr<DataObjectImpl> data_; |
| 189 base::win::ScopedComPtr<IDataObject> source_object_; | 199 base::win::ScopedComPtr<IDataObject> source_object_; |
| 190 | 200 |
| 191 DISALLOW_COPY_AND_ASSIGN(OSExchangeDataProviderWin); | 201 DISALLOW_COPY_AND_ASSIGN(OSExchangeDataProviderWin); |
| 192 }; | 202 }; |
| 193 | 203 |
| 194 } // namespace ui | 204 } // namespace ui |
| 195 | 205 |
| 196 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_WIN_H_ | 206 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_WIN_H_ |
| OLD | NEW |