Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Unified Diff: webkit/glue/webclipboard_impl.cc

Issue 174367: Change the ChromiumPasteboard to have a notion of an alternate clipboard... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/webclipboard_impl.h ('k') | webkit/glue/webkit_glue.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webclipboard_impl.cc
===================================================================
--- webkit/glue/webclipboard_impl.cc (revision 25640)
+++ webkit/glue/webclipboard_impl.cc (working copy)
@@ -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
« no previous file with comments | « webkit/glue/webclipboard_impl.h ('k') | webkit/glue/webkit_glue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698