| 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) const; | 175 void ReadData(const std::string& format, std::string* result); |
| 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) |
| 228 // |format_name| is an ASCII string and should be NULL-terminated. | 229 // |format_name| is an ASCII string and should be NULL-terminated. |
| 229 // TODO(estade): port to mac. | 230 // TODO(estade): port to mac. |
| 230 void WriteData(const char* format_name, size_t format_len, | 231 void WriteData(const char* format_name, size_t format_len, |
| 231 const char* data_data, size_t data_len); | 232 const char* data_data, size_t data_len); |
| 233 #endif |
| 232 #if defined(OS_WIN) | 234 #if defined(OS_WIN) |
| 233 void WriteBitmapFromHandle(HBITMAP source_hbitmap, | 235 void WriteBitmapFromHandle(HBITMAP source_hbitmap, |
| 234 const gfx::Size& size); | 236 const gfx::Size& size); |
| 235 | 237 |
| 236 // Safely write to system clipboard. Free |handle| on failure. | 238 // Safely write to system clipboard. Free |handle| on failure. |
| 237 void WriteToClipboard(unsigned int format, HANDLE handle); | 239 void WriteToClipboard(unsigned int format, HANDLE handle); |
| 238 | 240 |
| 239 static void ParseBookmarkClipboardFormat(const string16& bookmark, | 241 static void ParseBookmarkClipboardFormat(const string16& bookmark, |
| 240 string16* title, | 242 string16* title, |
| 241 std::string* url); | 243 std::string* url); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 static const char kMimeTypeText[]; | 284 static const char kMimeTypeText[]; |
| 283 static const char kMimeTypeHTML[]; | 285 static const char kMimeTypeHTML[]; |
| 284 static const char kMimeTypePNG[]; | 286 static const char kMimeTypePNG[]; |
| 285 | 287 |
| 286 DISALLOW_COPY_AND_ASSIGN(Clipboard); | 288 DISALLOW_COPY_AND_ASSIGN(Clipboard); |
| 287 }; | 289 }; |
| 288 | 290 |
| 289 } // namespace ui | 291 } // namespace ui |
| 290 | 292 |
| 291 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_H_ | 293 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_H_ |
| OLD | NEW |