summaryrefslogtreecommitdiffstats
path: root/base/clipboard.h
diff options
context:
space:
mode:
authorjaphet@chromium.org <japhet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-08 22:16:05 +0000
committerjaphet@chromium.org <japhet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-08 22:16:05 +0000
commit65a6150d49263ff6e3135c5631f9ba5eb12823df (patch)
tree36f5b8624ae02cc69ae29ade9923404f6fec80b3 /base/clipboard.h
parent9f53c7d5f1ce83bb2025b1797300c6d60dd7d8ff (diff)
downloadchromium_src-65a6150d49263ff6e3135c5631f9ba5eb12823df.zip
chromium_src-65a6150d49263ff6e3135c5631f9ba5eb12823df.tar.gz
chromium_src-65a6150d49263ff6e3135c5631f9ba5eb12823df.tar.bz2
Roll webkit deps 48155:48185 and remove a couple of passing tests from test_expectations.txt.
Also, merge in http://codereview.chromium.org/174367 (original author: vandebo@chromium.org), which is the downstream half of r48168. BUG=4360 BUG=21228 BUG=18792 TEST=none TBR=eroman git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25669 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/clipboard.h')
-rw-r--r--base/clipboard.h43
1 files changed, 38 insertions, 5 deletions
diff --git a/base/clipboard.h b/base/clipboard.h
index bd4aefd..cea5033 100644
--- a/base/clipboard.h
+++ b/base/clipboard.h
@@ -74,6 +74,34 @@ class Clipboard {
typedef std::vector<ObjectMapParam> ObjectMapParams;
typedef std::map<int /* ObjectType */, ObjectMapParams> ObjectMap;
+ // Buffer designates which clipboard the action should be applied to.
+ // Only platforms that use the X Window System support the selection
+ // buffer. Furthermore we currently only use a buffer other than the
+ // standard buffer when reading from the clipboard so only those
+ // functions accept a buffer parameter.
+ enum Buffer {
+ BUFFER_STANDARD,
+#if defined(OS_LINUX)
+ BUFFER_SELECTION,
+#endif
+ };
+
+ static bool IsValidBuffer(int32 buffer) {
+ switch (buffer) {
+ case BUFFER_STANDARD:
+ return true;
+#if defined(OS_LINUX)
+ case BUFFER_SELECTION:
+ return true;
+#endif
+ }
+ return false;
+ }
+
+ static Buffer FromInt(int32 buffer) {
+ return static_cast<Buffer>(buffer);
+ }
+
Clipboard();
~Clipboard();
@@ -90,20 +118,21 @@ class Clipboard {
void WriteObjects(const ObjectMap& objects, base::ProcessHandle process);
// Tests whether the clipboard contains a certain format
- bool IsFormatAvailable(const FormatType& format) const;
+ bool IsFormatAvailable(const FormatType& format, Buffer buffer) const;
// As above, but instead of interpreting |format| by some platform-specific
// definition, interpret it as a literal MIME type.
- bool IsFormatAvailableByString(const std::string& format) const;
+ bool IsFormatAvailableByString(const std::string& format,
+ Buffer buffer) const;
// Reads UNICODE text from the clipboard, if available.
- void ReadText(string16* result) const;
+ void ReadText(Buffer buffer, string16* result) const;
// Reads ASCII text from the clipboard, if available.
- void ReadAsciiText(std::string* result) const;
+ void ReadAsciiText(Buffer buffer, std::string* result) const;
// Reads HTML from the clipboard, if available.
- void ReadHTML(string16* markup, std::string* src_url) const;
+ void ReadHTML(Buffer buffer, string16* markup, std::string* src_url) const;
// Reads a bookmark from the clipboard, if available.
void ReadBookmark(string16* title, std::string* url) const;
@@ -213,8 +242,12 @@ class Clipboard {
// Insert a mapping into clipboard_data_.
void InsertMapping(const char* key, char* data, size_t data_len);
+ // find the gtk clipboard for the passed buffer enum
+ GtkClipboard* LookupBackingClipboard(Buffer clipboard) const;
+
TargetMap* clipboard_data_;
GtkClipboard* clipboard_;
+ GtkClipboard* primary_selection_;
#endif
DISALLOW_COPY_AND_ASSIGN(Clipboard);