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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/browser_plugin/browser_plugin_guest.h" 5 #include "content/browser/browser_plugin/browser_plugin_guest.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/pickle.h" 10 #include "base/pickle.h"
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 // {WebDragStatusOver, WebDragStatusDrop}. However, if a user drags 438 // {WebDragStatusOver, WebDragStatusDrop}. However, if a user drags
439 // a source quickly outside of <webview> bounds, then the 439 // a source quickly outside of <webview> bounds, then the
440 // BrowserPluginGuest never sees any of these drag status updates, 440 // BrowserPluginGuest never sees any of these drag status updates,
441 // there we just check whether we've seen any drag status update or 441 // there we just check whether we've seen any drag status update or
442 // not. 442 // not.
443 if (last_drag_status_ != blink::WebDragStatusOver && 443 if (last_drag_status_ != blink::WebDragStatusOver &&
444 seen_embedder_drag_source_ended_at_ && seen_embedder_system_drag_ended_) { 444 seen_embedder_drag_source_ended_at_ && seen_embedder_system_drag_ended_) {
445 RenderViewHostImpl* guest_rvh = static_cast<RenderViewHostImpl*>( 445 RenderViewHostImpl* guest_rvh = static_cast<RenderViewHostImpl*>(
446 GetWebContents()->GetRenderViewHost()); 446 GetWebContents()->GetRenderViewHost());
447 guest_rvh->DragSourceSystemDragEnded(); 447 guest_rvh->DragSourceSystemDragEnded();
448
449 last_drag_status_ = blink::WebDragStatusUnknown; 448 last_drag_status_ = blink::WebDragStatusUnknown;
450 seen_embedder_system_drag_ended_ = false; 449 seen_embedder_system_drag_ended_ = false;
451 seen_embedder_drag_source_ended_at_ = false; 450 seen_embedder_drag_source_ended_at_ = false;
451 dragged_url_ = GURL();
452 } 452 }
453 } 453 }
454 454
455 void BrowserPluginGuest::EmbedderSystemDragEnded() { 455 void BrowserPluginGuest::EmbedderSystemDragEnded() {
456 seen_embedder_system_drag_ended_ = true; 456 seen_embedder_system_drag_ended_ = true;
457 EndSystemDragIfApplicable(); 457 EndSystemDragIfApplicable();
458 } 458 }
459 459
460 void BrowserPluginGuest::SendQueuedMessages() { 460 void BrowserPluginGuest::SendQueuedMessages() {
461 if (!attached()) 461 if (!attached())
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 667
668 delegate_->DidDetach(); 668 delegate_->DidDetach();
669 } 669 }
670 670
671 void BrowserPluginGuest::OnDragStatusUpdate(int browser_plugin_instance_id, 671 void BrowserPluginGuest::OnDragStatusUpdate(int browser_plugin_instance_id,
672 blink::WebDragStatus drag_status, 672 blink::WebDragStatus drag_status,
673 const DropData& drop_data, 673 const DropData& drop_data,
674 blink::WebDragOperationsMask mask, 674 blink::WebDragOperationsMask mask,
675 const gfx::Point& location) { 675 const gfx::Point& location) {
676 RenderViewHost* host = GetWebContents()->GetRenderViewHost(); 676 RenderViewHost* host = GetWebContents()->GetRenderViewHost();
677 auto embedder = owner_web_contents_->GetBrowserPluginEmbedder();
677 switch (drag_status) { 678 switch (drag_status) {
678 case blink::WebDragStatusEnter: 679 case blink::WebDragStatusEnter:
679 owner_web_contents_->GetBrowserPluginEmbedder()->DragEnteredGuest( 680 // Only track the URL being dragged over the guest if the link isn't
680 this); 681 // coming from the guest.
682 if (!embedder->DragEnteredGuest(this))
683 dragged_url_ = drop_data.url;
lazyboy 2015/02/23 17:11:10 Just double checking, if the drop data doesn't hav
Fady Samuel 2015/02/23 19:57:07 Yup, the GURL is not valid, and spec() is empty st
681 host->DragTargetDragEnter(drop_data, location, location, mask, 0); 684 host->DragTargetDragEnter(drop_data, location, location, mask, 0);
682 break; 685 break;
683 case blink::WebDragStatusOver: 686 case blink::WebDragStatusOver:
684 host->DragTargetDragOver(location, location, mask, 0); 687 host->DragTargetDragOver(location, location, mask, 0);
685 break; 688 break;
686 case blink::WebDragStatusLeave: 689 case blink::WebDragStatusLeave:
687 owner_web_contents_->GetBrowserPluginEmbedder()->DragLeftGuest(this); 690 owner_web_contents_->GetBrowserPluginEmbedder()->DragLeftGuest(this);
lazyboy 2015/02/23 17:11:10 Also, change this to use |embedder|
Fady Samuel 2015/02/23 19:57:07 Done.
688 host->DragTargetDragLeave(); 691 host->DragTargetDragLeave();
689 break; 692 break;
690 case blink::WebDragStatusDrop: 693 case blink::WebDragStatusDrop:
691 host->DragTargetDrop(location, location, 0); 694 host->DragTargetDrop(location, location, 0);
695 if (dragged_url_.is_valid()) {
696 delegate_->DidDropLink(dragged_url_);
697 dragged_url_ = GURL();
698 }
692 break; 699 break;
693 case blink::WebDragStatusUnknown: 700 case blink::WebDragStatusUnknown:
694 NOTREACHED(); 701 NOTREACHED();
695 } 702 }
696 last_drag_status_ = drag_status; 703 last_drag_status_ = drag_status;
697 EndSystemDragIfApplicable(); 704 EndSystemDragIfApplicable();
698 } 705 }
699 706
700 void BrowserPluginGuest::OnExecuteEditCommand(int browser_plugin_instance_id, 707 void BrowserPluginGuest::OnExecuteEditCommand(int browser_plugin_instance_id,
701 const std::string& name) { 708 const std::string& name) {
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 void BrowserPluginGuest::OnImeCompositionRangeChanged( 911 void BrowserPluginGuest::OnImeCompositionRangeChanged(
905 const gfx::Range& range, 912 const gfx::Range& range,
906 const std::vector<gfx::Rect>& character_bounds) { 913 const std::vector<gfx::Rect>& character_bounds) {
907 static_cast<RenderWidgetHostViewBase*>( 914 static_cast<RenderWidgetHostViewBase*>(
908 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged( 915 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged(
909 range, character_bounds); 916 range, character_bounds);
910 } 917 }
911 #endif 918 #endif
912 919
913 } // namespace content 920 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698