Chromium Code Reviews| 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..ad3cbde47fc010180d4df65a6bb8bea762284fb8 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,18 @@ 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)) { |
| + ignore_dragged_url_ = true; |
| + } |
| + |
| break; |
| case blink::WebDragStatusOver: |
| host->DragTargetDragOver(location, location, mask, |
| @@ -817,11 +823,15 @@ void BrowserPluginGuest::OnDragStatusUpdate(int browser_plugin_instance_id, |
| host->DragTargetDragLeave(); |
| 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; |
|
lazyboy
2016/06/04 04:52:38
Should setting this to false be outside of/after t
hush (inactive)
2016/06/06 17:42:24
yeah, that's right. Done
|
| } |
| + |
| break; |
| case blink::WebDragStatusUnknown: |
| NOTREACHED(); |