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: [email protected]), 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
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 @@
   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 @@
       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 @@
   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 @@
   }
 }
 
+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