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
3 // found in the LICENSE file.
5 #ifndef WEBKIT_GLUE_CLIPBOARD_CLIENT_H_
6 #define WEBKIT_GLUE_CLIPBOARD_CLIENT_H_
8 #include "ui/base/clipboard/clipboard.h"
12 namespace webkit_glue
{
14 // Interface for the webkit glue embedder to implement to support clipboard.
15 class ClipboardClient
{
19 virtual ~WriteContext() { }
21 // Writes bitmap data into the context, updating the ObjectMap.
22 virtual void WriteBitmapFromPixels(ui::Clipboard::ObjectMap
* objects
,
24 const gfx::Size
& size
) = 0;
26 // Flushes all gathered data.
27 virtual void Flush(const ui::Clipboard::ObjectMap
& objects
) = 0;
30 virtual ~ClipboardClient() { }
32 // Get a clipboard that can be used to construct a ScopedClipboardWriterGlue.
33 virtual ui::Clipboard
* GetClipboard() = 0;
35 // Get a sequence number which uniquely identifies clipboard state.
36 virtual uint64
GetSequenceNumber(ui::Clipboard::Buffer buffer
) = 0;
38 // Tests whether the clipboard contains a certain format
39 virtual bool IsFormatAvailable(const ui::Clipboard::FormatType
& format
,
40 ui::Clipboard::Buffer buffer
) = 0;
42 // Clear the contents of the clipboard.
43 virtual void Clear(ui::Clipboard::Buffer buffer
) = 0;
45 // Reads the available types from the clipboard, if available.
46 virtual void ReadAvailableTypes(ui::Clipboard::Buffer buffer
,
47 std::vector
<string16
>* types
,
48 bool* contains_filenames
) = 0;
50 // Reads UNICODE text from the clipboard, if available.
51 virtual void ReadText(ui::Clipboard::Buffer buffer
, string16
* result
) = 0;
53 // Reads ASCII text from the clipboard, if available.
54 virtual void ReadAsciiText(ui::Clipboard::Buffer buffer
,
55 std::string
* result
) = 0;
57 // Reads HTML from the clipboard, if available.
58 virtual void ReadHTML(ui::Clipboard::Buffer buffer
, string16
* markup
,
59 GURL
* url
, uint32
* fragment_start
,
60 uint32
* fragment_end
) = 0;
62 // Reads RTF from the clipboard, if available.
63 virtual void ReadRTF(ui::Clipboard::Buffer buffer
, std::string
* result
) = 0;
65 // Reads and image from the clipboard, if available.
66 virtual void ReadImage(ui::Clipboard::Buffer buffer
, std::string
* data
) = 0;
68 // Reads a custom data type from the clipboard, if available.
69 virtual void ReadCustomData(ui::Clipboard::Buffer buffer
,
73 // Creates a context to write clipboard data. May return NULL.
74 virtual WriteContext
* CreateWriteContext() = 0;
77 } // namespace webkit_glue
79 #endif // WEBKIT_GLUE_CLIPBOARD_CLIENT_H_