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

Side by Side Diff: content/browser/web_contents/web_drag_source_mac.h

Issue 18281002: Move WebDropData to content::DropData and split off conversion function. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Mac build error. Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/mac/scoped_cftyperef.h" 8 #include "base/mac/scoped_cftyperef.h"
9 #include "base/mac/scoped_nsobject.h" 9 #include "base/mac/scoped_nsobject.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "content/common/content_export.h" 11 #include "content/common/content_export.h"
12 #include "googleurl/src/gurl.h" 12 #include "googleurl/src/gurl.h"
13 13
14 struct WebDropData;
15 namespace content { 14 namespace content {
16 class WebContentsImpl; 15 class WebContentsImpl;
16 struct DropData;
17 } 17 }
18 18
19 // A class that handles tracking and event processing for a drag and drop 19 // A class that handles tracking and event processing for a drag and drop
20 // originating from the content area. 20 // originating from the content area.
21 CONTENT_EXPORT 21 CONTENT_EXPORT
22 @interface WebDragSource : NSObject { 22 @interface WebDragSource : NSObject {
23 @private 23 @private
24 // Our contents. Weak reference (owns or co-owns us). 24 // Our contents. Weak reference (owns or co-owns us).
25 content::WebContentsImpl* contents_; 25 content::WebContentsImpl* contents_;
26 26
27 // The view from which the drag was initiated. Weak reference. 27 // The view from which the drag was initiated. Weak reference.
28 NSView* contentsView_; 28 NSView* contentsView_;
29 29
30 // Our drop data. Should only be initialized once. 30 // Our drop data. Should only be initialized once.
31 scoped_ptr<WebDropData> dropData_; 31 scoped_ptr<content::DropData> dropData_;
32 32
33 // The image to show as drag image. Can be nil. 33 // The image to show as drag image. Can be nil.
34 base::scoped_nsobject<NSImage> dragImage_; 34 base::scoped_nsobject<NSImage> dragImage_;
35 35
36 // The offset to draw |dragImage_| at. 36 // The offset to draw |dragImage_| at.
37 NSPoint imageOffset_; 37 NSPoint imageOffset_;
38 38
39 // Our pasteboard. 39 // Our pasteboard.
40 base::scoped_nsobject<NSPasteboard> pasteboard_; 40 base::scoped_nsobject<NSPasteboard> pasteboard_;
41 41
42 // A mask of the allowed drag operations. 42 // A mask of the allowed drag operations.
43 NSDragOperation dragOperationMask_; 43 NSDragOperation dragOperationMask_;
44 44
45 // The file name to be saved to for a drag-out download. 45 // The file name to be saved to for a drag-out download.
46 base::FilePath downloadFileName_; 46 base::FilePath downloadFileName_;
47 47
48 // The URL to download from for a drag-out download. 48 // The URL to download from for a drag-out download.
49 GURL downloadURL_; 49 GURL downloadURL_;
50 50
51 // The file UTI associated with the file drag, if any. 51 // The file UTI associated with the file drag, if any.
52 base::ScopedCFTypeRef<CFStringRef> fileUTI_; 52 base::ScopedCFTypeRef<CFStringRef> fileUTI_;
53 } 53 }
54 54
55 // Initialize a WebDragSource object for a drag (originating on the given 55 // Initialize a WebDragSource object for a drag (originating on the given
56 // contentsView and with the given dropData and pboard). Fill the pasteboard 56 // contentsView and with the given dropData and pboard). Fill the pasteboard
57 // with data types appropriate for dropData. 57 // with data types appropriate for dropData.
58 - (id)initWithContents:(content::WebContentsImpl*)contents 58 - (id)initWithContents:(content::WebContentsImpl*)contents
59 view:(NSView*)contentsView 59 view:(NSView*)contentsView
60 dropData:(const WebDropData*)dropData 60 dropData:(const content::DropData*)dropData
61 image:(NSImage*)image 61 image:(NSImage*)image
62 offset:(NSPoint)offset 62 offset:(NSPoint)offset
63 pasteboard:(NSPasteboard*)pboard 63 pasteboard:(NSPasteboard*)pboard
64 dragOperationMask:(NSDragOperation)dragOperationMask; 64 dragOperationMask:(NSDragOperation)dragOperationMask;
65 65
66 // Call when the web contents is gone. 66 // Call when the web contents is gone.
67 - (void)clearWebContentsView; 67 - (void)clearWebContentsView;
68 68
69 // Returns a mask of the allowed drag operations. 69 // Returns a mask of the allowed drag operations.
70 - (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal; 70 - (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal;
71 71
72 // Call when asked to do a lazy write to the pasteboard; hook up to 72 // Call when asked to do a lazy write to the pasteboard; hook up to
73 // -pasteboard:provideDataForType: (on the contentsView). 73 // -pasteboard:provideDataForType: (on the contentsView).
74 - (void)lazyWriteToPasteboard:(NSPasteboard*)pboard 74 - (void)lazyWriteToPasteboard:(NSPasteboard*)pboard
75 forType:(NSString*)type; 75 forType:(NSString*)type;
76 76
77 // Start the drag (on the originally provided contentsView); can do this right 77 // Start the drag (on the originally provided contentsView); can do this right
78 // after -initWithContentsView:.... 78 // after -initWithContentsView:....
79 - (void)startDrag; 79 - (void)startDrag;
80 80
81 // End the drag and clear the pasteboard; hook up to 81 // End the drag and clear the pasteboard; hook up to
82 // -draggedImage:endedAt:operation:. 82 // -draggedImage:endedAt:operation:.
83 - (void)endDragAt:(NSPoint)screenPoint 83 - (void)endDragAt:(NSPoint)screenPoint
84 operation:(NSDragOperation)operation; 84 operation:(NSDragOperation)operation;
85 85
86 // Drag moved; hook up to -draggedImage:movedTo:. 86 // Drag moved; hook up to -draggedImage:movedTo:.
87 - (void)moveDragTo:(NSPoint)screenPoint; 87 - (void)moveDragTo:(NSPoint)screenPoint;
88 88
89 @end 89 @end
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_drag_source_gtk.cc ('k') | content/browser/web_contents/web_drag_source_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698