diff options
author | dcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-15 00:36:25 +0000 |
---|---|---|
committer | dcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-15 00:36:25 +0000 |
commit | 5acde3de258048feb1bc9f9be1f558508a035a06 (patch) | |
tree | c39e4ab3a9bf36a38d954df9f284f321d4ddee56 /webkit/glue | |
parent | 3f06bde64c34887bae7d3ed93ee92b999cc75769 (diff) | |
download | chromium_src-5acde3de258048feb1bc9f9be1f558508a035a06.zip chromium_src-5acde3de258048feb1bc9f9be1f558508a035a06.tar.gz chromium_src-5acde3de258048feb1bc9f9be1f558508a035a06.tar.bz2 |
Add stubs and glue for routing a request for an image from the clipboard.
BUG=75237
TEST=none
Review URL: http://codereview.chromium.org/6625075
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78134 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r-- | webkit/glue/webclipboard_impl.cc | 12 | ||||
-rw-r--r-- | webkit/glue/webclipboard_impl.h | 1 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.h | 2 |
3 files changed, 15 insertions, 0 deletions
diff --git a/webkit/glue/webclipboard_impl.cc b/webkit/glue/webclipboard_impl.cc index b917677..9eddb68 100644 --- a/webkit/glue/webclipboard_impl.cc +++ b/webkit/glue/webclipboard_impl.cc @@ -10,6 +10,7 @@ #include "googleurl/src/gurl.h" #include "net/base/escape.h" #include "third_party/skia/include/core/SkBitmap.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebData.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebImage.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" @@ -24,6 +25,7 @@ #endif using WebKit::WebClipboard; +using WebKit::WebData; using WebKit::WebImage; using WebKit::WebString; using WebKit::WebURL; @@ -124,6 +126,16 @@ WebString WebClipboardImpl::readHTML(Buffer buffer, WebURL* source_url) { return html_stdstr; } +WebData WebClipboardImpl::readImage(Buffer buffer) { + ui::Clipboard::Buffer buffer_type; + if (!ConvertBufferType(buffer, &buffer_type)) + return WebData(); + + std::string png_data; + ClipboardReadImage(buffer_type, &png_data); + return WebData(png_data); +} + void WebClipboardImpl::writeHTML( const WebString& html_text, const WebURL& source_url, const WebString& plain_text, bool write_smart_paste) { diff --git a/webkit/glue/webclipboard_impl.h b/webkit/glue/webclipboard_impl.h index ba3e747..c50f38d 100644 --- a/webkit/glue/webclipboard_impl.h +++ b/webkit/glue/webclipboard_impl.h @@ -25,6 +25,7 @@ class WebClipboardImpl : public WebKit::WebClipboard { virtual bool isFormatAvailable(Format, Buffer); virtual WebKit::WebString readPlainText(Buffer); virtual WebKit::WebString readHTML(Buffer, WebKit::WebURL* source_url); + virtual WebKit::WebData readImage(Buffer); virtual void writeHTML( const WebKit::WebString& html_text, const WebKit::WebURL& source_url, diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h index c1f45e6..68c3394 100644 --- a/webkit/glue/webkit_glue.h +++ b/webkit/glue/webkit_glue.h @@ -198,6 +198,8 @@ void ClipboardReadAsciiText(ui::Clipboard::Buffer buffer, std::string* result); void ClipboardReadHTML(ui::Clipboard::Buffer buffer, string16* markup, GURL* url); +void ClipboardReadImage(ui::Clipboard::Buffer buffer, std::string* data); + // Reads the available types from the clipboard, if available. bool ClipboardReadAvailableTypes(ui::Clipboard::Buffer buffer, std::vector<string16>* types, |