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

Unified Diff: content/browser/browser_plugin/browser_plugin_guest.cc

Issue 1723763002: Add WebDragData to blink::WebView::dragtargetDrop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 4 years, 6 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/browser/browser_plugin/browser_plugin_guest.cc
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc
index cb9b9c811a284ab7253ec39971b09144a9a16f65..826c6442845022055b368dd99e67d3134b74277e 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -42,6 +42,7 @@
#include "content/public/browser/browser_plugin_guest_manager.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/guest_host.h"
+#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_contents_observer.h"
@@ -102,6 +103,7 @@ BrowserPluginGuest::BrowserPluginGuest(bool has_render_view,
last_drag_status_(blink::WebDragStatusUnknown),
seen_embedder_system_drag_ended_(false),
seen_embedder_drag_source_ended_at_(false),
+ ignore_dragged_url_(false),
delegate_(delegate),
weak_ptr_factory_(this) {
DCHECK(web_contents);
@@ -533,7 +535,7 @@ void BrowserPluginGuest::EndSystemDragIfApplicable() {
last_drag_status_ = blink::WebDragStatusUnknown;
seen_embedder_system_drag_ended_ = false;
seen_embedder_drag_source_ended_at_ = false;
- dragged_url_ = GURL();
+ ignore_dragged_url_ = false;
}
}
@@ -802,14 +804,16 @@ void BrowserPluginGuest::OnDragStatusUpdate(int browser_plugin_instance_id,
const gfx::Point& location) {
RenderViewHost* host = GetWebContents()->GetRenderViewHost();
auto embedder = owner_web_contents_->GetBrowserPluginEmbedder();
+ DropData filtered_data(drop_data);
+ host->FilterDropData(&filtered_data);
switch (drag_status) {
case blink::WebDragStatusEnter:
+ host->DragTargetDragEnter(filtered_data, location, location, mask,
+ drop_data.key_modifiers);
// Only track the URL being dragged over the guest if the link isn't
// coming from the guest.
if (!embedder->DragEnteredGuest(this))
- dragged_url_ = drop_data.url;
- host->DragTargetDragEnter(drop_data, location, location, mask,
- drop_data.key_modifiers);
+ ignore_dragged_url_ = true;
break;
case blink::WebDragStatusOver:
host->DragTargetDragOver(location, location, mask,
@@ -818,15 +822,18 @@ void BrowserPluginGuest::OnDragStatusUpdate(int browser_plugin_instance_id,
case blink::WebDragStatusLeave:
embedder->DragLeftGuest(this);
host->DragTargetDragLeave();
+ ignore_dragged_url_ = false;
break;
case blink::WebDragStatusDrop:
- host->DragTargetDrop(location, location, drop_data.key_modifiers);
- if (dragged_url_.is_valid()) {
- delegate_->DidDropLink(dragged_url_);
- dragged_url_ = GURL();
- }
+ host->DragTargetDrop(filtered_data, location, location,
+ drop_data.key_modifiers);
+
+ if (ignore_dragged_url_ && filtered_data.url.is_valid())
+ delegate_->DidDropLink(filtered_data.url);
+ ignore_dragged_url_ = false;
break;
case blink::WebDragStatusUnknown:
+ ignore_dragged_url_ = false;
NOTREACHED();
}
last_drag_status_ = drag_status;
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.h ('k') | content/browser/renderer_host/render_view_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698