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

Unified Diff: chrome/browser/tab_contents/tab_contents_view_mac.mm

Issue 1539018: Mac: Make image dragging 162.4% more awesome. (Closed)
Patch Set: '' Created 10 years, 9 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_drag_source.mm ('k') | chrome/renderer/render_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/tab_contents_view_mac.mm
diff --git a/chrome/browser/tab_contents/tab_contents_view_mac.mm b/chrome/browser/tab_contents/tab_contents_view_mac.mm
index 393d70740dc69ede025d89170ab2f4d440af045e..731425f6afd4c5af833a2fa8afd11cc2d5eac07d 100644
--- a/chrome/browser/tab_contents/tab_contents_view_mac.mm
+++ b/chrome/browser/tab_contents/tab_contents_view_mac.mm
@@ -26,6 +26,7 @@
#include "chrome/common/notification_type.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/render_messages.h"
+#include "skia/ext/skia_utils_mac.h"
#import "third_party/mozilla/include/NSPasteboard+Utils.h"
using WebKit::WebDragOperation;
@@ -49,7 +50,9 @@ COMPILE_ASSERT_MATCHING_ENUM(DragOperationEvery);
- (void)registerDragTypes;
- (void)setCurrentDragOperation:(NSDragOperation)operation;
- (void)startDragWithDropData:(const WebDropData&)dropData
- dragOperationMask:(NSDragOperation)operationMask;
+ dragOperationMask:(NSDragOperation)operationMask
+ image:(NSImage*)image
+ offset:(NSPoint)offset;
- (void)cancelDeferredClose;
- (void)closeTabAfterEvent;
@end
@@ -141,10 +144,12 @@ void TabContentsViewMac::StartDragging(
// The drag invokes a nested event loop, arrange to continue
// processing events.
MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current());
- // TODO(estade): make use of |image| and |image_offset|.
NSDragOperation mask = static_cast<NSDragOperation>(allowed_operations);
+ NSPoint offset = NSPointFromCGPoint(image_offset.ToCGPoint());
[cocoa_view_ startDragWithDropData:drop_data
- dragOperationMask:mask];
+ dragOperationMask:mask
+ image:gfx::SkBitmapToNSImage(image)
+ offset:offset];
}
void TabContentsViewMac::RenderViewCreated(RenderViewHost* host) {
@@ -376,10 +381,14 @@ void TabContentsViewMac::Observe(NotificationType type,
}
- (void)startDragWithDropData:(const WebDropData&)dropData
- dragOperationMask:(NSDragOperation)operationMask {
+ dragOperationMask:(NSDragOperation)operationMask
+ image:(NSImage*)image
+ offset:(NSPoint)offset {
dragSource_.reset([[WebDragSource alloc]
initWithContentsView:self
dropData:&dropData
+ image:image
+ offset:offset
pasteboard:[NSPasteboard pasteboardWithName:NSDragPboard]
dragOperationMask:operationMask]);
[dragSource_ startDrag];
« no previous file with comments | « chrome/browser/cocoa/web_drag_source.mm ('k') | chrome/renderer/render_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698