diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-07 23:24:58 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-07 23:24:58 +0000 |
commit | e80c73be12cc2211d5a72a5ff85eb97366b2458f (patch) | |
tree | 5c395779776b368ed6cafdbc5c6bc929776c18a4 /webkit/glue/webdropdata.h | |
parent | 25a3f6b52228bc68ce63c4032ed6b17cecd7b3c5 (diff) | |
download | chromium_src-e80c73be12cc2211d5a72a5ff85eb97366b2458f.zip chromium_src-e80c73be12cc2211d5a72a5ff85eb97366b2458f.tar.gz chromium_src-e80c73be12cc2211d5a72a5ff85eb97366b2458f.tar.bz2 |
Switch to using WebDragData in WebView and WebViewDelegate.
I also cleaned up some of the WebView and WebViewDelegate methods to pass
WebPoint instead of pairs of ints or gfx::Point.
With this change, I am keeping webkit/glue/webdropdata.{h,cc}, which is what
Chrome uses to pass around the equivalent data. Now, it is possible to
construct a WebDropData from a WebKit::WebDragData and to also get a
WebKit::WebDragData from a WebDropData. Hence, the conversion between
WebDropData and ChromiumDataObject (see clipboard_conversion.{h,cc}) is now
removed in favor of conversion between WebDropData and WebKit::WebDragData.
Conversion between WebKit::WebDragData and WebCore::ChromiumDataObject is very
cheap (just reference counting).
Finally, this change also brings in WebData, which is now used by the return
value of WebKitClient::loadResource. As a companion to that change, I also
changed webkit_glue::GetDataResource to return StringPiece instead of
std::string. That also saves on an unnecessary buffer copy.
R=dglazkov
Review URL: http://codereview.chromium.org/63084
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13305 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webdropdata.h')
-rw-r--r-- | webkit/glue/webdropdata.h | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/webkit/glue/webdropdata.h b/webkit/glue/webdropdata.h index f74dcaf..fe8db6a 100644 --- a/webkit/glue/webdropdata.h +++ b/webkit/glue/webdropdata.h @@ -11,42 +11,55 @@ #include <string> #include <vector> + +#include "base/string16.h" #include "googleurl/src/gurl.h" struct IDataObject; +namespace WebKit { +class WebDragData; +} + struct WebDropData { // Construct with a given drag identity. Note: identity is an int32 because // it is passed over the renderer NPAPI interface to gears. explicit WebDropData(int32 drag_identity) : identity(drag_identity) {} - int32 identity; + + // Construct from a WebDragData object. + explicit WebDropData(const WebKit::WebDragData&); // For default constructions, use drag |identity| 0. WebDropData() : identity(0) {} + int32 identity; + // User is dragging a link into the webview. GURL url; - std::wstring url_title; // The title associated with |url|. + string16 url_title; // The title associated with |url|. // File extension for dragging images from a webview to the desktop. - std::wstring file_extension; + string16 file_extension; // User is dropping one or more files on the webview. - std::vector<std::wstring> filenames; + std::vector<string16> filenames; // User is dragging plain text into the webview. - std::wstring plain_text; + string16 plain_text; // User is dragging text/html into the webview (e.g., out of Firefox). // |html_base_url| is the URL that the html fragment is taken from (used to // resolve relative links). It's ok for |html_base_url| to be empty. - std::wstring text_html; + string16 text_html; GURL html_base_url; // User is dragging data from the webview (e.g., an image). - std::wstring file_description_filename; + string16 file_description_filename; std::string file_contents; + // Convert to a WebDragData object. + WebKit::WebDragData ToDragData() const; + // Helper method for converting Window's specific IDataObject to a WebDropData // object. TODO(tc): Move this to the browser side since it's Windows // specific and no longer used in webkit. |