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