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

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, 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_embedder.cc
diff --git a/content/browser/browser_plugin/browser_plugin_embedder.cc b/content/browser/browser_plugin/browser_plugin_embedder.cc
index 4ffaa3d7b383bdb45bb84d562e2a17ae8b070f4e..618e61f8d888bb35e497d47ea50b52a4b7da8517 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) {
+ guest_dragging_over_ = guest->AsWeakPtr();
+}
+
+void BrowserPluginEmbedder::DragLeftGuest(BrowserPluginGuest* guest) {
+ // 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_.get() == guest) {
+ guest_dragging_over_.reset();
+ }
+}
+
+void BrowserPluginEmbedder::StartDrag(BrowserPluginGuest* guest) {
+ guest_started_drag_ = guest->AsWeakPtr();
+}
+
void BrowserPluginEmbedder::DestroyGuestByInstanceID(int instance_id) {
BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id);
if (guest) {
@@ -250,11 +267,25 @@ bool BrowserPluginEmbedder::OnMessageReceived(const IPC::Message& message) {
OnPluginDestroyed)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_BuffersSwappedACK,
OnSwapBuffersACK)
+ IPC_MESSAGE_HANDLER_GENERIC(DragHostMsg_UpdateDragCursor,
+ OnUpdateDragCursor(&handled));
+ IPC_MESSAGE_HANDLER_GENERIC(DragHostMsg_DragStopped,
+ OnDragStopped(message, &handled));
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
+void BrowserPluginEmbedder::OnDragStopped(const IPC::Message& message,
+ bool* handled) {
+ if (guest_started_drag_.get())
+ *handled = guest_started_drag_->OnMessageReceived(message);
+}
+
+void BrowserPluginEmbedder::OnUpdateDragCursor(bool* handled) {
+ *handled = guest_dragging_over_.get();
+}
+
void BrowserPluginEmbedder::Observe(int type,
const NotificationSource& source,
const NotificationDetails& details) {

Powered by Google App Engine
This is Rietveld 408576698