| 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_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 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 // whether it has changed. | 223 // whether it has changed. |
| 224 uint64 GetSequenceNumber(ClipboardType type); | 224 uint64 GetSequenceNumber(ClipboardType type); |
| 225 | 225 |
| 226 // Tests whether the clipboard contains a certain format | 226 // Tests whether the clipboard contains a certain format |
| 227 bool IsFormatAvailable(const FormatType& format, ClipboardType type) const; | 227 bool IsFormatAvailable(const FormatType& format, ClipboardType type) const; |
| 228 | 228 |
| 229 // Clear the clipboard data. | 229 // Clear the clipboard data. |
| 230 void Clear(ClipboardType type); | 230 void Clear(ClipboardType type); |
| 231 | 231 |
| 232 void ReadAvailableTypes(ClipboardType type, | 232 void ReadAvailableTypes(ClipboardType type, |
| 233 std::vector<string16>* types, | 233 std::vector<base::string16>* types, |
| 234 bool* contains_filenames) const; | 234 bool* contains_filenames) const; |
| 235 | 235 |
| 236 // Reads UNICODE text from the clipboard, if available. | 236 // Reads UNICODE text from the clipboard, if available. |
| 237 void ReadText(ClipboardType type, string16* result) const; | 237 void ReadText(ClipboardType type, base::string16* result) const; |
| 238 | 238 |
| 239 // Reads ASCII text from the clipboard, if available. | 239 // Reads ASCII text from the clipboard, if available. |
| 240 void ReadAsciiText(ClipboardType type, std::string* result) const; | 240 void ReadAsciiText(ClipboardType type, std::string* result) const; |
| 241 | 241 |
| 242 // Reads HTML from the clipboard, if available. If the HTML fragment requires | 242 // Reads HTML from the clipboard, if available. If the HTML fragment requires |
| 243 // context to parse, |fragment_start| and |fragment_end| are indexes into | 243 // context to parse, |fragment_start| and |fragment_end| are indexes into |
| 244 // markup indicating the beginning and end of the actual fragment. Otherwise, | 244 // markup indicating the beginning and end of the actual fragment. Otherwise, |
| 245 // they will contain 0 and markup->size(). | 245 // they will contain 0 and markup->size(). |
| 246 void ReadHTML(ClipboardType type, | 246 void ReadHTML(ClipboardType type, |
| 247 string16* markup, | 247 base::string16* markup, |
| 248 std::string* src_url, | 248 std::string* src_url, |
| 249 uint32* fragment_start, | 249 uint32* fragment_start, |
| 250 uint32* fragment_end) const; | 250 uint32* fragment_end) const; |
| 251 | 251 |
| 252 // Reads RTF from the clipboard, if available. Stores the result as a byte | 252 // Reads RTF from the clipboard, if available. Stores the result as a byte |
| 253 // vector. | 253 // vector. |
| 254 void ReadRTF(ClipboardType type, std::string* result) const; | 254 void ReadRTF(ClipboardType type, std::string* result) const; |
| 255 | 255 |
| 256 // Reads an image from the clipboard, if available. | 256 // Reads an image from the clipboard, if available. |
| 257 SkBitmap ReadImage(ClipboardType type) const; | 257 SkBitmap ReadImage(ClipboardType type) const; |
| 258 | 258 |
| 259 void ReadCustomData(ClipboardType clipboard_type, | 259 void ReadCustomData(ClipboardType clipboard_type, |
| 260 const string16& type, | 260 const base::string16& type, |
| 261 string16* result) const; | 261 base::string16* result) const; |
| 262 | 262 |
| 263 // Reads a bookmark from the clipboard, if available. | 263 // Reads a bookmark from the clipboard, if available. |
| 264 void ReadBookmark(string16* title, std::string* url) const; | 264 void ReadBookmark(base::string16* title, std::string* url) const; |
| 265 | 265 |
| 266 // Reads raw data from the clipboard with the given format type. Stores result | 266 // Reads raw data from the clipboard with the given format type. Stores result |
| 267 // as a byte vector. | 267 // as a byte vector. |
| 268 void ReadData(const FormatType& format, std::string* result) const; | 268 void ReadData(const FormatType& format, std::string* result) const; |
| 269 | 269 |
| 270 // Gets the FormatType corresponding to an arbitrary format string, | 270 // Gets the FormatType corresponding to an arbitrary format string, |
| 271 // registering it with the system if needed. Due to Windows/Linux | 271 // registering it with the system if needed. Due to Windows/Linux |
| 272 // limitiations, |format_string| must never be controlled by the user. | 272 // limitiations, |format_string| must never be controlled by the user. |
| 273 static FormatType GetFormatType(const std::string& format_string); | 273 static FormatType GetFormatType(const std::string& format_string); |
| 274 | 274 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 void WriteData(const FormatType& format, | 339 void WriteData(const FormatType& format, |
| 340 const char* data_data, | 340 const char* data_data, |
| 341 size_t data_len); | 341 size_t data_len); |
| 342 #if defined(OS_WIN) | 342 #if defined(OS_WIN) |
| 343 void WriteBitmapFromHandle(HBITMAP source_hbitmap, | 343 void WriteBitmapFromHandle(HBITMAP source_hbitmap, |
| 344 const gfx::Size& size); | 344 const gfx::Size& size); |
| 345 | 345 |
| 346 // Safely write to system clipboard. Free |handle| on failure. | 346 // Safely write to system clipboard. Free |handle| on failure. |
| 347 void WriteToClipboard(unsigned int format, HANDLE handle); | 347 void WriteToClipboard(unsigned int format, HANDLE handle); |
| 348 | 348 |
| 349 static void ParseBookmarkClipboardFormat(const string16& bookmark, | 349 static void ParseBookmarkClipboardFormat(const base::string16& bookmark, |
| 350 string16* title, | 350 base::string16* title, |
| 351 std::string* url); | 351 std::string* url); |
| 352 | 352 |
| 353 // Free a handle depending on its type (as intuited from format) | 353 // Free a handle depending on its type (as intuited from format) |
| 354 static void FreeData(unsigned int format, HANDLE data); | 354 static void FreeData(unsigned int format, HANDLE data); |
| 355 | 355 |
| 356 // Return the window that should be the clipboard owner, creating it | 356 // Return the window that should be the clipboard owner, creating it |
| 357 // if neccessary. Marked const for lazily initialization by const methods. | 357 // if neccessary. Marked const for lazily initialization by const methods. |
| 358 HWND GetClipboardWindow() const; | 358 HWND GetClipboardWindow() const; |
| 359 | 359 |
| 360 // Mark this as mutable so const methods can still do lazy initialization. | 360 // Mark this as mutable so const methods can still do lazy initialization. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 391 class AuraX11Details; | 391 class AuraX11Details; |
| 392 scoped_ptr<AuraX11Details> aurax11_details_; | 392 scoped_ptr<AuraX11Details> aurax11_details_; |
| 393 #endif | 393 #endif |
| 394 | 394 |
| 395 DISALLOW_COPY_AND_ASSIGN(Clipboard); | 395 DISALLOW_COPY_AND_ASSIGN(Clipboard); |
| 396 }; | 396 }; |
| 397 | 397 |
| 398 } // namespace ui | 398 } // namespace ui |
| 399 | 399 |
| 400 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_H_ | 400 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_H_ |
| OLD | NEW |