Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: ui/base/dragdrop/os_exchange_data.h

Issue 2322253004: Drag and dropping text, parsable as url (Closed)
Patch Set: initial patch for windows Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 #endif 63 #endif
64 #if defined(USE_AURA) 64 #if defined(USE_AURA)
65 HTML = 1 << 5, 65 HTML = 1 << 5,
66 #endif 66 #endif
67 }; 67 };
68 68
69 // Controls whether or not filenames should be converted to file: URLs when 69 // Controls whether or not filenames should be converted to file: URLs when
70 // getting a URL. 70 // getting a URL.
71 enum FilenameToURLPolicy { CONVERT_FILENAMES, DO_NOT_CONVERT_FILENAMES, }; 71 enum FilenameToURLPolicy { CONVERT_FILENAMES, DO_NOT_CONVERT_FILENAMES, };
72 72
73 // Controls whether or not to attempt to parse dragged text as URL when
74 // getting a URL.
75 enum URLTextParsePolicy {
76 PARSE_TEXT_AS_URL,
77 DO_NOT_PARSE_TEXT_AS_URL,
78 };
79
73 // Encapsulates the info about a file to be downloaded. 80 // Encapsulates the info about a file to be downloaded.
74 struct UI_BASE_EXPORT DownloadFileInfo { 81 struct UI_BASE_EXPORT DownloadFileInfo {
75 DownloadFileInfo(const base::FilePath& filename, 82 DownloadFileInfo(const base::FilePath& filename,
76 DownloadFileProvider* downloader); 83 DownloadFileProvider* downloader);
77 ~DownloadFileInfo(); 84 ~DownloadFileInfo();
78 85
79 base::FilePath filename; 86 base::FilePath filename;
80 scoped_refptr<DownloadFileProvider> downloader; 87 scoped_refptr<DownloadFileProvider> downloader;
81 }; 88 };
82 89
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 void SetPickledData(const Clipboard::FormatType& format, 184 void SetPickledData(const Clipboard::FormatType& format,
178 const base::Pickle& data); 185 const base::Pickle& data);
179 186
180 // These functions retrieve data of the specified type. If data exists, the 187 // These functions retrieve data of the specified type. If data exists, the
181 // functions return and the result is in the out parameter. If the data does 188 // functions return and the result is in the out parameter. If the data does
182 // not exist, the out parameter is not touched. The out parameter cannot be 189 // not exist, the out parameter is not touched. The out parameter cannot be
183 // NULL. 190 // NULL.
184 // GetString() returns the plain text representation of the pasteboard 191 // GetString() returns the plain text representation of the pasteboard
185 // contents. 192 // contents.
186 bool GetString(base::string16* data) const; 193 bool GetString(base::string16* data) const;
187 bool GetURLAndTitle(FilenameToURLPolicy policy, 194 bool GetURLAndTitle(FilenameToURLPolicy,
195 URLTextParsePolicy,
188 GURL* url, 196 GURL* url,
189 base::string16* title) const; 197 base::string16* title) const;
190 // Return the path of a file, if available. 198 // Return the path of a file, if available.
191 bool GetFilename(base::FilePath* path) const; 199 bool GetFilename(base::FilePath* path) const;
192 bool GetFilenames(std::vector<FileInfo>* file_names) const; 200 bool GetFilenames(std::vector<FileInfo>* file_names) const;
193 bool GetPickledData(const Clipboard::FormatType& format, 201 bool GetPickledData(const Clipboard::FormatType& format,
194 base::Pickle* data) const; 202 base::Pickle* data) const;
195 203
196 // Test whether or not data of certain types is present, without actually 204 // Test whether or not data of certain types is present, without actually
197 // returning anything. 205 // returning anything.
198 bool HasString() const; 206 bool HasString() const;
199 bool HasURL(FilenameToURLPolicy policy) const; 207 bool HasURL(FilenameToURLPolicy, URLTextParsePolicy) const;
200 bool HasFile() const; 208 bool HasFile() const;
201 bool HasCustomFormat(const Clipboard::FormatType& format) const; 209 bool HasCustomFormat(const Clipboard::FormatType& format) const;
202 210
203 // Returns true if this OSExchangeData has data in any of the formats in 211 // Returns true if this OSExchangeData has data in any of the formats in
204 // |formats| or any custom format in |custom_formats|. 212 // |formats| or any custom format in |custom_formats|.
205 bool HasAnyFormat(int formats, 213 bool HasAnyFormat(int formats,
206 const std::set<Clipboard::FormatType>& types) const; 214 const std::set<Clipboard::FormatType>& types) const;
207 215
208 #if defined(OS_WIN) 216 #if defined(OS_WIN)
209 // Adds the bytes of a file (CFSTR_FILECONTENTS and CFSTR_FILEDESCRIPTOR on 217 // Adds the bytes of a file (CFSTR_FILECONTENTS and CFSTR_FILEDESCRIPTOR on
(...skipping 17 matching lines...) Expand all
227 private: 235 private:
228 // Provides the actual data. 236 // Provides the actual data.
229 std::unique_ptr<Provider> provider_; 237 std::unique_ptr<Provider> provider_;
230 238
231 DISALLOW_COPY_AND_ASSIGN(OSExchangeData); 239 DISALLOW_COPY_AND_ASSIGN(OSExchangeData);
232 }; 240 };
233 241
234 } // namespace ui 242 } // namespace ui
235 243
236 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_H_ 244 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698