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

Unified Diff: webkit/glue/webdropdata.cc

Issue 8775025: Add glue for supporting custom MIME types in DataTransfer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 1 month 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
Index: webkit/glue/webdropdata.cc
diff --git a/webkit/glue/webdropdata.cc b/webkit/glue/webdropdata.cc
index 0a06ac31be90f2a2c5bd9461f0dba5843531e328..bdfa77a79554fd9f404bc5ecd2fd69307e0321b6 100644
--- a/webkit/glue/webdropdata.cc
+++ b/webkit/glue/webdropdata.cc
@@ -4,6 +4,8 @@
#include "webkit/glue/webdropdata.h"
+#include <utility>
+
#include "third_party/WebKit/Source/WebKit/chromium/public/WebData.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDragData.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
@@ -33,6 +35,11 @@ WebDropData::WebDropData(const WebDragData& drag_data)
WebData contents = drag_data.fileContent();
if (!contents.isEmpty())
file_contents.assign(contents.data(), contents.size());
+ WebVector<WebDragData::CustomData> custom_data_copy = drag_data.customData();
+ for (size_t i = 0; i < custom_data_copy.size(); ++i) {
+ custom_data.insert(std::make_pair(custom_data_copy[i].m_type,
+ custom_data_copy[i].m_data));
+ }
}
WebDropData::WebDropData() {
@@ -53,5 +60,13 @@ WebDragData WebDropData::ToDragData() const {
result.setHTMLBaseURL(html_base_url);
result.setFileContentFilename(file_description_filename);
result.setFileContent(WebData(file_contents.data(), file_contents.size()));
+ WebVector<WebDragData::CustomData> custom_data_vector(custom_data.size());
+ size_t i = 0;
+ for (std::map<string16, string16>::const_iterator it = custom_data.begin();
+ it != custom_data.end();
+ ++it, ++i) {
+ WebDragData::CustomData data = {it->first, it->second};
+ custom_data_vector[i] = data;
+ }
return result;
}

Powered by Google App Engine
This is Rietveld 408576698