summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webclipboard_impl.cc
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 /webkit/glue/webclipboard_impl.cc
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 'webkit/glue/webclipboard_impl.cc')
-rw-r--r--webkit/glue/webclipboard_impl.cc50
1 files changed, 41 insertions, 9 deletions
diff --git a/webkit/glue/webclipboard_impl.cc b/webkit/glue/webclipboard_impl.cc
index e2be557..4798eff 100644
--- a/webkit/glue/webclipboard_impl.cc
+++ b/webkit/glue/webclipboard_impl.cc
@@ -55,8 +55,9 @@ std::string WebClipboardImpl::URLToImageMarkup(const WebURL& url,
return markup;
}
-bool WebClipboardImpl::isFormatAvailable(Format format) {
+bool WebClipboardImpl::isFormatAvailable(Format format, Buffer buffer) {
Clipboard::FormatType format_type;
+ Clipboard::Buffer buffer_type;
switch (format) {
case FormatHTML:
@@ -75,20 +76,29 @@ bool WebClipboardImpl::isFormatAvailable(Format format) {
return false;
}
- return ClipboardIsFormatAvailable(format_type);
+ if (!ConvertBufferType(buffer, &buffer_type))
+ return false;
+
+ return ClipboardIsFormatAvailable(format_type, buffer_type);
}
-WebString WebClipboardImpl::readPlainText() {
- if (ClipboardIsFormatAvailable(Clipboard::GetPlainTextWFormatType())) {
+WebString WebClipboardImpl::readPlainText(Buffer buffer) {
+ Clipboard::Buffer buffer_type;
+ if (!ConvertBufferType(buffer, &buffer_type))
+ return WebString();
+
+ if (ClipboardIsFormatAvailable(Clipboard::GetPlainTextWFormatType(),
+ buffer_type)) {
string16 text;
- ClipboardReadText(&text);
+ ClipboardReadText(buffer_type, &text);
if (!text.empty())
return text;
}
- if (ClipboardIsFormatAvailable(Clipboard::GetPlainTextFormatType())) {
+ if (ClipboardIsFormatAvailable(Clipboard::GetPlainTextFormatType(),
+ buffer_type)) {
std::string text;
- ClipboardReadAsciiText(&text);
+ ClipboardReadAsciiText(buffer_type, &text);
if (!text.empty())
return ASCIIToUTF16(text);
}
@@ -96,10 +106,14 @@ WebString WebClipboardImpl::readPlainText() {
return WebString();
}
-WebString WebClipboardImpl::readHTML(WebURL* source_url) {
+WebString WebClipboardImpl::readHTML(Buffer buffer, WebURL* source_url) {
+ Clipboard::Buffer buffer_type;
+ if (!ConvertBufferType(buffer, &buffer_type))
+ return WebString();
+
string16 html_stdstr;
GURL gurl;
- ClipboardReadHTML(&html_stdstr, &gurl);
+ ClipboardReadHTML(buffer_type, &html_stdstr, &gurl);
*source_url = gurl;
return html_stdstr;
}
@@ -144,4 +158,22 @@ void WebClipboardImpl::writeImage(
}
}
+bool WebClipboardImpl::ConvertBufferType(Buffer buffer,
+ Clipboard::Buffer* result) {
+ switch (buffer) {
+ case BufferStandard:
+ *result = Clipboard::BUFFER_STANDARD;
+ break;
+ case BufferSelection:
+#if defined(OS_LINUX)
+ *result = Clipboard::BUFFER_SELECTION;
+ break;
+#endif
+ default:
+ NOTREACHED();
+ return false;
+ }
+ return true;
+}
+
} // namespace webkit_glue