OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_CLIPBOARD_CLIPBOARD_H_ | 5 #ifndef UI_BASE_CLIPBOARD_CLIPBOARD_H_ |
6 #define UI_BASE_CLIPBOARD_CLIPBOARD_H_ | 6 #define UI_BASE_CLIPBOARD_CLIPBOARD_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 | 165 |
166 // Reads a file or group of files from the clipboard, if available, into the | 166 // Reads a file or group of files from the clipboard, if available, into the |
167 // out parameter. | 167 // out parameter. |
168 void ReadFile(FilePath* file) const; | 168 void ReadFile(FilePath* file) const; |
169 void ReadFiles(std::vector<FilePath>* files) const; | 169 void ReadFiles(std::vector<FilePath>* files) const; |
170 | 170 |
171 // Reads raw data from the clipboard with the given format type. Stores result | 171 // Reads raw data from the clipboard with the given format type. Stores result |
172 // as a byte vector. | 172 // as a byte vector. |
173 // TODO(dcheng): Due to platform limitations on Windows, we should make sure | 173 // TODO(dcheng): Due to platform limitations on Windows, we should make sure |
174 // format is never controlled by the user. | 174 // format is never controlled by the user. |
175 void ReadData(const std::string& format, std::string* result); | 175 void ReadData(const std::string& format, std::string* result) const; |
176 | 176 |
177 // Get format Identifiers for various types. | 177 // Get format Identifiers for various types. |
178 static FormatType GetUrlFormatType(); | 178 static FormatType GetUrlFormatType(); |
179 static FormatType GetUrlWFormatType(); | 179 static FormatType GetUrlWFormatType(); |
180 static FormatType GetMozUrlFormatType(); | 180 static FormatType GetMozUrlFormatType(); |
181 static FormatType GetPlainTextFormatType(); | 181 static FormatType GetPlainTextFormatType(); |
182 static FormatType GetPlainTextWFormatType(); | 182 static FormatType GetPlainTextWFormatType(); |
183 static FormatType GetFilenameFormatType(); | 183 static FormatType GetFilenameFormatType(); |
184 static FormatType GetFilenameWFormatType(); | 184 static FormatType GetFilenameWFormatType(); |
185 static FormatType GetWebKitSmartPasteFormatType(); | 185 static FormatType GetWebKitSmartPasteFormatType(); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
218 | 218 |
219 void WriteBookmark(const char* title_data, | 219 void WriteBookmark(const char* title_data, |
220 size_t title_len, | 220 size_t title_len, |
221 const char* url_data, | 221 const char* url_data, |
222 size_t url_len); | 222 size_t url_len); |
223 | 223 |
224 void WriteWebSmartPaste(); | 224 void WriteWebSmartPaste(); |
225 | 225 |
226 void WriteBitmap(const char* pixel_data, const char* size_data); | 226 void WriteBitmap(const char* pixel_data, const char* size_data); |
227 | 227 |
228 #if !defined(OS_MACOSX) | |
229 // |format_name| is an ASCII string and should be NULL-terminated. | 228 // |format_name| is an ASCII string and should be NULL-terminated. |
230 // TODO(estade): port to mac. | 229 // TODO(estade): port to mac. |
tony
2011/12/05 18:56:09
Nit: Get rid of the TODO.
dcheng
2011/12/05 19:53:03
Done.
| |
231 void WriteData(const char* format_name, size_t format_len, | 230 void WriteData(const char* format_name, size_t format_len, |
232 const char* data_data, size_t data_len); | 231 const char* data_data, size_t data_len); |
233 #endif | |
234 #if defined(OS_WIN) | 232 #if defined(OS_WIN) |
235 void WriteBitmapFromHandle(HBITMAP source_hbitmap, | 233 void WriteBitmapFromHandle(HBITMAP source_hbitmap, |
236 const gfx::Size& size); | 234 const gfx::Size& size); |
237 | 235 |
238 // Safely write to system clipboard. Free |handle| on failure. | 236 // Safely write to system clipboard. Free |handle| on failure. |
239 void WriteToClipboard(unsigned int format, HANDLE handle); | 237 void WriteToClipboard(unsigned int format, HANDLE handle); |
240 | 238 |
241 static void ParseBookmarkClipboardFormat(const string16& bookmark, | 239 static void ParseBookmarkClipboardFormat(const string16& bookmark, |
242 string16* title, | 240 string16* title, |
243 std::string* url); | 241 std::string* url); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
284 static const char kMimeTypeText[]; | 282 static const char kMimeTypeText[]; |
285 static const char kMimeTypeHTML[]; | 283 static const char kMimeTypeHTML[]; |
286 static const char kMimeTypePNG[]; | 284 static const char kMimeTypePNG[]; |
287 | 285 |
288 DISALLOW_COPY_AND_ASSIGN(Clipboard); | 286 DISALLOW_COPY_AND_ASSIGN(Clipboard); |
289 }; | 287 }; |
290 | 288 |
291 } // namespace ui | 289 } // namespace ui |
292 | 290 |
293 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_H_ | 291 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_H_ |
OLD | NEW |