summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-04 01:25:09 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-04 01:25:09 +0000
commit7a6d773fabdb6e8743f08fb2c7f7cbc039fe7024 (patch)
treebcb9cbfedff34ab25253fc25cde309340015e42e /content
parent91c8a64f50024620d2f87c2f1502b10a81d61eae (diff)
downloadchromium_src-7a6d773fabdb6e8743f08fb2c7f7cbc039fe7024.zip
chromium_src-7a6d773fabdb6e8743f08fb2c7f7cbc039fe7024.tar.gz
chromium_src-7a6d773fabdb6e8743f08fb2c7f7cbc039fe7024.tar.bz2
drag-n-drop: Get rid of a now-noop drag callback DragSourceMovedTo
We call into WebContentsImpl::DragSourceMovedTo() from platform-specific code, which calls back into RenderViewHost::DragSourceMovedTo(), which sends an IPC message DragMsg_SourceEndedOrMoved with 'ended' set to false. The renderer receives this message in RenderViewImpl::OnDragSourceEndedOrMoved(), which calls into blink::WebView::dragSourceMovedTo(), which doesn't do anything. So simplify this a bit: * Remove DragSourceMovedTo() from WebContentsImpl, RenderViewHost, and related classes. * Rename DragMsg_SourceEndedOrMoved to DragMsg_SourceEnded, and remove the 'ended' field. * Remove the call to blink::WebView::dragSourceMovedTo(). A subsequent blink patch will remove it from the WebView interface. BUG=354062 R=dcheng@chromium.org, jam@chromium.org, sky@chromium.org Review URL: https://codereview.chromium.org/223953003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261623 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/browser_plugin/browser_plugin_embedder.cc10
-rw-r--r--content/browser/browser_plugin/browser_plugin_embedder.h3
-rw-r--r--content/browser/browser_plugin/browser_plugin_guest.cc6
-rw-r--r--content/browser/browser_plugin/browser_plugin_guest.h3
-rw-r--r--content/browser/renderer_host/render_view_host_impl.cc18
-rw-r--r--content/browser/renderer_host/render_view_host_impl.h2
-rw-r--r--content/browser/web_contents/web_contents_impl.cc10
-rw-r--r--content/browser/web_contents/web_contents_impl.h5
-rw-r--r--content/browser/web_contents/web_contents_view_aura.cc36
-rw-r--r--content/browser/web_contents/web_contents_view_mac.mm1
-rw-r--r--content/browser/web_contents/web_drag_source_gtk.cc23
-rw-r--r--content/browser/web_contents/web_drag_source_gtk.h8
-rw-r--r--content/browser/web_contents/web_drag_source_mac.h3
-rw-r--r--content/browser/web_contents/web_drag_source_mac.mm21
-rw-r--r--content/common/drag_messages.h6
-rw-r--r--content/public/browser/render_view_host.h5
-rw-r--r--content/renderer/render_view_impl.cc15
-rw-r--r--content/renderer/render_view_impl.h7
18 files changed, 17 insertions, 165 deletions
diff --git a/content/browser/browser_plugin/browser_plugin_embedder.cc b/content/browser/browser_plugin/browser_plugin_embedder.cc
index 0c3d914..cb4fcf2 100644
--- a/content/browser/browser_plugin/browser_plugin_embedder.cc
+++ b/content/browser/browser_plugin/browser_plugin_embedder.cc
@@ -137,16 +137,6 @@ void BrowserPluginEmbedder::DragSourceEndedAt(int client_x, int client_y,
}
}
-void BrowserPluginEmbedder::DragSourceMovedTo(int client_x, int client_y,
- int screen_x, int screen_y) {
- if (guest_started_drag_.get()) {
- gfx::Point guest_offset =
- guest_started_drag_->GetScreenCoordinates(gfx::Point());
- guest_started_drag_->DragSourceMovedTo(client_x - guest_offset.x(),
- client_y - guest_offset.y(), screen_x, screen_y);
- }
-}
-
void BrowserPluginEmbedder::SystemDragEnded() {
// When the embedder's drag/drop operation ends, we need to pass the message
// to the guest that initiated the drag/drop operation. This will ensure that
diff --git a/content/browser/browser_plugin/browser_plugin_embedder.h b/content/browser/browser_plugin/browser_plugin_embedder.h
index ebd4f87..e153a4d 100644
--- a/content/browser/browser_plugin/browser_plugin_embedder.h
+++ b/content/browser/browser_plugin/browser_plugin_embedder.h
@@ -71,9 +71,6 @@ class CONTENT_EXPORT BrowserPluginEmbedder : public WebContentsObserver {
void DragSourceEndedAt(int client_x, int client_y, int screen_x,
int screen_y, blink::WebDragOperation operation);
- void DragSourceMovedTo(int client_x, int client_y,
- int screen_x, int screen_y);
-
void OnUpdateDragCursor(bool* handled);
void DragEnteredGuest(BrowserPluginGuest* guest);
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc
index 61e93bd..e291b27 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -1043,12 +1043,6 @@ void BrowserPluginGuest::DragSourceEndedAt(int client_x, int client_y,
screen_x, screen_y, operation);
}
-void BrowserPluginGuest::DragSourceMovedTo(int client_x, int client_y,
- int screen_x, int screen_y) {
- web_contents()->GetRenderViewHost()->DragSourceMovedTo(client_x, client_y,
- screen_x, screen_y);
-}
-
void BrowserPluginGuest::EndSystemDrag() {
RenderViewHostImpl* guest_rvh = static_cast<RenderViewHostImpl*>(
GetWebContents()->GetRenderViewHost());
diff --git a/content/browser/browser_plugin/browser_plugin_guest.h b/content/browser/browser_plugin/browser_plugin_guest.h
index 2637329..ff9a74d 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.h
+++ b/content/browser/browser_plugin/browser_plugin_guest.h
@@ -311,9 +311,6 @@ class CONTENT_EXPORT BrowserPluginGuest
void DragSourceEndedAt(int client_x, int client_y, int screen_x,
int screen_y, blink::WebDragOperation operation);
- void DragSourceMovedTo(int client_x, int client_y,
- int screen_x, int screen_y);
-
// Called when the drag started by this guest ends at an OS-level.
void EndSystemDrag();
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index c6fc3bf..dcc61ce 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -886,20 +886,10 @@ void RenderViewHostImpl::JavaScriptDialogClosed(
void RenderViewHostImpl::DragSourceEndedAt(
int client_x, int client_y, int screen_x, int screen_y,
WebDragOperation operation) {
- Send(new DragMsg_SourceEndedOrMoved(
- GetRoutingID(),
- gfx::Point(client_x, client_y),
- gfx::Point(screen_x, screen_y),
- true, operation));
-}
-
-void RenderViewHostImpl::DragSourceMovedTo(
- int client_x, int client_y, int screen_x, int screen_y) {
- Send(new DragMsg_SourceEndedOrMoved(
- GetRoutingID(),
- gfx::Point(client_x, client_y),
- gfx::Point(screen_x, screen_y),
- false, WebDragOperationNone));
+ Send(new DragMsg_SourceEnded(GetRoutingID(),
+ gfx::Point(client_x, client_y),
+ gfx::Point(screen_x, screen_y),
+ operation));
}
void RenderViewHostImpl::DragSourceSystemDragEnded() {
diff --git a/content/browser/renderer_host/render_view_host_impl.h b/content/browser/renderer_host/render_view_host_impl.h
index ea52a8d..d810b74 100644
--- a/content/browser/renderer_host/render_view_host_impl.h
+++ b/content/browser/renderer_host/render_view_host_impl.h
@@ -175,8 +175,6 @@ class CONTENT_EXPORT RenderViewHostImpl
virtual void DragSourceEndedAt(
int client_x, int client_y, int screen_x, int screen_y,
blink::WebDragOperation operation) OVERRIDE;
- virtual void DragSourceMovedTo(
- int client_x, int client_y, int screen_x, int screen_y) OVERRIDE;
virtual void DragSourceSystemDragEnded() OVERRIDE;
virtual void DragTargetDragEnter(
const DropData& drop_data,
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 7178d8c7..a19fcd9 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1934,16 +1934,6 @@ void WebContentsImpl::DragSourceEndedAt(int client_x, int client_y,
screen_x, screen_y, operation);
}
-void WebContentsImpl::DragSourceMovedTo(int client_x, int client_y,
- int screen_x, int screen_y) {
- if (browser_plugin_embedder_.get())
- browser_plugin_embedder_->DragSourceMovedTo(client_x, client_y,
- screen_x, screen_y);
- if (GetRenderViewHost())
- GetRenderViewHostImpl()->DragSourceMovedTo(client_x, client_y,
- screen_x, screen_y);
-}
-
void WebContentsImpl::DidGetResourceResponseStart(
const ResourceRequestDetails& details) {
controller_.ssl_manager()->DidStartResourceResponse(details);
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index 23b7465..18e9cea 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -166,11 +166,6 @@ class CONTENT_EXPORT WebContentsImpl
void DragSourceEndedAt(int client_x, int client_y, int screen_x,
int screen_y, blink::WebDragOperation operation);
- // Informs the render view host and the BrowserPluginEmbedder, if present, of
- // a Drag Source Move.
- void DragSourceMovedTo(int client_x, int client_y,
- int screen_x, int screen_y);
-
// A response has been received for a resource request.
void DidGetResourceResponseStart(
const ResourceRequestDetails& details);
diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc
index 06a531d..b23bc5d 100644
--- a/content/browser/web_contents/web_contents_view_aura.cc
+++ b/content/browser/web_contents/web_contents_view_aura.cc
@@ -174,52 +174,20 @@ class OverscrollWindowDelegate : public ImageWindowDelegate {
// Listens to all mouse drag events during a drag and drop and sends them to
// the renderer.
-class WebDragSourceAura : public base::MessageLoopForUI::Observer,
- public NotificationObserver {
+class WebDragSourceAura : public NotificationObserver {
public:
WebDragSourceAura(aura::Window* window, WebContentsImpl* contents)
: window_(window),
contents_(contents) {
- base::MessageLoopForUI::current()->AddObserver(this);
registrar_.Add(this,
NOTIFICATION_WEB_CONTENTS_DISCONNECTED,
Source<WebContents>(contents));
}
virtual ~WebDragSourceAura() {
- base::MessageLoopForUI::current()->RemoveObserver(this);
- }
-
- // MessageLoop::Observer implementation:
- virtual base::EventStatus WillProcessEvent(
- const base::NativeEvent& event) OVERRIDE {
- return base::EVENT_CONTINUE;
- }
- virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE {
- if (!contents_)
- return;
- ui::EventType type = ui::EventTypeFromNative(event);
- RenderViewHost* rvh = NULL;
- switch (type) {
- case ui::ET_MOUSE_DRAGGED:
- rvh = contents_->GetRenderViewHost();
- if (rvh) {
- gfx::Point screen_loc_in_pixel = ui::EventLocationFromNative(event);
- gfx::Point screen_loc = ConvertViewPointToDIP(rvh->GetView(),
- screen_loc_in_pixel);
- gfx::Point client_loc = screen_loc;
- aura::Window* window = rvh->GetView()->GetNativeView();
- aura::Window::ConvertPointToTarget(window->GetRootWindow(),
- window, &client_loc);
- contents_->DragSourceMovedTo(client_loc.x(), client_loc.y(),
- screen_loc.x(), screen_loc.y());
- }
- break;
- default:
- break;
- }
}
+ // NotificationObserver:
virtual void Observe(int type,
const NotificationSource& source,
const NotificationDetails& details) OVERRIDE {
diff --git a/content/browser/web_contents/web_contents_view_mac.mm b/content/browser/web_contents/web_contents_view_mac.mm
index 5da7917..1bb3ffb 100644
--- a/content/browser/web_contents/web_contents_view_mac.mm
+++ b/content/browser/web_contents/web_contents_view_mac.mm
@@ -565,7 +565,6 @@ void WebContentsViewMac::CloseTab() {
// Called when a drag initiated in our view moves.
- (void)draggedImage:(NSImage*)draggedImage movedTo:(NSPoint)screenPoint {
- [dragSource_ moveDragTo:screenPoint];
}
// Called when a file drag is dropped and the promised files need to be written.
diff --git a/content/browser/web_contents/web_drag_source_gtk.cc b/content/browser/web_contents/web_drag_source_gtk.cc
index fc7f6a3..8b80136 100644
--- a/content/browser/web_contents/web_drag_source_gtk.cc
+++ b/content/browser/web_contents/web_drag_source_gtk.cc
@@ -60,7 +60,6 @@ WebDragSourceGtk::~WebDragSourceGtk() {
if (drop_data_) {
gtk_grab_add(drag_widget_);
gtk_grab_remove(drag_widget_);
- base::MessageLoopForUI::current()->RemoveObserver(this);
drop_data_.reset();
}
@@ -147,29 +146,9 @@ bool WebDragSourceGtk::StartDragging(const DropData& drop_data,
return false;
}
- base::MessageLoopForUI::current()->AddObserver(this);
return true;
}
-void WebDragSourceGtk::WillProcessEvent(GdkEvent* event) {
- // No-op.
-}
-
-void WebDragSourceGtk::DidProcessEvent(GdkEvent* event) {
- if (event->type != GDK_MOTION_NOTIFY)
- return;
-
- GdkEventMotion* event_motion = reinterpret_cast<GdkEventMotion*>(event);
- gfx::Point client = ui::ClientPoint(GetContentNativeView());
-
- if (web_contents_) {
- web_contents_->DragSourceMovedTo(
- client.x(), client.y(),
- static_cast<int>(event_motion->x_root),
- static_cast<int>(event_motion->y_root));
- }
-}
-
void WebDragSourceGtk::OnDragDataGet(GtkWidget* sender,
GdkDragContext* context,
GtkSelectionData* selection_data,
@@ -367,8 +346,6 @@ void WebDragSourceGtk::OnDragEnd(GtkWidget* sender,
drag_pixbuf_ = NULL;
}
- base::MessageLoopForUI::current()->RemoveObserver(this);
-
if (!download_url_.is_empty()) {
gdk_property_delete(drag_context->source_window,
ui::GetAtomForTarget(ui::DIRECT_SAVE_FILE));
diff --git a/content/browser/web_contents/web_drag_source_gtk.h b/content/browser/web_contents/web_drag_source_gtk.h
index 8a7c7b2..94687c1 100644
--- a/content/browser/web_contents/web_drag_source_gtk.h
+++ b/content/browser/web_contents/web_drag_source_gtk.h
@@ -9,7 +9,6 @@
#include "base/basictypes.h"
#include "base/files/file_path.h"
-#include "base/message_loop/message_loop.h"
#include "base/strings/string16.h"
#include "content/common/content_export.h"
#include "content/public/browser/web_contents.h"
@@ -30,8 +29,7 @@ struct DropData;
// WebDragSourceGtk takes care of managing the drag from a WebContents
// with Gtk.
-class CONTENT_EXPORT WebDragSourceGtk :
- public base::MessageLoopForUI::Observer {
+class CONTENT_EXPORT WebDragSourceGtk {
public:
explicit WebDragSourceGtk(WebContents* web_contents);
virtual ~WebDragSourceGtk();
@@ -44,10 +42,6 @@ class CONTENT_EXPORT WebDragSourceGtk :
const SkBitmap& image,
const gfx::Vector2d& image_offset);
- // MessageLoop::Observer implementation:
- virtual void WillProcessEvent(GdkEvent* event) OVERRIDE;
- virtual void DidProcessEvent(GdkEvent* event) OVERRIDE;
-
private:
CHROMEGTK_CALLBACK_2(WebDragSourceGtk, gboolean, OnDragFailed,
GdkDragContext*, GtkDragResult);
diff --git a/content/browser/web_contents/web_drag_source_mac.h b/content/browser/web_contents/web_drag_source_mac.h
index f355728..f1ccc4d 100644
--- a/content/browser/web_contents/web_drag_source_mac.h
+++ b/content/browser/web_contents/web_drag_source_mac.h
@@ -83,9 +83,6 @@ CONTENT_EXPORT
- (void)endDragAt:(NSPoint)screenPoint
operation:(NSDragOperation)operation;
-// Drag moved; hook up to -draggedImage:movedTo:.
-- (void)moveDragTo:(NSPoint)screenPoint;
-
// Call to drag a promised file to the given path (should be called before
// -endDragAt:...); hook up to -namesOfPromisedFilesDroppedAtDestination:.
// Returns the file name (not including path) of the file deposited (or which
diff --git a/content/browser/web_contents/web_drag_source_mac.mm b/content/browser/web_contents/web_drag_source_mac.mm
index bfb0a08..463db3e 100644
--- a/content/browser/web_contents/web_drag_source_mac.mm
+++ b/content/browser/web_contents/web_drag_source_mac.mm
@@ -291,27 +291,6 @@ void PromiseWriterHelper(const DropData& drop_data,
[pasteboard_ declareTypes:[NSArray array] owner:nil];
}
-- (void)moveDragTo:(NSPoint)screenPoint {
- if (!contents_)
- return;
- RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
- contents_->GetRenderViewHost());
- if (rvh) {
- // Convert |screenPoint| to view coordinates and flip it.
- NSPoint localPoint = NSZeroPoint;
- if ([contentsView_ window])
- localPoint = [self convertScreenPoint:screenPoint];
- NSRect viewFrame = [contentsView_ frame];
- localPoint.y = viewFrame.size.height - localPoint.y;
- // Flip |screenPoint|.
- NSRect screenFrame = [[[contentsView_ window] screen] frame];
- screenPoint.y = screenFrame.size.height - screenPoint.y;
-
- contents_->DragSourceMovedTo(localPoint.x, localPoint.y,
- screenPoint.x, screenPoint.y);
- }
-}
-
- (NSString*)dragPromisedFileTo:(NSString*)path {
// Be extra paranoid; avoid crashing.
if (!dropData_) {
diff --git a/content/common/drag_messages.h b/content/common/drag_messages.h
index 1da3c72..6f378a8 100644
--- a/content/common/drag_messages.h
+++ b/content/common/drag_messages.h
@@ -38,12 +38,10 @@ IPC_MESSAGE_ROUTED3(DragMsg_TargetDrop,
gfx::Point /* screen_pt */,
int /* key_modifiers */)
-// Notifies the renderer of updates in mouse position of an in-progress
-// drag. if |ended| is true, then the user has ended the drag operation.
-IPC_MESSAGE_ROUTED4(DragMsg_SourceEndedOrMoved,
+// Notifies the renderer when and where the mouse-drag ended.
+IPC_MESSAGE_ROUTED3(DragMsg_SourceEnded,
gfx::Point /* client_pt */,
gfx::Point /* screen_pt */,
- bool /* ended */,
blink::WebDragOperation /* drag_operation */)
// Notifies the renderer that the system DoDragDrop call has ended.
diff --git a/content/public/browser/render_view_host.h b/content/public/browser/render_view_host.h
index 6979d17..09104c5 100644
--- a/content/public/browser/render_view_host.h
+++ b/content/public/browser/render_view_host.h
@@ -119,11 +119,6 @@ class CONTENT_EXPORT RenderViewHost : virtual public RenderWidgetHost {
int client_x, int client_y, int screen_x, int screen_y,
blink::WebDragOperation operation) = 0;
- // Notifies the renderer that a drag and drop operation is in progress, with
- // droppable items positioned over the renderer's view.
- virtual void DragSourceMovedTo(
- int client_x, int client_y, int screen_x, int screen_y) = 0;
-
// Notifies the renderer that we're done with the drag and drop operation.
// This allows the renderer to reset some state.
virtual void DragSourceSystemDragEnded() = 0;
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 02d2c0e..9830d69 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -1093,7 +1093,7 @@ bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver)
IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave)
IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop)
- IPC_MESSAGE_HANDLER(DragMsg_SourceEndedOrMoved, OnDragSourceEndedOrMoved)
+ IPC_MESSAGE_HANDLER(DragMsg_SourceEnded, OnDragSourceEnded)
IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded,
OnDragSourceSystemDragEnded)
IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings)
@@ -3406,15 +3406,10 @@ void RenderViewImpl::OnDragTargetDrop(const gfx::Point& client_point,
Send(new DragHostMsg_TargetDrop_ACK(routing_id_));
}
-void RenderViewImpl::OnDragSourceEndedOrMoved(const gfx::Point& client_point,
- const gfx::Point& screen_point,
- bool ended,
- WebDragOperation op) {
- if (ended) {
- webview()->dragSourceEndedAt(client_point, screen_point, op);
- } else {
- webview()->dragSourceMovedTo(client_point, screen_point, op);
- }
+void RenderViewImpl::OnDragSourceEnded(const gfx::Point& client_point,
+ const gfx::Point& screen_point,
+ WebDragOperation op) {
+ webview()->dragSourceEndedAt(client_point, screen_point, op);
}
void RenderViewImpl::OnDragSourceSystemDragEnded() {
diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h
index 0431a6d..a1aec93 100644
--- a/content/renderer/render_view_impl.h
+++ b/content/renderer/render_view_impl.h
@@ -862,10 +862,9 @@ class CONTENT_EXPORT RenderViewImpl
void OnDeterminePageLanguage();
void OnDisableScrollbarsForSmallWindows(
const gfx::Size& disable_scrollbars_size_limit);
- void OnDragSourceEndedOrMoved(const gfx::Point& client_point,
- const gfx::Point& screen_point,
- bool ended,
- blink::WebDragOperation drag_operation);
+ void OnDragSourceEnded(const gfx::Point& client_point,
+ const gfx::Point& screen_point,
+ blink::WebDragOperation drag_operation);
void OnDragSourceSystemDragEnded();
void OnDragTargetDrop(const gfx::Point& client_pt,
const gfx::Point& screen_pt,