OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WEBKIT_GLUE_CLIPBOARD_CLIENT_H_ |
| 6 #define WEBKIT_GLUE_CLIPBOARD_CLIENT_H_ |
| 7 |
| 8 #include "ui/base/clipboard/clipboard.h" |
| 9 |
| 10 class GURL; |
| 11 |
| 12 namespace webkit_glue { |
| 13 |
| 14 // Interface for the webkit glue embedder to implement to support clipboard. |
| 15 class ClipboardClient { |
| 16 public: |
| 17 class WriteContext { |
| 18 public: |
| 19 virtual ~WriteContext() { } |
| 20 |
| 21 // Writes bitmap data into the context, updating the ObjectMap. |
| 22 virtual void WriteBitmapFromPixels(ui::Clipboard::ObjectMap* objects, |
| 23 const void* pixels, |
| 24 const gfx::Size& size) = 0; |
| 25 |
| 26 // Flushes all gathered data, and destroys the context. |
| 27 virtual void FlushAndDestroy(const ui::Clipboard::ObjectMap& objects) = 0; |
| 28 }; |
| 29 |
| 30 virtual ~ClipboardClient() { } |
| 31 |
| 32 // Get a clipboard that can be used to construct a ScopedClipboardWriterGlue. |
| 33 virtual ui::Clipboard* GetClipboard() = 0; |
| 34 |
| 35 // Get a sequence number which uniquely identifies clipboard state. |
| 36 virtual uint64 GetSequenceNumber(ui::Clipboard::Buffer buffer) = 0; |
| 37 |
| 38 // Tests whether the clipboard contains a certain format |
| 39 virtual bool IsFormatAvailable(const ui::Clipboard::FormatType& format, |
| 40 ui::Clipboard::Buffer buffer) = 0; |
| 41 |
| 42 // Reads the available types from the clipboard, if available. |
| 43 virtual void ReadAvailableTypes(ui::Clipboard::Buffer buffer, |
| 44 std::vector<string16>* types, |
| 45 bool* contains_filenames) = 0; |
| 46 |
| 47 // Reads UNICODE text from the clipboard, if available. |
| 48 virtual void ReadText(ui::Clipboard::Buffer buffer, string16* result) = 0; |
| 49 |
| 50 // Reads ASCII text from the clipboard, if available. |
| 51 virtual void ReadAsciiText(ui::Clipboard::Buffer buffer, |
| 52 std::string* result) = 0; |
| 53 |
| 54 // Reads HTML from the clipboard, if available. |
| 55 virtual void ReadHTML(ui::Clipboard::Buffer buffer, string16* markup, |
| 56 GURL* url, uint32* fragment_start, |
| 57 uint32* fragment_end) = 0; |
| 58 |
| 59 // Reads and image from the clipboard, if available. |
| 60 virtual void ReadImage(ui::Clipboard::Buffer buffer, std::string* data) = 0; |
| 61 |
| 62 // Creates a context to write clipboard data. May return NULL. |
| 63 virtual WriteContext* CreateWriteContext() = 0; |
| 64 }; |
| 65 |
| 66 } // namespace webkit_glue |
| 67 |
| 68 #endif // WEBKIT_GLUE_CLIPBOARD_CLIENT_H_ |
OLD | NEW |