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> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #if defined(OS_WIN) | 13 #if defined(OS_WIN) |
14 #include <objidl.h> | 14 #include <objidl.h> |
15 #endif | 15 #endif |
16 | 16 |
17 #include "base/basictypes.h" | 17 #include "base/basictypes.h" |
18 #include "base/files/file_path.h" | 18 #include "base/files/file_path.h" |
19 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
20 #include "ui/base/clipboard/clipboard.h" | 20 #include "ui/base/clipboard/clipboard.h" |
21 #include "ui/base/dragdrop/download_file_interface.h" | 21 #include "ui/base/dragdrop/download_file_interface.h" |
22 #include "ui/base/ui_base_export.h" | 22 #include "ui/base/ui_base_export.h" |
23 | 23 |
24 class GURL; | 24 class GURL; |
| 25 |
| 26 namespace base { |
25 class Pickle; | 27 class Pickle; |
| 28 } |
26 | 29 |
27 namespace gfx { | 30 namespace gfx { |
28 class ImageSkia; | 31 class ImageSkia; |
29 class Vector2d; | 32 class Vector2d; |
30 } | 33 } |
31 | 34 |
32 namespace ui { | 35 namespace ui { |
33 | 36 |
34 struct FileInfo; | 37 struct FileInfo; |
35 | 38 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 96 |
94 virtual void MarkOriginatedFromRenderer() = 0; | 97 virtual void MarkOriginatedFromRenderer() = 0; |
95 virtual bool DidOriginateFromRenderer() const = 0; | 98 virtual bool DidOriginateFromRenderer() const = 0; |
96 | 99 |
97 virtual void SetString(const base::string16& data) = 0; | 100 virtual void SetString(const base::string16& data) = 0; |
98 virtual void SetURL(const GURL& url, const base::string16& title) = 0; | 101 virtual void SetURL(const GURL& url, const base::string16& title) = 0; |
99 virtual void SetFilename(const base::FilePath& path) = 0; | 102 virtual void SetFilename(const base::FilePath& path) = 0; |
100 virtual void SetFilenames( | 103 virtual void SetFilenames( |
101 const std::vector<FileInfo>& file_names) = 0; | 104 const std::vector<FileInfo>& file_names) = 0; |
102 virtual void SetPickledData(const CustomFormat& format, | 105 virtual void SetPickledData(const CustomFormat& format, |
103 const Pickle& data) = 0; | 106 const base::Pickle& data) = 0; |
104 | 107 |
105 virtual bool GetString(base::string16* data) const = 0; | 108 virtual bool GetString(base::string16* data) const = 0; |
106 virtual bool GetURLAndTitle(FilenameToURLPolicy policy, | 109 virtual bool GetURLAndTitle(FilenameToURLPolicy policy, |
107 GURL* url, | 110 GURL* url, |
108 base::string16* title) const = 0; | 111 base::string16* title) const = 0; |
109 virtual bool GetFilename(base::FilePath* path) const = 0; | 112 virtual bool GetFilename(base::FilePath* path) const = 0; |
110 virtual bool GetFilenames( | 113 virtual bool GetFilenames( |
111 std::vector<FileInfo>* file_names) const = 0; | 114 std::vector<FileInfo>* file_names) const = 0; |
112 virtual bool GetPickledData(const CustomFormat& format, | 115 virtual bool GetPickledData(const CustomFormat& format, |
113 Pickle* data) const = 0; | 116 base::Pickle* data) const = 0; |
114 | 117 |
115 virtual bool HasString() const = 0; | 118 virtual bool HasString() const = 0; |
116 virtual bool HasURL(FilenameToURLPolicy policy) const = 0; | 119 virtual bool HasURL(FilenameToURLPolicy policy) const = 0; |
117 virtual bool HasFile() const = 0; | 120 virtual bool HasFile() const = 0; |
118 virtual bool HasCustomFormat(const CustomFormat& format) const = 0; | 121 virtual bool HasCustomFormat(const CustomFormat& format) const = 0; |
119 | 122 |
120 #if (!defined(OS_CHROMEOS) && defined(USE_X11)) || defined(OS_WIN) | 123 #if (!defined(OS_CHROMEOS) && defined(USE_X11)) || defined(OS_WIN) |
121 virtual void SetFileContents(const base::FilePath& filename, | 124 virtual void SetFileContents(const base::FilePath& filename, |
122 const std::string& file_contents) = 0; | 125 const std::string& file_contents) = 0; |
123 #endif | 126 #endif |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // data type for insertion into a DropTarget. | 177 // data type for insertion into a DropTarget. |
175 void SetString(const base::string16& data); | 178 void SetString(const base::string16& data); |
176 // A URL can have an optional title in some exchange formats. | 179 // A URL can have an optional title in some exchange formats. |
177 void SetURL(const GURL& url, const base::string16& title); | 180 void SetURL(const GURL& url, const base::string16& title); |
178 // A full path to a file. | 181 // A full path to a file. |
179 void SetFilename(const base::FilePath& path); | 182 void SetFilename(const base::FilePath& path); |
180 // Full path to one or more files. See also SetFilenames() in Provider. | 183 // Full path to one or more files. See also SetFilenames() in Provider. |
181 void SetFilenames( | 184 void SetFilenames( |
182 const std::vector<FileInfo>& file_names); | 185 const std::vector<FileInfo>& file_names); |
183 // Adds pickled data of the specified format. | 186 // Adds pickled data of the specified format. |
184 void SetPickledData(const CustomFormat& format, const Pickle& data); | 187 void SetPickledData(const CustomFormat& format, const base::Pickle& data); |
185 | 188 |
186 // These functions retrieve data of the specified type. If data exists, the | 189 // These functions retrieve data of the specified type. If data exists, the |
187 // functions return and the result is in the out parameter. If the data does | 190 // functions return and the result is in the out parameter. If the data does |
188 // not exist, the out parameter is not touched. The out parameter cannot be | 191 // not exist, the out parameter is not touched. The out parameter cannot be |
189 // NULL. | 192 // NULL. |
190 bool GetString(base::string16* data) const; | 193 bool GetString(base::string16* data) const; |
191 bool GetURLAndTitle(FilenameToURLPolicy policy, | 194 bool GetURLAndTitle(FilenameToURLPolicy policy, |
192 GURL* url, | 195 GURL* url, |
193 base::string16* title) const; | 196 base::string16* title) const; |
194 // Return the path of a file, if available. | 197 // Return the path of a file, if available. |
195 bool GetFilename(base::FilePath* path) const; | 198 bool GetFilename(base::FilePath* path) const; |
196 bool GetFilenames( | 199 bool GetFilenames( |
197 std::vector<FileInfo>* file_names) const; | 200 std::vector<FileInfo>* file_names) const; |
198 bool GetPickledData(const CustomFormat& format, Pickle* data) const; | 201 bool GetPickledData(const CustomFormat& format, base::Pickle* data) const; |
199 | 202 |
200 // Test whether or not data of certain types is present, without actually | 203 // Test whether or not data of certain types is present, without actually |
201 // returning anything. | 204 // returning anything. |
202 bool HasString() const; | 205 bool HasString() const; |
203 bool HasURL(FilenameToURLPolicy policy) const; | 206 bool HasURL(FilenameToURLPolicy policy) const; |
204 bool HasFile() const; | 207 bool HasFile() const; |
205 bool HasCustomFormat(const CustomFormat& format) const; | 208 bool HasCustomFormat(const CustomFormat& format) const; |
206 | 209 |
207 // Returns true if this OSExchangeData has data in any of the formats in | 210 // Returns true if this OSExchangeData has data in any of the formats in |
208 // |formats| or any custom format in |custom_formats|. | 211 // |formats| or any custom format in |custom_formats|. |
(...skipping 22 matching lines...) Expand all Loading... |
231 private: | 234 private: |
232 // Provides the actual data. | 235 // Provides the actual data. |
233 scoped_ptr<Provider> provider_; | 236 scoped_ptr<Provider> provider_; |
234 | 237 |
235 DISALLOW_COPY_AND_ASSIGN(OSExchangeData); | 238 DISALLOW_COPY_AND_ASSIGN(OSExchangeData); |
236 }; | 239 }; |
237 | 240 |
238 } // namespace ui | 241 } // namespace ui |
239 | 242 |
240 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_H_ | 243 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_H_ |
OLD | NEW |