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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 base::FilePath display_name; | 89 base::FilePath display_name; |
90 }; | 90 }; |
91 | 91 |
92 // Provider defines the platform specific part of OSExchangeData that | 92 // Provider defines the platform specific part of OSExchangeData that |
93 // interacts with the native system. | 93 // interacts with the native system. |
94 class UI_EXPORT Provider { | 94 class UI_EXPORT Provider { |
95 public: | 95 public: |
96 Provider() {} | 96 Provider() {} |
97 virtual ~Provider() {} | 97 virtual ~Provider() {} |
98 | 98 |
99 virtual void SetString(const string16& data) = 0; | 99 virtual void SetString(const base::string16& data) = 0; |
100 virtual void SetURL(const GURL& url, const string16& title) = 0; | 100 virtual void SetURL(const GURL& url, const base::string16& title) = 0; |
101 virtual void SetFilename(const base::FilePath& path) = 0; | 101 virtual void SetFilename(const base::FilePath& path) = 0; |
102 virtual void SetFilenames( | 102 virtual void SetFilenames( |
103 const std::vector<FileInfo>& file_names) = 0; | 103 const std::vector<FileInfo>& file_names) = 0; |
104 virtual void SetPickledData(const CustomFormat& format, | 104 virtual void SetPickledData(const CustomFormat& format, |
105 const Pickle& data) = 0; | 105 const Pickle& data) = 0; |
106 | 106 |
107 virtual bool GetString(string16* data) const = 0; | 107 virtual bool GetString(base::string16* data) const = 0; |
108 virtual bool GetURLAndTitle(GURL* url, string16* title) const = 0; | 108 virtual bool GetURLAndTitle(GURL* url, base::string16* title) const = 0; |
109 virtual bool GetFilename(base::FilePath* path) const = 0; | 109 virtual bool GetFilename(base::FilePath* path) const = 0; |
110 virtual bool GetFilenames( | 110 virtual bool GetFilenames( |
111 std::vector<FileInfo>* file_names) const = 0; | 111 std::vector<FileInfo>* file_names) const = 0; |
112 virtual bool GetPickledData(const CustomFormat& format, | 112 virtual bool GetPickledData(const CustomFormat& format, |
113 Pickle* data) const = 0; | 113 Pickle* data) const = 0; |
114 | 114 |
115 virtual bool HasString() const = 0; | 115 virtual bool HasString() const = 0; |
116 virtual bool HasURL() const = 0; | 116 virtual bool HasURL() const = 0; |
117 virtual bool HasFile() const = 0; | 117 virtual bool HasFile() const = 0; |
118 virtual bool HasCustomFormat(const CustomFormat& format) const = 0; | 118 virtual bool HasCustomFormat(const CustomFormat& format) const = 0; |
119 | 119 |
120 #if defined(OS_WIN) | 120 #if defined(OS_WIN) |
121 virtual void SetFileContents(const base::FilePath& filename, | 121 virtual void SetFileContents(const base::FilePath& filename, |
122 const std::string& file_contents) = 0; | 122 const std::string& file_contents) = 0; |
123 virtual bool GetFileContents(base::FilePath* filename, | 123 virtual bool GetFileContents(base::FilePath* filename, |
124 std::string* file_contents) const = 0; | 124 std::string* file_contents) const = 0; |
125 virtual bool HasFileContents() const = 0; | 125 virtual bool HasFileContents() const = 0; |
126 virtual void SetDownloadFileInfo(const DownloadFileInfo& download) = 0; | 126 virtual void SetDownloadFileInfo(const DownloadFileInfo& download) = 0; |
127 virtual void SetInDragLoop(bool in_drag_loop) = 0; | 127 virtual void SetInDragLoop(bool in_drag_loop) = 0; |
128 #endif | 128 #endif |
129 | 129 |
130 #if defined(OS_WIN) || defined(USE_AURA) | 130 #if defined(OS_WIN) || defined(USE_AURA) |
131 virtual void SetHtml(const string16& html, const GURL& base_url) = 0; | 131 virtual void SetHtml(const base::string16& html, const GURL& base_url) = 0; |
132 virtual bool GetHtml(string16* html, GURL* base_url) const = 0; | 132 virtual bool GetHtml(base::string16* html, GURL* base_url) const = 0; |
133 virtual bool HasHtml() const = 0; | 133 virtual bool HasHtml() const = 0; |
134 #endif | 134 #endif |
135 | 135 |
136 #if defined(USE_AURA) | 136 #if defined(USE_AURA) |
137 virtual void SetDragImage(const gfx::ImageSkia& image, | 137 virtual void SetDragImage(const gfx::ImageSkia& image, |
138 const gfx::Vector2d& cursor_offset) = 0; | 138 const gfx::Vector2d& cursor_offset) = 0; |
139 virtual const gfx::ImageSkia& GetDragImage() const = 0; | 139 virtual const gfx::ImageSkia& GetDragImage() const = 0; |
140 virtual const gfx::Vector2d& GetDragImageOffset() const = 0; | 140 virtual const gfx::Vector2d& GetDragImageOffset() const = 0; |
141 #endif | 141 #endif |
142 }; | 142 }; |
(...skipping 15 matching lines...) Expand all Loading... |
158 // These functions add data to the OSExchangeData object of various Chrome | 158 // These functions add data to the OSExchangeData object of various Chrome |
159 // types. The OSExchangeData object takes care of translating the data into | 159 // types. The OSExchangeData object takes care of translating the data into |
160 // a format suitable for exchange with the OS. | 160 // a format suitable for exchange with the OS. |
161 // NOTE WELL: Typically, a data object like this will contain only one of the | 161 // NOTE WELL: Typically, a data object like this will contain only one of the |
162 // following types of data. In cases where more data is held, the | 162 // following types of data. In cases where more data is held, the |
163 // order in which these functions are called is _important_! | 163 // order in which these functions are called is _important_! |
164 // ---> The order types are added to an OSExchangeData object controls | 164 // ---> The order types are added to an OSExchangeData object controls |
165 // the order of enumeration in our IEnumFORMATETC implementation! | 165 // the order of enumeration in our IEnumFORMATETC implementation! |
166 // This comes into play when selecting the best (most preferable) | 166 // This comes into play when selecting the best (most preferable) |
167 // data type for insertion into a DropTarget. | 167 // data type for insertion into a DropTarget. |
168 void SetString(const string16& data); | 168 void SetString(const base::string16& data); |
169 // A URL can have an optional title in some exchange formats. | 169 // A URL can have an optional title in some exchange formats. |
170 void SetURL(const GURL& url, const string16& title); | 170 void SetURL(const GURL& url, const base::string16& title); |
171 // A full path to a file. | 171 // A full path to a file. |
172 void SetFilename(const base::FilePath& path); | 172 void SetFilename(const base::FilePath& path); |
173 // Full path to one or more files. See also SetFilenames() in Provider. | 173 // Full path to one or more files. See also SetFilenames() in Provider. |
174 void SetFilenames( | 174 void SetFilenames( |
175 const std::vector<FileInfo>& file_names); | 175 const std::vector<FileInfo>& file_names); |
176 // Adds pickled data of the specified format. | 176 // Adds pickled data of the specified format. |
177 void SetPickledData(const CustomFormat& format, const Pickle& data); | 177 void SetPickledData(const CustomFormat& format, const Pickle& data); |
178 | 178 |
179 // These functions retrieve data of the specified type. If data exists, the | 179 // These functions retrieve data of the specified type. If data exists, the |
180 // functions return and the result is in the out parameter. If the data does | 180 // functions return and the result is in the out parameter. If the data does |
181 // not exist, the out parameter is not touched. The out parameter cannot be | 181 // not exist, the out parameter is not touched. The out parameter cannot be |
182 // NULL. | 182 // NULL. |
183 bool GetString(string16* data) const; | 183 bool GetString(base::string16* data) const; |
184 bool GetURLAndTitle(GURL* url, string16* title) const; | 184 bool GetURLAndTitle(GURL* url, base::string16* title) const; |
185 // Return the path of a file, if available. | 185 // Return the path of a file, if available. |
186 bool GetFilename(base::FilePath* path) const; | 186 bool GetFilename(base::FilePath* path) const; |
187 bool GetFilenames( | 187 bool GetFilenames( |
188 std::vector<FileInfo>* file_names) const; | 188 std::vector<FileInfo>* file_names) const; |
189 bool GetPickledData(const CustomFormat& format, Pickle* data) const; | 189 bool GetPickledData(const CustomFormat& format, Pickle* data) const; |
190 | 190 |
191 // Test whether or not data of certain types is present, without actually | 191 // Test whether or not data of certain types is present, without actually |
192 // returning anything. | 192 // returning anything. |
193 bool HasString() const; | 193 bool HasString() const; |
194 bool HasURL() const; | 194 bool HasURL() const; |
(...skipping 19 matching lines...) Expand all Loading... |
214 | 214 |
215 // Adds a download file with full path (CF_HDROP). | 215 // Adds a download file with full path (CF_HDROP). |
216 void SetDownloadFileInfo(const DownloadFileInfo& download); | 216 void SetDownloadFileInfo(const DownloadFileInfo& download); |
217 | 217 |
218 void SetInDragLoop(bool in_drag_loop); | 218 void SetInDragLoop(bool in_drag_loop); |
219 #endif | 219 #endif |
220 | 220 |
221 #if defined(OS_WIN) || defined(USE_AURA) | 221 #if defined(OS_WIN) || defined(USE_AURA) |
222 // Adds a snippet of HTML. |html| is just raw html but this sets both | 222 // Adds a snippet of HTML. |html| is just raw html but this sets both |
223 // text/html and CF_HTML. | 223 // text/html and CF_HTML. |
224 void SetHtml(const string16& html, const GURL& base_url); | 224 void SetHtml(const base::string16& html, const GURL& base_url); |
225 bool GetHtml(string16* html, GURL* base_url) const; | 225 bool GetHtml(base::string16* html, GURL* base_url) const; |
226 #endif | 226 #endif |
227 | 227 |
228 private: | 228 private: |
229 // Provides the actual data. | 229 // Provides the actual data. |
230 scoped_ptr<Provider> provider_; | 230 scoped_ptr<Provider> provider_; |
231 | 231 |
232 DISALLOW_COPY_AND_ASSIGN(OSExchangeData); | 232 DISALLOW_COPY_AND_ASSIGN(OSExchangeData); |
233 }; | 233 }; |
234 | 234 |
235 } // namespace ui | 235 } // namespace ui |
236 | 236 |
237 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_H_ | 237 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_H_ |
OLD | NEW |