| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/mac/scoped_cftyperef.h" | 10 #include "base/mac/scoped_cftyperef.h" |
| 11 #include "base/mac/scoped_nsobject.h" | 11 #include "base/mac/scoped_nsobject.h" |
| 12 #include "base/memory/weak_ptr.h" |
| 12 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 13 #include "url/gurl.h" | 14 #include "url/gurl.h" |
| 14 | 15 |
| 15 namespace content { | 16 namespace content { |
| 17 class RenderWidgetHostImpl; |
| 16 class WebContentsImpl; | 18 class WebContentsImpl; |
| 17 struct DropData; | 19 struct DropData; |
| 18 } | 20 } |
| 19 | 21 |
| 20 // A class that handles tracking and event processing for a drag and drop | 22 // A class that handles tracking and event processing for a drag and drop |
| 21 // originating from the content area. | 23 // originating from the content area. |
| 22 CONTENT_EXPORT | 24 CONTENT_EXPORT |
| 23 @interface WebDragSource : NSObject { | 25 @interface WebDragSource : NSObject { |
| 24 @private | 26 @private |
| 25 // Our contents. Weak reference (owns or co-owns us). | 27 // Our contents. Weak reference (owns or co-owns us). |
| (...skipping 22 matching lines...) Expand all Loading... |
| 48 NSDragOperation dragOperationMask_; | 50 NSDragOperation dragOperationMask_; |
| 49 | 51 |
| 50 // The file name to be saved to for a drag-out download. | 52 // The file name to be saved to for a drag-out download. |
| 51 base::FilePath downloadFileName_; | 53 base::FilePath downloadFileName_; |
| 52 | 54 |
| 53 // The URL to download from for a drag-out download. | 55 // The URL to download from for a drag-out download. |
| 54 GURL downloadURL_; | 56 GURL downloadURL_; |
| 55 | 57 |
| 56 // The file UTI associated with the file drag, if any. | 58 // The file UTI associated with the file drag, if any. |
| 57 base::ScopedCFTypeRef<CFStringRef> fileUTI_; | 59 base::ScopedCFTypeRef<CFStringRef> fileUTI_; |
| 60 |
| 61 // Tracks the RenderWidgetHost where the current drag started. |
| 62 base::WeakPtr<content::RenderWidgetHostImpl> dragStartRWH_; |
| 58 } | 63 } |
| 59 | 64 |
| 60 // Initialize a WebDragSource object for a drag (originating on the given | 65 // Initialize a WebDragSource object for a drag (originating on the given |
| 61 // contentsView and with the given dropData and pboard). Fill the pasteboard | 66 // contentsView and with the given dropData and pboard). Fill the pasteboard |
| 62 // with data types appropriate for dropData. | 67 // with data types appropriate for dropData. |
| 63 - (id)initWithContents:(content::WebContentsImpl*)contents | 68 - (id)initWithContents:(content::WebContentsImpl*)contents |
| 64 view:(NSView*)contentsView | 69 view:(NSView*)contentsView |
| 65 dropData:(const content::DropData*)dropData | 70 dropData:(const content::DropData*)dropData |
| 71 sourceRWH:(content::RenderWidgetHostImpl*)sourceRWH |
| 66 image:(NSImage*)image | 72 image:(NSImage*)image |
| 67 offset:(NSPoint)offset | 73 offset:(NSPoint)offset |
| 68 pasteboard:(NSPasteboard*)pboard | 74 pasteboard:(NSPasteboard*)pboard |
| 69 dragOperationMask:(NSDragOperation)dragOperationMask; | 75 dragOperationMask:(NSDragOperation)dragOperationMask; |
| 70 | 76 |
| 71 // Call when the web contents is gone. | 77 // Call when the web contents is gone. |
| 72 - (void)clearWebContentsView; | 78 - (void)clearWebContentsView; |
| 73 | 79 |
| 74 // Returns a mask of the allowed drag operations. | 80 // Returns a mask of the allowed drag operations. |
| 75 - (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal; | 81 - (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 88 - (void)endDragAt:(NSPoint)screenPoint | 94 - (void)endDragAt:(NSPoint)screenPoint |
| 89 operation:(NSDragOperation)operation; | 95 operation:(NSDragOperation)operation; |
| 90 | 96 |
| 91 // Call to drag a promised file to the given path (should be called before | 97 // Call to drag a promised file to the given path (should be called before |
| 92 // -endDragAt:...); hook up to -namesOfPromisedFilesDroppedAtDestination:. | 98 // -endDragAt:...); hook up to -namesOfPromisedFilesDroppedAtDestination:. |
| 93 // Returns the file name (not including path) of the file deposited (or which | 99 // Returns the file name (not including path) of the file deposited (or which |
| 94 // will be deposited). | 100 // will be deposited). |
| 95 - (NSString*)dragPromisedFileTo:(NSString*)path; | 101 - (NSString*)dragPromisedFileTo:(NSString*)path; |
| 96 | 102 |
| 97 @end | 103 @end |
| OLD | NEW |