Chromium Code Reviews| 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 enum FilenameToURLPolicy { | |
| 72 ConvertFilenames, | |
|
sky
2014/01/13 15:13:45
Style guide says enum values should be ALL_CAPS (a
dcheng
2014/01/13 15:49:27
Oops... I've been off in Blink a bit too long. Fix
| |
| 73 DoNotConvertFilenames, | |
| 74 }; | |
| 75 | |
| 71 // Encapsulates the info about a file to be downloaded. | 76 // Encapsulates the info about a file to be downloaded. |
| 72 struct UI_BASE_EXPORT DownloadFileInfo { | 77 struct UI_BASE_EXPORT DownloadFileInfo { |
| 73 DownloadFileInfo(const base::FilePath& filename, | 78 DownloadFileInfo(const base::FilePath& filename, |
| 74 DownloadFileProvider* downloader); | 79 DownloadFileProvider* downloader); |
| 75 ~DownloadFileInfo(); | 80 ~DownloadFileInfo(); |
| 76 | 81 |
| 77 base::FilePath filename; | 82 base::FilePath filename; |
| 78 scoped_refptr<DownloadFileProvider> downloader; | 83 scoped_refptr<DownloadFileProvider> downloader; |
| 79 }; | 84 }; |
| 80 | 85 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 100 | 105 |
| 101 virtual void SetString(const base::string16& data) = 0; | 106 virtual void SetString(const base::string16& data) = 0; |
| 102 virtual void SetURL(const GURL& url, const base::string16& title) = 0; | 107 virtual void SetURL(const GURL& url, const base::string16& title) = 0; |
| 103 virtual void SetFilename(const base::FilePath& path) = 0; | 108 virtual void SetFilename(const base::FilePath& path) = 0; |
| 104 virtual void SetFilenames( | 109 virtual void SetFilenames( |
| 105 const std::vector<FileInfo>& file_names) = 0; | 110 const std::vector<FileInfo>& file_names) = 0; |
| 106 virtual void SetPickledData(const CustomFormat& format, | 111 virtual void SetPickledData(const CustomFormat& format, |
| 107 const Pickle& data) = 0; | 112 const Pickle& data) = 0; |
| 108 | 113 |
| 109 virtual bool GetString(base::string16* data) const = 0; | 114 virtual bool GetString(base::string16* data) const = 0; |
| 110 virtual bool GetURLAndTitle(GURL* url, base::string16* title) const = 0; | 115 virtual bool GetURLAndTitle(FilenameToURLPolicy policy, |
| 116 GURL* url, | |
| 117 base::string16* title) const = 0; | |
| 111 virtual bool GetFilename(base::FilePath* path) const = 0; | 118 virtual bool GetFilename(base::FilePath* path) const = 0; |
| 112 virtual bool GetFilenames( | 119 virtual bool GetFilenames( |
| 113 std::vector<FileInfo>* file_names) const = 0; | 120 std::vector<FileInfo>* file_names) const = 0; |
| 114 virtual bool GetPickledData(const CustomFormat& format, | 121 virtual bool GetPickledData(const CustomFormat& format, |
| 115 Pickle* data) const = 0; | 122 Pickle* data) const = 0; |
| 116 | 123 |
| 117 virtual bool HasString() const = 0; | 124 virtual bool HasString() const = 0; |
| 118 virtual bool HasURL() const = 0; | 125 virtual bool HasURL() const = 0; |
| 119 virtual bool HasFile() const = 0; | 126 virtual bool HasFile() const = 0; |
| 120 virtual bool HasCustomFormat(const CustomFormat& format) const = 0; | 127 virtual bool HasCustomFormat(const CustomFormat& format) const = 0; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 void SetFilenames( | 183 void SetFilenames( |
| 177 const std::vector<FileInfo>& file_names); | 184 const std::vector<FileInfo>& file_names); |
| 178 // Adds pickled data of the specified format. | 185 // Adds pickled data of the specified format. |
| 179 void SetPickledData(const CustomFormat& format, const Pickle& data); | 186 void SetPickledData(const CustomFormat& format, const Pickle& data); |
| 180 | 187 |
| 181 // These functions retrieve data of the specified type. If data exists, the | 188 // 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 | 189 // 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 | 190 // not exist, the out parameter is not touched. The out parameter cannot be |
| 184 // NULL. | 191 // NULL. |
| 185 bool GetString(base::string16* data) const; | 192 bool GetString(base::string16* data) const; |
| 186 bool GetURLAndTitle(GURL* url, base::string16* title) const; | 193 bool GetURLAndTitle(FilenameToURLPolicy policy, |
| 194 GURL* url, | |
| 195 base::string16* title) const; | |
| 187 // Return the path of a file, if available. | 196 // Return the path of a file, if available. |
| 188 bool GetFilename(base::FilePath* path) const; | 197 bool GetFilename(base::FilePath* path) const; |
| 189 bool GetFilenames( | 198 bool GetFilenames( |
| 190 std::vector<FileInfo>* file_names) const; | 199 std::vector<FileInfo>* file_names) const; |
| 191 bool GetPickledData(const CustomFormat& format, Pickle* data) const; | 200 bool GetPickledData(const CustomFormat& format, Pickle* data) const; |
| 192 | 201 |
| 193 // Test whether or not data of certain types is present, without actually | 202 // Test whether or not data of certain types is present, without actually |
| 194 // returning anything. | 203 // returning anything. |
| 195 bool HasString() const; | 204 bool HasString() const; |
| 196 bool HasURL() const; | 205 bool HasURL() const; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 230 private: | 239 private: |
| 231 // Provides the actual data. | 240 // Provides the actual data. |
| 232 scoped_ptr<Provider> provider_; | 241 scoped_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_ |
| OLD | NEW |