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_H_ | 5 #ifndef UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_H_ |
6 #define UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_H_ | 6 #define UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 /////////////////////////////////////////////////////////////////////////////// | 42 /////////////////////////////////////////////////////////////////////////////// |
43 | 43 |
44 // NOTE: Support for html and file contents is required by TabContentViewWin. | 44 // NOTE: Support for html and file contents is required by TabContentViewWin. |
45 // TabContentsViewGtk uses a different class to handle drag support that does | 45 // TabContentsViewGtk uses a different class to handle drag support that does |
46 // not use OSExchangeData. As such, file contents and html support is only | 46 // not use OSExchangeData. As such, file contents and html support is only |
47 // compiled on windows. | 47 // compiled on windows. |
48 class UI_EXPORT OSExchangeData { | 48 class UI_EXPORT OSExchangeData { |
49 public: | 49 public: |
50 // CustomFormats are used for non-standard data types. For example, bookmark | 50 // CustomFormats are used for non-standard data types. For example, bookmark |
51 // nodes are written using a CustomFormat. | 51 // nodes are written using a CustomFormat. |
52 #if defined(USE_AURA) | 52 #if defined(OS_WIN) |
| 53 typedef CLIPFORMAT CustomFormat; |
| 54 #elif defined(USE_AURA) |
53 // Use the same type as the clipboard (why do we want two different | 55 // Use the same type as the clipboard (why do we want two different |
54 // definitions of this on other platforms?). | 56 // definitions of this on other platforms?). |
55 typedef Clipboard::FormatType CustomFormat; | 57 typedef Clipboard::FormatType CustomFormat; |
56 #elif defined(OS_WIN) | |
57 typedef CLIPFORMAT CustomFormat; | |
58 #elif defined(TOOLKIT_GTK) | 58 #elif defined(TOOLKIT_GTK) |
59 typedef GdkAtom CustomFormat; | 59 typedef GdkAtom CustomFormat; |
60 #else | 60 #else |
61 typedef void* CustomFormat; | 61 typedef void* CustomFormat; |
62 #endif | 62 #endif |
63 | 63 |
64 // Enumeration of the known formats. | 64 // Enumeration of the known formats. |
65 enum Format { | 65 enum Format { |
66 STRING = 1 << 0, | 66 STRING = 1 << 0, |
67 URL = 1 << 1, | 67 URL = 1 << 1, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 virtual void SetDownloadFileInfo(const DownloadFileInfo& download) = 0; | 132 virtual void SetDownloadFileInfo(const DownloadFileInfo& download) = 0; |
133 #endif | 133 #endif |
134 | 134 |
135 #if defined(OS_WIN) || defined(USE_AURA) | 135 #if defined(OS_WIN) || defined(USE_AURA) |
136 virtual void SetHtml(const string16& html, const GURL& base_url) = 0; | 136 virtual void SetHtml(const string16& html, const GURL& base_url) = 0; |
137 virtual bool GetHtml(string16* html, GURL* base_url) const = 0; | 137 virtual bool GetHtml(string16* html, GURL* base_url) const = 0; |
138 virtual bool HasHtml() const = 0; | 138 virtual bool HasHtml() const = 0; |
139 #endif | 139 #endif |
140 }; | 140 }; |
141 | 141 |
| 142 // Creates the platform specific Provider. |
| 143 static Provider* CreateProvider(); |
| 144 |
142 OSExchangeData(); | 145 OSExchangeData(); |
143 // Creates an OSExchangeData with the specified provider. OSExchangeData | 146 // Creates an OSExchangeData with the specified provider. OSExchangeData |
144 // takes ownership of the supplied provider. | 147 // takes ownership of the supplied provider. |
145 explicit OSExchangeData(Provider* provider); | 148 explicit OSExchangeData(Provider* provider); |
146 | 149 |
147 ~OSExchangeData(); | 150 ~OSExchangeData(); |
148 | 151 |
149 // Registers the specific string as a possible format for data. | 152 // Registers the specific string as a possible format for data. |
150 static CustomFormat RegisterCustomFormat(const std::string& type); | 153 static CustomFormat RegisterCustomFormat(const std::string& type); |
151 | 154 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 #endif | 218 #endif |
216 | 219 |
217 #if defined(OS_WIN) || defined(USE_AURA) | 220 #if defined(OS_WIN) || defined(USE_AURA) |
218 // Adds a snippet of HTML. |html| is just raw html but this sets both | 221 // Adds a snippet of HTML. |html| is just raw html but this sets both |
219 // text/html and CF_HTML. | 222 // text/html and CF_HTML. |
220 void SetHtml(const string16& html, const GURL& base_url); | 223 void SetHtml(const string16& html, const GURL& base_url); |
221 bool GetHtml(string16* html, GURL* base_url) const; | 224 bool GetHtml(string16* html, GURL* base_url) const; |
222 #endif | 225 #endif |
223 | 226 |
224 private: | 227 private: |
225 // Creates the platform specific Provider. | |
226 static Provider* CreateProvider(); | |
227 | |
228 // Provides the actual data. | 228 // Provides the actual data. |
229 scoped_ptr<Provider> provider_; | 229 scoped_ptr<Provider> provider_; |
230 | 230 |
231 DISALLOW_COPY_AND_ASSIGN(OSExchangeData); | 231 DISALLOW_COPY_AND_ASSIGN(OSExchangeData); |
232 }; | 232 }; |
233 | 233 |
234 } // namespace ui | 234 } // namespace ui |
235 | 235 |
236 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_H_ | 236 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_H_ |
OLD | NEW |