| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import <Cocoa/Cocoa.h> |
| 6 |
| 7 #include "base/scoped_nsobject.h" |
| 8 #include "base/scoped_ptr.h" |
| 9 |
| 10 struct WebDropData; |
| 11 @class TabContentsViewCocoa; |
| 12 |
| 13 // A class that handles tracking and event processing for a drag and drop |
| 14 // originating from the content area. |
| 15 @interface WebDragSource : NSObject { |
| 16 @private |
| 17 // Our tab. Weak reference (owns or co-owns us). |
| 18 TabContentsViewCocoa* contentsView_; |
| 19 |
| 20 // Our drop data. Should only be initialized once. |
| 21 scoped_ptr<WebDropData> dropData_; |
| 22 |
| 23 // Our pasteboard. |
| 24 scoped_nsobject<NSPasteboard> pasteboard_; |
| 25 } |
| 26 |
| 27 // Initialize a WebDragSource object for a drag (originating on the given |
| 28 // contentsView and with the given dropData and pboard). Fill the pasteboard |
| 29 // with data types appropriate for dropData. |
| 30 - (id)initWithContentsView:(TabContentsViewCocoa*)contentsView |
| 31 dropData:(const WebDropData*)dropData |
| 32 pasteboard:(NSPasteboard*)pboard; |
| 33 |
| 34 // Call when asked to do a lazy write to the pasteboard; hook up to |
| 35 // -pasteboard:provideDataForType: (on the contentsView). |
| 36 - (void)lazyWriteToPasteboard:(NSPasteboard*)pboard |
| 37 forType:(NSString*)type; |
| 38 |
| 39 // Start the drag (on the originally provided contentsView); can do this right |
| 40 // after -initWithContentsView:.... |
| 41 - (void)startDrag; |
| 42 |
| 43 // End the drag and clear the pasteboard; hook up to |
| 44 // -draggedImage:endedAt:operation:. |
| 45 - (void)endDragAt:(NSPoint)screenPoint |
| 46 isCancelled:(BOOL)cancelled; |
| 47 |
| 48 // Drag moved; hook up to -draggedImage:movedTo:. |
| 49 - (void)moveDragTo:(NSPoint)screenPoint; |
| 50 |
| 51 // Call to drag a promised file to the given path (should be called before |
| 52 // -endDragAt:...); hook up to -namesOfPromisedFilesDroppedAtDestination:. |
| 53 // Returns the file name (not including path) of the file deposited (or which |
| 54 // will be deposited). |
| 55 - (NSString*)dragPromisedFileTo:(NSString*)path; |
| 56 |
| 57 @end |
| OLD | NEW |