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

Unified Diff: chrome/browser/cocoa/web_drop_target.mm

Issue 174364: Plumb the DragOperation through all the layers between the platform DnD code ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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
« no previous file with comments | « chrome/browser/cocoa/web_drop_target.h ('k') | chrome/browser/extensions/extension_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/web_drop_target.mm
===================================================================
--- chrome/browser/cocoa/web_drop_target.mm (revision 25321)
+++ chrome/browser/cocoa/web_drop_target.mm (working copy)
@@ -11,6 +11,8 @@
#include "webkit/glue/webdropdata.h"
#include "webkit/glue/window_open_disposition.h"
+using WebKit::WebDragOperationsMask;
+
@implementation WebDropTarget
// |contents| is the TabContents representing this tab, used to communicate
@@ -25,8 +27,8 @@
// Call to set whether or not we should allow the drop. Takes effect the
// next time |-draggingUpdated:| is called.
-- (void)setIsDropTarget:(BOOL)isDropTarget {
- isDropTarget_ = isDropTarget;
+- (void)setCurrentOperation: (NSDragOperation)operation {
+ current_operation_ = operation;
}
// Given a point in window coordinates and a view in that window, return a
@@ -85,13 +87,16 @@
NSPoint windowPoint = [info draggingLocation];
NSPoint viewPoint = [self flipWindowPointToView:windowPoint view:view];
NSPoint screenPoint = [self flipWindowPointToScreen:windowPoint view:view];
+ NSDragOperation mask = [info draggingSourceOperationMask];
tabContents_->render_view_host()->DragTargetDragEnter(data,
gfx::Point(viewPoint.x, viewPoint.y),
- gfx::Point(screenPoint.x, screenPoint.y));
+ gfx::Point(screenPoint.x, screenPoint.y),
+ static_cast<WebDragOperationsMask>(mask));
- isDropTarget_ = YES;
-
- return NSDragOperationCopy;
+ // We won't know the true operation (whether the drag is allowed) until we
+ // hear back from the renderer. For now, be optimistic:
+ current_operation_ = NSDragOperationCopy;
+ return current_operation_;
}
- (void)draggingExited:(id<NSDraggingInfo>)info {
@@ -121,13 +126,13 @@
NSPoint windowPoint = [info draggingLocation];
NSPoint viewPoint = [self flipWindowPointToView:windowPoint view:view];
NSPoint screenPoint = [self flipWindowPointToScreen:windowPoint view:view];
+ NSDragOperation mask = [info draggingSourceOperationMask];
tabContents_->render_view_host()->DragTargetDragOver(
gfx::Point(viewPoint.x, viewPoint.y),
- gfx::Point(screenPoint.x, screenPoint.y));
+ gfx::Point(screenPoint.x, screenPoint.y),
+ static_cast<WebDragOperationsMask>(mask));
- if (!isDropTarget_)
- return NSDragOperationNone;
- return NSDragOperationCopy;
+ return current_operation_;
}
- (BOOL)performDragOperation:(id<NSDraggingInfo>)info
« no previous file with comments | « chrome/browser/cocoa/web_drop_target.h ('k') | chrome/browser/extensions/extension_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698