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 9bd0df203d2d3eb192f6d516d5d3ddb9446c70ab..f222e2fd70743191622625fb1c63d09afc641439 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); |
@@ -530,7 +532,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; |
} |
} |
@@ -799,14 +801,17 @@ 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); |
+ if (!embedder->DragEnteredGuest(this)) { |
lfg
2016/06/06 18:00:40
nit: no need for {}
|
+ ignore_dragged_url_ = true; |
+ } |
break; |
case blink::WebDragStatusOver: |
host->DragTargetDragOver(location, location, mask, |
@@ -815,15 +820,19 @@ 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; |