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

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

Issue 945333002: Implement <webview> droplink event (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cleanup_bpe
Patch Set: Addressed Istiaque's comments Created 5 years, 10 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 0950ee8417e53b43d20c191c89ed6af2afcd5163..36df52fed73c27adee3179d89adeb467c6c7c2ff 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -445,10 +445,10 @@ void BrowserPluginGuest::EndSystemDragIfApplicable() {
RenderViewHostImpl* guest_rvh = static_cast<RenderViewHostImpl*>(
GetWebContents()->GetRenderViewHost());
guest_rvh->DragSourceSystemDragEnded();
-
last_drag_status_ = blink::WebDragStatusUnknown;
seen_embedder_system_drag_ended_ = false;
seen_embedder_drag_source_ended_at_ = false;
+ dragged_url_ = GURL();
}
}
@@ -674,21 +674,28 @@ void BrowserPluginGuest::OnDragStatusUpdate(int browser_plugin_instance_id,
blink::WebDragOperationsMask mask,
const gfx::Point& location) {
RenderViewHost* host = GetWebContents()->GetRenderViewHost();
+ auto embedder = owner_web_contents_->GetBrowserPluginEmbedder();
switch (drag_status) {
case blink::WebDragStatusEnter:
- owner_web_contents_->GetBrowserPluginEmbedder()->DragEnteredGuest(
- this);
+ // 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, 0);
break;
case blink::WebDragStatusOver:
host->DragTargetDragOver(location, location, mask, 0);
break;
case blink::WebDragStatusLeave:
- owner_web_contents_->GetBrowserPluginEmbedder()->DragLeftGuest(this);
+ embedder->DragLeftGuest(this);
host->DragTargetDragLeave();
break;
case blink::WebDragStatusDrop:
host->DragTargetDrop(location, location, 0);
+ if (dragged_url_.is_valid()) {
+ delegate_->DidDropLink(dragged_url_);
+ dragged_url_ = GURL();
+ }
break;
case blink::WebDragStatusUnknown:
NOTREACHED();
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.h ('k') | content/public/browser/browser_plugin_guest_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698