OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CONTENT_RENDERER_CLIPBOARD_CLIENT_H_ | 5 #ifndef CONTENT_RENDERER_CLIPBOARD_CLIENT_H_ |
6 #define CONTENT_RENDERER_CLIPBOARD_CLIENT_H_ | 6 #define CONTENT_RENDERER_CLIPBOARD_CLIENT_H_ |
7 | 7 |
| 8 #include "content/common/clipboard_format.h" |
8 #include "ui/base/clipboard/clipboard.h" | 9 #include "ui/base/clipboard/clipboard.h" |
9 | 10 |
10 class GURL; | 11 class GURL; |
11 | 12 |
12 namespace content { | 13 namespace content { |
13 | 14 |
14 // Interface for the content embedder to implement to support clipboard. | 15 // Interface for the content embedder to implement to support clipboard. |
15 class ClipboardClient { | 16 class ClipboardClient { |
16 public: | 17 public: |
17 class WriteContext { | 18 class WriteContext { |
(...skipping 11 matching lines...) Expand all Loading... |
29 | 30 |
30 virtual ~ClipboardClient() { } | 31 virtual ~ClipboardClient() { } |
31 | 32 |
32 // Get a clipboard that can be used to construct a ScopedClipboardWriterGlue. | 33 // Get a clipboard that can be used to construct a ScopedClipboardWriterGlue. |
33 virtual ui::Clipboard* GetClipboard() = 0; | 34 virtual ui::Clipboard* GetClipboard() = 0; |
34 | 35 |
35 // Get a sequence number which uniquely identifies clipboard state. | 36 // Get a sequence number which uniquely identifies clipboard state. |
36 virtual uint64 GetSequenceNumber(ui::ClipboardType type) = 0; | 37 virtual uint64 GetSequenceNumber(ui::ClipboardType type) = 0; |
37 | 38 |
38 // Tests whether the clipboard contains a certain format | 39 // Tests whether the clipboard contains a certain format |
39 virtual bool IsFormatAvailable(const ui::Clipboard::FormatType& format, | 40 virtual bool IsFormatAvailable(ClipboardFormat format, |
40 ui::ClipboardType type) = 0; | 41 ui::ClipboardType type) = 0; |
41 | 42 |
42 // Clear the contents of the clipboard. | 43 // Clear the contents of the clipboard. |
43 virtual void Clear(ui::ClipboardType type) = 0; | 44 virtual void Clear(ui::ClipboardType type) = 0; |
44 | 45 |
45 // Reads the available types from the clipboard, if available. | 46 // Reads the available types from the clipboard, if available. |
46 virtual void ReadAvailableTypes(ui::ClipboardType type, | 47 virtual void ReadAvailableTypes(ui::ClipboardType type, |
47 std::vector<base::string16>* types, | 48 std::vector<base::string16>* types, |
48 bool* contains_filenames) = 0; | 49 bool* contains_filenames) = 0; |
49 | 50 |
50 // Reads UNICODE text from the clipboard, if available. | 51 // Reads text from the clipboard, trying UNICODE first, then falling back to |
| 52 // ASCII. |
51 virtual void ReadText(ui::ClipboardType type, | 53 virtual void ReadText(ui::ClipboardType type, |
52 base::string16* result) = 0; | 54 base::string16* result) = 0; |
53 | 55 |
54 // Reads ASCII text from the clipboard, if available. | |
55 virtual void ReadAsciiText(ui::ClipboardType type, | |
56 std::string* result) = 0; | |
57 | |
58 // Reads HTML from the clipboard, if available. | 56 // Reads HTML from the clipboard, if available. |
59 virtual void ReadHTML(ui::ClipboardType type, | 57 virtual void ReadHTML(ui::ClipboardType type, |
60 base::string16* markup, | 58 base::string16* markup, |
61 GURL* url, | 59 GURL* url, |
62 uint32* fragment_start, | 60 uint32* fragment_start, |
63 uint32* fragment_end) = 0; | 61 uint32* fragment_end) = 0; |
64 | 62 |
65 // Reads RTF from the clipboard, if available. | 63 // Reads RTF from the clipboard, if available. |
66 virtual void ReadRTF(ui::ClipboardType type, std::string* result) = 0; | 64 virtual void ReadRTF(ui::ClipboardType type, std::string* result) = 0; |
67 | 65 |
(...skipping 10 matching lines...) Expand all Loading... |
78 std::string* data) = 0; | 76 std::string* data) = 0; |
79 | 77 |
80 // Creates a context to write clipboard data. May return NULL. | 78 // Creates a context to write clipboard data. May return NULL. |
81 virtual WriteContext* CreateWriteContext() = 0; | 79 virtual WriteContext* CreateWriteContext() = 0; |
82 }; | 80 }; |
83 | 81 |
84 } // namespace content | 82 } // namespace content |
85 | 83 |
86 #endif // CONTENT_RENDERER_CLIPBOARD_CLIENT_H_ | 84 #endif // CONTENT_RENDERER_CLIPBOARD_CLIENT_H_ |
87 | 85 |
OLD | NEW |