| 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> |
| 8 |
| 7 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 8 #include "base/mac/scoped_cftyperef.h" | 10 #include "base/mac/scoped_cftyperef.h" |
| 9 #include "base/mac/scoped_nsobject.h" | 11 #include "base/mac/scoped_nsobject.h" |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 12 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 13 | 14 |
| 14 namespace content { | 15 namespace content { |
| 15 class WebContentsImpl; | 16 class WebContentsImpl; |
| 16 struct DropData; | 17 struct DropData; |
| 17 } | 18 } |
| 18 | 19 |
| 19 // A class that handles tracking and event processing for a drag and drop | 20 // A class that handles tracking and event processing for a drag and drop |
| 20 // originating from the content area. | 21 // originating from the content area. |
| 21 CONTENT_EXPORT | 22 CONTENT_EXPORT |
| 22 @interface WebDragSource : NSObject { | 23 @interface WebDragSource : NSObject { |
| 23 @private | 24 @private |
| 24 // Our contents. Weak reference (owns or co-owns us). | 25 // Our contents. Weak reference (owns or co-owns us). |
| 25 // An instance of this class may outlive |contents_|. The destructor of | 26 // An instance of this class may outlive |contents_|. The destructor of |
| 26 // |contents_| must set this ivar to |nullptr|. | 27 // |contents_| must set this ivar to |nullptr|. |
| 27 content::WebContentsImpl* contents_; | 28 content::WebContentsImpl* contents_; |
| 28 | 29 |
| 29 // The view from which the drag was initiated. Weak reference. | 30 // The view from which the drag was initiated. Weak reference. |
| 30 // An instance of this class may outlive |contentsView_|. The destructor of | 31 // An instance of this class may outlive |contentsView_|. The destructor of |
| 31 // |contentsView_| must set this ivar to |nullptr|. | 32 // |contentsView_| must set this ivar to |nullptr|. |
| 32 NSView* contentsView_; | 33 NSView* contentsView_; |
| 33 | 34 |
| 34 // Our drop data. Should only be initialized once. | 35 // Our drop data. Should only be initialized once. |
| 35 scoped_ptr<content::DropData> dropData_; | 36 std::unique_ptr<content::DropData> dropData_; |
| 36 | 37 |
| 37 // The image to show as drag image. Can be nil. | 38 // The image to show as drag image. Can be nil. |
| 38 base::scoped_nsobject<NSImage> dragImage_; | 39 base::scoped_nsobject<NSImage> dragImage_; |
| 39 | 40 |
| 40 // The offset to draw |dragImage_| at. | 41 // The offset to draw |dragImage_| at. |
| 41 NSPoint imageOffset_; | 42 NSPoint imageOffset_; |
| 42 | 43 |
| 43 // Our pasteboard. | 44 // Our pasteboard. |
| 44 base::scoped_nsobject<NSPasteboard> pasteboard_; | 45 base::scoped_nsobject<NSPasteboard> pasteboard_; |
| 45 | 46 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 - (void)endDragAt:(NSPoint)screenPoint | 88 - (void)endDragAt:(NSPoint)screenPoint |
| 88 operation:(NSDragOperation)operation; | 89 operation:(NSDragOperation)operation; |
| 89 | 90 |
| 90 // Call to drag a promised file to the given path (should be called before | 91 // Call to drag a promised file to the given path (should be called before |
| 91 // -endDragAt:...); hook up to -namesOfPromisedFilesDroppedAtDestination:. | 92 // -endDragAt:...); hook up to -namesOfPromisedFilesDroppedAtDestination:. |
| 92 // Returns the file name (not including path) of the file deposited (or which | 93 // Returns the file name (not including path) of the file deposited (or which |
| 93 // will be deposited). | 94 // will be deposited). |
| 94 - (NSString*)dragPromisedFileTo:(NSString*)path; | 95 - (NSString*)dragPromisedFileTo:(NSString*)path; |
| 95 | 96 |
| 96 @end | 97 @end |
| OLD | NEW |