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

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

Issue 2014733003: Removing parsing of text from pasteboard. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moving url parsing up the hierarchy Created 4 years, 6 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 void SetPickledData(const Clipboard::FormatType& format, 187 void SetPickledData(const Clipboard::FormatType& format,
181 const base::Pickle& data); 188 const base::Pickle& data);
182 189
183 // These functions retrieve data of the specified type. If data exists, the 190 // These functions retrieve data of the specified type. If data exists, the
184 // functions return and the result is in the out parameter. If the data does 191 // functions return and the result is in the out parameter. If the data does
185 // not exist, the out parameter is not touched. The out parameter cannot be 192 // not exist, the out parameter is not touched. The out parameter cannot be
186 // NULL. 193 // NULL.
187 // GetString() returns the plain text representation of the pasteboard 194 // GetString() returns the plain text representation of the pasteboard
188 // contents. 195 // contents.
189 bool GetString(base::string16* data) const; 196 bool GetString(base::string16* data) const;
190 bool GetURLAndTitle(FilenameToURLPolicy policy, 197 bool GetURLAndTitle(FilenameToURLPolicy filename_policy,
198 URLTextParsePolicy text_parse_policy,
191 GURL* url, 199 GURL* url,
192 base::string16* title) const; 200 base::string16* title) const;
193 // Return the path of a file, if available. 201 // Return the path of a file, if available.
194 bool GetFilename(base::FilePath* path) const; 202 bool GetFilename(base::FilePath* path) const;
195 bool GetFilenames(std::vector<FileInfo>* file_names) const; 203 bool GetFilenames(std::vector<FileInfo>* file_names) const;
196 bool GetPickledData(const Clipboard::FormatType& format, 204 bool GetPickledData(const Clipboard::FormatType& format,
197 base::Pickle* data) const; 205 base::Pickle* data) const;
198 206
199 // Test whether or not data of certain types is present, without actually 207 // Test whether or not data of certain types is present, without actually
200 // returning anything. 208 // returning anything.
201 bool HasString() const; 209 bool HasString() const;
202 bool HasURL(FilenameToURLPolicy policy) const; 210 bool HasURL(FilenameToURLPolicy filename_policy,
211 URLTextParsePolicy text_parse_policy) const;
203 bool HasFile() const; 212 bool HasFile() const;
204 bool HasCustomFormat(const Clipboard::FormatType& format) const; 213 bool HasCustomFormat(const Clipboard::FormatType& format) const;
205 214
206 // Returns true if this OSExchangeData has data in any of the formats in 215 // Returns true if this OSExchangeData has data in any of the formats in
207 // |formats| or any custom format in |custom_formats|. 216 // |formats| or any custom format in |custom_formats|.
208 bool HasAnyFormat(int formats, 217 bool HasAnyFormat(int formats,
209 const std::set<Clipboard::FormatType>& types) const; 218 const std::set<Clipboard::FormatType>& types) const;
210 219
211 #if defined(OS_WIN) 220 #if defined(OS_WIN)
212 // Adds the bytes of a file (CFSTR_FILECONTENTS and CFSTR_FILEDESCRIPTOR on 221 // Adds the bytes of a file (CFSTR_FILECONTENTS and CFSTR_FILEDESCRIPTOR on
(...skipping 17 matching lines...) Expand all
230 private: 239 private:
231 // Provides the actual data. 240 // Provides the actual data.
232 std::unique_ptr<Provider> provider_; 241 std::unique_ptr<Provider> provider_;
233 242
234 DISALLOW_COPY_AND_ASSIGN(OSExchangeData); 243 DISALLOW_COPY_AND_ASSIGN(OSExchangeData);
235 }; 244 };
236 245
237 } // namespace ui 246 } // namespace ui
238 247
239 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_H_ 248 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698