summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webclipboard_impl.cc
diff options
context:
space:
mode:
authordcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-07 22:43:41 +0000
committerdcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-07 22:43:41 +0000
commit97c2c0304fcda75890b4490ca5e6d569db30ca6d (patch)
tree083da18448d0479ffd8ec09ba530475309bb1fac /webkit/glue/webclipboard_impl.cc
parent156c84585048ca444173b55097392e43c199a56c (diff)
downloadchromium_src-97c2c0304fcda75890b4490ca5e6d569db30ca6d.zip
chromium_src-97c2c0304fcda75890b4490ca5e6d569db30ca6d.tar.gz
chromium_src-97c2c0304fcda75890b4490ca5e6d569db30ca6d.tar.bz2
Implement new Chromium IPCs for copying/dragging.
A new ClipboardDispatcher interface has been added to handle the IPC calls. The new methods don't really belong on the existing Clipboard class, since that class deals with only copy and paste. On Windows and Mac, ClipboardDispatcher will share logic for copy/paste and drag/drop. GTK will have to use two separate code paths. BUG=31037 TEST=none Review URL: http://codereview.chromium.org/2842016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51790 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webclipboard_impl.cc')
-rw-r--r--webkit/glue/webclipboard_impl.cc39
1 files changed, 39 insertions, 0 deletions
diff --git a/webkit/glue/webclipboard_impl.cc b/webkit/glue/webclipboard_impl.cc
index 2c955e6..11bc96d 100644
--- a/webkit/glue/webclipboard_impl.cc
+++ b/webkit/glue/webclipboard_impl.cc
@@ -15,6 +15,7 @@
#include "third_party/WebKit/WebKit/chromium/public/WebSize.h"
#include "third_party/WebKit/WebKit/chromium/public/WebString.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURL.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebVector.h"
#include "webkit/glue/scoped_clipboard_writer_glue.h"
#include "webkit/glue/webkit_glue.h"
@@ -26,6 +27,7 @@ using WebKit::WebClipboard;
using WebKit::WebImage;
using WebKit::WebString;
using WebKit::WebURL;
+using WebKit::WebVector;
namespace webkit_glue {
@@ -171,12 +173,49 @@ void WebClipboardImpl::writeData(const WebKit::WebDragData& data) {
// TODO(dcheng): Implement this stub.
}
+WebVector<WebString> WebClipboardImpl::readAvailableTypes(
+ Buffer buffer, bool* contains_filenames) {
+ Clipboard::Buffer buffer_type;
+ std::vector<string16> types;
+ if (ConvertBufferType(buffer, &buffer_type)) {
+ ClipboardReadAvailableTypes(buffer_type, &types, contains_filenames);
+ }
+ return types;
+}
+
+bool WebClipboardImpl::readData(Buffer buffer, const WebString& type,
+ WebString* data, WebString* metadata) {
+ Clipboard::Buffer buffer_type;
+ if (!ConvertBufferType(buffer, &buffer_type))
+ return false;
+
+ string16 data_out;
+ string16 metadata_out;
+ bool result = ClipboardReadData(buffer_type, type, &data_out, &metadata_out);
+ if (result) {
+ *data = data_out;
+ *metadata = metadata_out;
+ }
+ return result;
+}
+
+WebVector<WebString> WebClipboardImpl::readFilenames(Buffer buffer) {
+ Clipboard::Buffer buffer_type;
+ std::vector<string16> filenames;
+ if (ConvertBufferType(buffer, &buffer_type)) {
+ ClipboardReadFilenames(buffer_type, &filenames);
+ }
+ return filenames;
+}
+
bool WebClipboardImpl::ConvertBufferType(Buffer buffer,
Clipboard::Buffer* result) {
switch (buffer) {
case BufferStandard:
*result = Clipboard::BUFFER_STANDARD;
break;
+ case BufferDrag:
+ *result = Clipboard::BUFFER_DRAG;
case BufferSelection:
#if defined(USE_X11)
*result = Clipboard::BUFFER_SELECTION;