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

Side by Side Diff: chrome/browser/cocoa/web_drag_source.h

Issue 1539018: Mac: Make image dragging 162.4% more awesome. (Closed)
Patch Set: '' Created 10 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/cocoa/web_drag_source.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "app/download_file_interface.h" 7 #include "app/download_file_interface.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/scoped_nsobject.h" 9 #include "base/scoped_nsobject.h"
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
11 #include "googleurl/src/gurl.h" 11 #include "googleurl/src/gurl.h"
12 12
13 struct WebDropData; 13 struct WebDropData;
14 @class TabContentsViewCocoa; 14 @class TabContentsViewCocoa;
15 15
16 // A class that handles tracking and event processing for a drag and drop 16 // A class that handles tracking and event processing for a drag and drop
17 // originating from the content area. 17 // originating from the content area.
18 @interface WebDragSource : NSObject { 18 @interface WebDragSource : NSObject {
19 @private 19 @private
20 // Our tab. Weak reference (owns or co-owns us). 20 // Our tab. Weak reference (owns or co-owns us).
21 TabContentsViewCocoa* contentsView_; 21 TabContentsViewCocoa* contentsView_;
22 22
23 // Our drop data. Should only be initialized once. 23 // Our drop data. Should only be initialized once.
24 scoped_ptr<WebDropData> dropData_; 24 scoped_ptr<WebDropData> dropData_;
25 25
26 // The image to show as drag image. Can be nil.
27 scoped_nsobject<NSImage> dragImage_;
28
29 // The offset to draw |dragImage_| at.
30 NSPoint imageOffset_;
31
26 // Our pasteboard. 32 // Our pasteboard.
27 scoped_nsobject<NSPasteboard> pasteboard_; 33 scoped_nsobject<NSPasteboard> pasteboard_;
28 34
29 // A mask of the allowed drag operations. 35 // A mask of the allowed drag operations.
30 NSDragOperation dragOperationMask_; 36 NSDragOperation dragOperationMask_;
31 37
32 // The file name to be saved to for a drag-out download. 38 // The file name to be saved to for a drag-out download.
33 FilePath downloadFileName_; 39 FilePath downloadFileName_;
34 40
35 // The URL to download from for a drag-out download. 41 // The URL to download from for a drag-out download.
36 GURL downloadURL_; 42 GURL downloadURL_;
37 } 43 }
38 44
39 // Initialize a WebDragSource object for a drag (originating on the given 45 // Initialize a WebDragSource object for a drag (originating on the given
40 // contentsView and with the given dropData and pboard). Fill the pasteboard 46 // contentsView and with the given dropData and pboard). Fill the pasteboard
41 // with data types appropriate for dropData. 47 // with data types appropriate for dropData.
42 - (id)initWithContentsView:(TabContentsViewCocoa*)contentsView 48 - (id)initWithContentsView:(TabContentsViewCocoa*)contentsView
43 dropData:(const WebDropData*)dropData 49 dropData:(const WebDropData*)dropData
50 image:(NSImage*)image
51 offset:(NSPoint)offset
44 pasteboard:(NSPasteboard*)pboard 52 pasteboard:(NSPasteboard*)pboard
45 dragOperationMask:(NSDragOperation)dragOperationMask; 53 dragOperationMask:(NSDragOperation)dragOperationMask;
46 54
47 // Returns a mask of the allowed drag operations. 55 // Returns a mask of the allowed drag operations.
48 - (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal; 56 - (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal;
49 57
50 // Call when asked to do a lazy write to the pasteboard; hook up to 58 // Call when asked to do a lazy write to the pasteboard; hook up to
51 // -pasteboard:provideDataForType: (on the contentsView). 59 // -pasteboard:provideDataForType: (on the contentsView).
52 - (void)lazyWriteToPasteboard:(NSPasteboard*)pboard 60 - (void)lazyWriteToPasteboard:(NSPasteboard*)pboard
53 forType:(NSString*)type; 61 forType:(NSString*)type;
(...skipping 10 matching lines...) Expand all
64 // Drag moved; hook up to -draggedImage:movedTo:. 72 // Drag moved; hook up to -draggedImage:movedTo:.
65 - (void)moveDragTo:(NSPoint)screenPoint; 73 - (void)moveDragTo:(NSPoint)screenPoint;
66 74
67 // Call to drag a promised file to the given path (should be called before 75 // Call to drag a promised file to the given path (should be called before
68 // -endDragAt:...); hook up to -namesOfPromisedFilesDroppedAtDestination:. 76 // -endDragAt:...); hook up to -namesOfPromisedFilesDroppedAtDestination:.
69 // Returns the file name (not including path) of the file deposited (or which 77 // Returns the file name (not including path) of the file deposited (or which
70 // will be deposited). 78 // will be deposited).
71 - (NSString*)dragPromisedFileTo:(NSString*)path; 79 - (NSString*)dragPromisedFileTo:(NSString*)path;
72 80
73 @end 81 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/cocoa/web_drag_source.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698