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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 FILE_NAME = 1 << 2, | 61 FILE_NAME = 1 << 2, |
62 PICKLED_DATA = 1 << 3, | 62 PICKLED_DATA = 1 << 3, |
63 #if defined(OS_WIN) | 63 #if defined(OS_WIN) |
64 FILE_CONTENTS = 1 << 4, | 64 FILE_CONTENTS = 1 << 4, |
65 #endif | 65 #endif |
66 #if defined(OS_WIN) || defined(USE_AURA) | 66 #if defined(OS_WIN) || defined(USE_AURA) |
67 HTML = 1 << 5, | 67 HTML = 1 << 5, |
68 #endif | 68 #endif |
69 }; | 69 }; |
70 | 70 |
| 71 // Controls whether or not filenames should be converted to file: URLs when |
| 72 // getting a URL. |
| 73 enum FilenameToURLPolicy { CONVERT_FILENAMES, DO_NOT_CONVERT_FILENAMES, }; |
| 74 |
71 // Encapsulates the info about a file to be downloaded. | 75 // Encapsulates the info about a file to be downloaded. |
72 struct UI_EXPORT DownloadFileInfo { | 76 struct UI_EXPORT DownloadFileInfo { |
73 DownloadFileInfo(const base::FilePath& filename, | 77 DownloadFileInfo(const base::FilePath& filename, |
74 DownloadFileProvider* downloader); | 78 DownloadFileProvider* downloader); |
75 ~DownloadFileInfo(); | 79 ~DownloadFileInfo(); |
76 | 80 |
77 base::FilePath filename; | 81 base::FilePath filename; |
78 scoped_refptr<DownloadFileProvider> downloader; | 82 scoped_refptr<DownloadFileProvider> downloader; |
79 }; | 83 }; |
80 | 84 |
(...skipping 19 matching lines...) Expand all Loading... |
100 | 104 |
101 virtual void SetString(const base::string16& data) = 0; | 105 virtual void SetString(const base::string16& data) = 0; |
102 virtual void SetURL(const GURL& url, const base::string16& title) = 0; | 106 virtual void SetURL(const GURL& url, const base::string16& title) = 0; |
103 virtual void SetFilename(const base::FilePath& path) = 0; | 107 virtual void SetFilename(const base::FilePath& path) = 0; |
104 virtual void SetFilenames( | 108 virtual void SetFilenames( |
105 const std::vector<FileInfo>& file_names) = 0; | 109 const std::vector<FileInfo>& file_names) = 0; |
106 virtual void SetPickledData(const CustomFormat& format, | 110 virtual void SetPickledData(const CustomFormat& format, |
107 const Pickle& data) = 0; | 111 const Pickle& data) = 0; |
108 | 112 |
109 virtual bool GetString(base::string16* data) const = 0; | 113 virtual bool GetString(base::string16* data) const = 0; |
110 virtual bool GetURLAndTitle(GURL* url, base::string16* title) const = 0; | 114 virtual bool GetURLAndTitle(FilenameToURLPolicy policy, |
| 115 GURL* url, |
| 116 base::string16* title) const = 0; |
111 virtual bool GetFilename(base::FilePath* path) const = 0; | 117 virtual bool GetFilename(base::FilePath* path) const = 0; |
112 virtual bool GetFilenames( | 118 virtual bool GetFilenames( |
113 std::vector<FileInfo>* file_names) const = 0; | 119 std::vector<FileInfo>* file_names) const = 0; |
114 virtual bool GetPickledData(const CustomFormat& format, | 120 virtual bool GetPickledData(const CustomFormat& format, |
115 Pickle* data) const = 0; | 121 Pickle* data) const = 0; |
116 | 122 |
117 virtual bool HasString() const = 0; | 123 virtual bool HasString() const = 0; |
118 virtual bool HasURL() const = 0; | 124 virtual bool HasURL() const = 0; |
119 virtual bool HasFile() const = 0; | 125 virtual bool HasFile() const = 0; |
120 virtual bool HasCustomFormat(const CustomFormat& format) const = 0; | 126 virtual bool HasCustomFormat(const CustomFormat& format) const = 0; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 void SetFilenames( | 182 void SetFilenames( |
177 const std::vector<FileInfo>& file_names); | 183 const std::vector<FileInfo>& file_names); |
178 // Adds pickled data of the specified format. | 184 // Adds pickled data of the specified format. |
179 void SetPickledData(const CustomFormat& format, const Pickle& data); | 185 void SetPickledData(const CustomFormat& format, const Pickle& data); |
180 | 186 |
181 // 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 |
182 // 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 |
183 // 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 |
184 // NULL. | 190 // NULL. |
185 bool GetString(base::string16* data) const; | 191 bool GetString(base::string16* data) const; |
186 bool GetURLAndTitle(GURL* url, base::string16* title) const; | 192 bool GetURLAndTitle(FilenameToURLPolicy policy, |
| 193 GURL* url, |
| 194 base::string16* title) const; |
187 // Return the path of a file, if available. | 195 // Return the path of a file, if available. |
188 bool GetFilename(base::FilePath* path) const; | 196 bool GetFilename(base::FilePath* path) const; |
189 bool GetFilenames( | 197 bool GetFilenames( |
190 std::vector<FileInfo>* file_names) const; | 198 std::vector<FileInfo>* file_names) const; |
191 bool GetPickledData(const CustomFormat& format, Pickle* data) const; | 199 bool GetPickledData(const CustomFormat& format, Pickle* data) const; |
192 | 200 |
193 // Test whether or not data of certain types is present, without actually | 201 // Test whether or not data of certain types is present, without actually |
194 // returning anything. | 202 // returning anything. |
195 bool HasString() const; | 203 bool HasString() const; |
196 bool HasURL() const; | 204 bool HasURL() const; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 private: | 238 private: |
231 // Provides the actual data. | 239 // Provides the actual data. |
232 scoped_ptr<Provider> provider_; | 240 scoped_ptr<Provider> provider_; |
233 | 241 |
234 DISALLOW_COPY_AND_ASSIGN(OSExchangeData); | 242 DISALLOW_COPY_AND_ASSIGN(OSExchangeData); |
235 }; | 243 }; |
236 | 244 |
237 } // namespace ui | 245 } // namespace ui |
238 | 246 |
239 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_H_ | 247 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_H_ |
OLD | NEW |