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

Unified Diff: content/renderer/render_view_impl.cc

Issue 1723763002: Add WebDragData to blink::WebView::dragtargetDrop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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
Index: content/renderer/render_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index cc7ce3c5f9743b3b9b1d08e36807065a25889b7f..15fecf0a19a4f3279c7b5fa066b536492388bd5d 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -427,6 +427,39 @@ class WebWidgetLockTarget : public MouseLockDispatcher::LockTarget {
blink::WebWidget* webwidget_;
};
+WebDragData DropMetaDataToWebDragData(
+ const std::vector<MimeTypeKindPair> drop_meta_data) {
Avi (use Gerrit) 2016/04/12 02:51:51 const vector? Did you mean const vector&?
hush (inactive) 2016/04/12 20:36:57 Yes, done
+ std::vector<WebDragData::Item> item_list;
+ for (MimeTypeKindPair pair : drop_meta_data) {
+ if (pair.second == STRING_KIND) {
+ WebDragData::Item item;
+ item.storageType = WebDragData::Item::StorageTypeString;
+ item.stringType = pair.first;
+ item_list.push_back(item);
+ continue;
+ }
+
+ if (pair.second == FILENAME_KIND) {
+ WebDragData::Item item;
+ item.storageType = WebDragData::Item::StorageTypeFilename;
+ item_list.push_back(item);
+ continue;
+ }
+
+ if (pair.second == FILESYSTEMFILE_KIND) {
+ WebDragData::Item item;
+ item.storageType = WebDragData::Item::StorageTypeFileSystemFile;
+ item_list.push_back(item);
+ continue;
+ }
+ }
+
+ WebDragData result;
+ result.initialize();
+ result.setItems(item_list);
+ return result;
+}
+
WebDragData DropDataToWebDragData(const DropData& drop_data) {
std::vector<WebDragData::Item> item_list;
@@ -2317,17 +2350,15 @@ void RenderViewImpl::OnAllowBindings(int enabled_bindings_flags) {
main_render_frame_->MaybeEnableMojoBindings();
}
-void RenderViewImpl::OnDragTargetDragEnter(const DropData& drop_data,
- const gfx::Point& client_point,
- const gfx::Point& screen_point,
- WebDragOperationsMask ops,
- int key_modifiers) {
+void RenderViewImpl::OnDragTargetDragEnter(
+ const std::vector<MimeTypeKindPair> drop_meta_data,
Avi (use Gerrit) 2016/04/12 02:51:51 const vector&?
hush (inactive) 2016/04/12 20:36:57 Done.
+ const gfx::Point& client_point,
+ const gfx::Point& screen_point,
+ WebDragOperationsMask ops,
+ int key_modifiers) {
WebDragOperation operation = webview()->dragTargetDragEnter(
- DropDataToWebDragData(drop_data),
- ConvertWindowPointToViewport(client_point),
- screen_point,
- ops,
- key_modifiers);
+ DropMetaDataToWebDragData(drop_meta_data), client_point, screen_point,
+ ops, key_modifiers);
Send(new DragHostMsg_UpdateDragCursor(GetRoutingID(), operation));
}
@@ -2349,11 +2380,12 @@ void RenderViewImpl::OnDragTargetDragLeave() {
webview()->dragTargetDragLeave();
}
-void RenderViewImpl::OnDragTargetDrop(const gfx::Point& client_point,
+void RenderViewImpl::OnDragTargetDrop(const DropData& drop_data,
+ const gfx::Point& client_point,
const gfx::Point& screen_point,
int key_modifiers) {
- webview()->dragTargetDrop(
- ConvertWindowPointToViewport(client_point), screen_point, key_modifiers);
+ webview()->dragTargetDrop(DropDataToWebDragData(drop_data), client_point,
+ screen_point, key_modifiers);
}
void RenderViewImpl::OnDragSourceEnded(const gfx::Point& client_point,

Powered by Google App Engine
This is Rietveld 408576698