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

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

Issue 12086095: Fixed drag and drop into and out of Browser Plugin. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: addressed comments Created 7 years, 11 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_embedder.cc
diff --git a/content/browser/browser_plugin/browser_plugin_embedder.cc b/content/browser/browser_plugin/browser_plugin_embedder.cc
index 4ffaa3d7b383bdb45bb84d562e2a17ae8b070f4e..5f2cc7820f33c910d16a13319f84b6d3b4b9edb0 100644
--- a/content/browser/browser_plugin/browser_plugin_embedder.cc
+++ b/content/browser/browser_plugin/browser_plugin_embedder.cc
@@ -11,6 +11,7 @@
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/browser_plugin_messages.h"
+#include "content/common/drag_messages.h"
#include "content/common/gpu/gpu_messages.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_service.h"
@@ -195,6 +196,29 @@ BrowserPluginGuest* BrowserPluginEmbedder::GetGuestByInstanceID(
return NULL;
}
+BrowserPluginGuest* BrowserPluginEmbedder::GetDraggingGuest() const {
+ ContainerInstanceMap::const_iterator it =
+ guest_web_contents_by_instance_id_.begin();
+ for (; it != guest_web_contents_by_instance_id_.end(); ++it) {
+ if (static_cast<WebContentsImpl*>(
+ it->second)->GetBrowserPluginGuest()->dragging())
Fady Samuel 2013/02/01 15:54:55 If we're effectively only allowing one guest to be
mthiesse1 2013/02/01 16:02:58 We need a way to identify which guest is the one t
mthiesse 2013/02/01 16:53:44 Done.
+ return static_cast<WebContentsImpl*>(
+ it->second)->GetBrowserPluginGuest();
+ }
+ return NULL;
+}
+
+bool BrowserPluginEmbedder::IsDragOverGuest() const {
+ ContainerInstanceMap::const_iterator it =
+ guest_web_contents_by_instance_id_.begin();
+ for (; it != guest_web_contents_by_instance_id_.end(); ++it) {
+ if (static_cast<WebContentsImpl*>(
+ it->second)->GetBrowserPluginGuest()->drag_over())
+ return true;
+ }
+ return false;
+}
+
void BrowserPluginEmbedder::DestroyGuestByInstanceID(int instance_id) {
BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id);
if (guest) {
@@ -228,6 +252,18 @@ void BrowserPluginEmbedder::RenderViewGone(base::TerminationStatus status) {
}
bool BrowserPluginEmbedder::OnMessageReceived(const IPC::Message& message) {
+ if (message.type() == DragHostMsg_DragStopped::ID) {
+ BrowserPluginGuest* guest = GetDraggingGuest();
+ if (guest)
+ return guest->OnMessageReceived(message);
+ }
+ if (message.type() == DragHostMsg_UpdateDragCursor::ID){
+ // If the guest is being dragged over we want to mark this as handled so
+ // that we don't update the cursor twice, once by the guest, and once by the
+ // embedder (and have the cursor flicker between droppable and
+ // non-droppable).
+ return IsDragOverGuest();
+ }
if (ShouldForwardToBrowserPluginGuest(message)) {
int instance_id = 0;
// All allowed messages must have instance_id as their first parameter.
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_embedder.h ('k') | content/browser/browser_plugin/browser_plugin_guest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698