OLD | NEW |
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/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/memory/scoped_nsobject.h" | 8 #include "base/memory/scoped_nsobject.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
11 | 11 |
| 12 struct WebDropData; |
| 13 namespace content { |
12 class WebContentsImpl; | 14 class WebContentsImpl; |
13 struct WebDropData; | 15 } |
14 | 16 |
15 // A class that handles tracking and event processing for a drag and drop | 17 // A class that handles tracking and event processing for a drag and drop |
16 // originating from the content area. | 18 // originating from the content area. |
17 @interface WebDragSource : NSObject { | 19 @interface WebDragSource : NSObject { |
18 @private | 20 @private |
19 // Our contents. Weak reference (owns or co-owns us). | 21 // Our contents. Weak reference (owns or co-owns us). |
20 WebContentsImpl* contents_; | 22 content::WebContentsImpl* contents_; |
21 | 23 |
22 // The view from which the drag was initiated. Weak reference. | 24 // The view from which the drag was initiated. Weak reference. |
23 NSView* contentsView_; | 25 NSView* contentsView_; |
24 | 26 |
25 // Our drop data. Should only be initialized once. | 27 // Our drop data. Should only be initialized once. |
26 scoped_ptr<WebDropData> dropData_; | 28 scoped_ptr<WebDropData> dropData_; |
27 | 29 |
28 // The image to show as drag image. Can be nil. | 30 // The image to show as drag image. Can be nil. |
29 scoped_nsobject<NSImage> dragImage_; | 31 scoped_nsobject<NSImage> dragImage_; |
30 | 32 |
(...skipping 12 matching lines...) Expand all Loading... |
43 // The URL to download from for a drag-out download. | 45 // The URL to download from for a drag-out download. |
44 GURL downloadURL_; | 46 GURL downloadURL_; |
45 | 47 |
46 // The file extension associated with the file drag, if any. | 48 // The file extension associated with the file drag, if any. |
47 NSString* fileExtension_; | 49 NSString* fileExtension_; |
48 } | 50 } |
49 | 51 |
50 // Initialize a WebDragSource object for a drag (originating on the given | 52 // Initialize a WebDragSource object for a drag (originating on the given |
51 // contentsView and with the given dropData and pboard). Fill the pasteboard | 53 // contentsView and with the given dropData and pboard). Fill the pasteboard |
52 // with data types appropriate for dropData. | 54 // with data types appropriate for dropData. |
53 - (id)initWithContents:(WebContentsImpl*)contents | 55 - (id)initWithContents:(content::WebContentsImpl*)contents |
54 view:(NSView*)contentsView | 56 view:(NSView*)contentsView |
55 dropData:(const WebDropData*)dropData | 57 dropData:(const WebDropData*)dropData |
56 image:(NSImage*)image | 58 image:(NSImage*)image |
57 offset:(NSPoint)offset | 59 offset:(NSPoint)offset |
58 pasteboard:(NSPasteboard*)pboard | 60 pasteboard:(NSPasteboard*)pboard |
59 dragOperationMask:(NSDragOperation)dragOperationMask; | 61 dragOperationMask:(NSDragOperation)dragOperationMask; |
60 | 62 |
61 // Call when the web contents is gone. | 63 // Call when the web contents is gone. |
62 - (void)clearWebContentsView; | 64 - (void)clearWebContentsView; |
63 | 65 |
(...skipping 17 matching lines...) Expand all Loading... |
81 // Drag moved; hook up to -draggedImage:movedTo:. | 83 // Drag moved; hook up to -draggedImage:movedTo:. |
82 - (void)moveDragTo:(NSPoint)screenPoint; | 84 - (void)moveDragTo:(NSPoint)screenPoint; |
83 | 85 |
84 // Call to drag a promised file to the given path (should be called before | 86 // Call to drag a promised file to the given path (should be called before |
85 // -endDragAt:...); hook up to -namesOfPromisedFilesDroppedAtDestination:. | 87 // -endDragAt:...); hook up to -namesOfPromisedFilesDroppedAtDestination:. |
86 // Returns the file name (not including path) of the file deposited (or which | 88 // Returns the file name (not including path) of the file deposited (or which |
87 // will be deposited). | 89 // will be deposited). |
88 - (NSString*)dragPromisedFileTo:(NSString*)path; | 90 - (NSString*)dragPromisedFileTo:(NSString*)path; |
89 | 91 |
90 @end | 92 @end |
OLD | NEW |