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

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: Moved state to embedder. 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..6171f0c333cfe57f88f4481ff59f4d70c7fd0a51 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,22 @@ BrowserPluginGuest* BrowserPluginEmbedder::GetGuestByInstanceID(
return NULL;
}
+void BrowserPluginEmbedder::DragEnteredGuest(BrowserPluginGuest* guest) {
Fady Samuel 2013/02/01 16:59:53 SetDragEnteredGuest I'm a bit concerned about life
mthiesse 2013/02/07 15:28:55 Done.
+ guest_dragging_over = guest;
+}
+
+void BrowserPluginEmbedder::DragLeftGuest(BrowserPluginGuest* guest) {
Fady Samuel 2013/02/01 16:59:53 SetDragLeftGuest. I'm a bit concerned about lifeti
mthiesse 2013/02/07 15:28:55 Done.
+ // Avoid race conditions in switching between guests being hovered over by
+ // only un-setting if the caller is marked as the guest being dragged over.
+ if (guest_dragging_over == guest) {
+ guest_dragging_over = NULL;
+ }
+}
+
+void BrowserPluginEmbedder::StartDrag(BrowserPluginGuest* guest) {
+ guest_started_drag = guest;
+}
+
void BrowserPluginEmbedder::DestroyGuestByInstanceID(int instance_id) {
BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id);
if (guest) {
@@ -228,6 +245,17 @@ void BrowserPluginEmbedder::RenderViewGone(base::TerminationStatus status) {
}
bool BrowserPluginEmbedder::OnMessageReceived(const IPC::Message& message) {
+ if (message.type() == DragHostMsg_DragStopped::ID) {
+ if (guest_started_drag)
Fady Samuel 2013/02/01 16:59:53 Please move this and UpdateDragCursor to separate
mthiesse 2013/02/07 15:28:55 Done.
+ return guest_started_drag->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 (guest_dragging_over);
+ }
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