Chromium Code Reviews| 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. |