OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 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 class RenderViewHost; | 7 class RenderViewHost; |
8 class TabContents; | 8 class TabContents; |
9 class WebDropData; | 9 class WebDropData; |
10 | 10 |
11 // A typedef for a RenderViewHost used for comparison purposes only. | 11 // A typedef for a RenderViewHost used for comparison purposes only. |
12 typedef RenderViewHost* RenderViewHostIdentifier; | 12 typedef RenderViewHost* RenderViewHostIdentifier; |
13 | 13 |
14 // A class that handles tracking and event processing for a drag and drop | 14 // A class that handles tracking and event processing for a drag and drop |
15 // over the content area. Assumes something else initiates the drag, this is | 15 // over the content area. Assumes something else initiates the drag, this is |
16 // only for processing during a drag. | 16 // only for processing during a drag. |
17 | 17 |
18 @interface WebDropTarget : NSObject { | 18 @interface WebDropTarget : NSObject { |
19 @private | 19 @private |
20 // Our associated TabContents. Weak reference. | 20 // Our associated TabContents. Weak reference. |
21 TabContents* tabContents_; | 21 TabContents* tabContents_; |
22 | 22 |
23 // Updated asynchronously during a drag to tell us whether or not we should | 23 // Updated asynchronously during a drag to tell us whether or not we should |
24 // allow the drop. | 24 // allow the drop. |
25 BOOL isDropTarget_; | 25 NSDragOperation current_operation_; |
26 | 26 |
27 // Keep track of the render view host we're dragging over. If it changes | 27 // Keep track of the render view host we're dragging over. If it changes |
28 // during a drag, we need to re-send the DragEnter message. | 28 // during a drag, we need to re-send the DragEnter message. |
29 RenderViewHostIdentifier currentRVH_; | 29 RenderViewHostIdentifier currentRVH_; |
30 } | 30 } |
31 | 31 |
32 // |contents| is the TabContents representing this tab, used to communicate | 32 // |contents| is the TabContents representing this tab, used to communicate |
33 // drag&drop messages to WebCore and handle navigation on a successful drop | 33 // drag&drop messages to WebCore and handle navigation on a successful drop |
34 // (if necessary). | 34 // (if necessary). |
35 - (id)initWithTabContents:(TabContents*)contents; | 35 - (id)initWithTabContents:(TabContents*)contents; |
36 | 36 |
37 // Call to set whether or not we should allow the drop. Takes effect the | 37 // Sets the current operation negotiated by the source and destination, |
| 38 // which determines whether or not we should allow the drop. Takes effect the |
38 // next time |-draggingUpdated:| is called. | 39 // next time |-draggingUpdated:| is called. |
39 - (void)setIsDropTarget:(BOOL)isDropTarget; | 40 - (void)setCurrentOperation: (NSDragOperation)operation; |
40 | 41 |
41 // Messages to send during the tracking of a drag, ususally upon receiving | 42 // Messages to send during the tracking of a drag, ususally upon receiving |
42 // calls from the view system. Communicates the drag messages to WebCore. | 43 // calls from the view system. Communicates the drag messages to WebCore. |
43 - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)info | 44 - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)info |
44 view:(NSView*)view; | 45 view:(NSView*)view; |
45 - (void)draggingExited:(id<NSDraggingInfo>)info; | 46 - (void)draggingExited:(id<NSDraggingInfo>)info; |
46 - (NSDragOperation)draggingUpdated:(id<NSDraggingInfo>)info | 47 - (NSDragOperation)draggingUpdated:(id<NSDraggingInfo>)info |
47 view:(NSView*)view; | 48 view:(NSView*)view; |
48 - (BOOL)performDragOperation:(id<NSDraggingInfo>)info | 49 - (BOOL)performDragOperation:(id<NSDraggingInfo>)info |
49 view:(NSView*)view; | 50 view:(NSView*)view; |
(...skipping 13 matching lines...) Expand all Loading... |
63 fromPasteboard:(NSPasteboard*)pboard; | 64 fromPasteboard:(NSPasteboard*)pboard; |
64 // Given a point in window coordinates and a view in that window, return a | 65 // Given a point in window coordinates and a view in that window, return a |
65 // flipped point in the coordinate system of |view|. | 66 // flipped point in the coordinate system of |view|. |
66 - (NSPoint)flipWindowPointToView:(const NSPoint&)windowPoint | 67 - (NSPoint)flipWindowPointToView:(const NSPoint&)windowPoint |
67 view:(NSView*)view; | 68 view:(NSView*)view; |
68 // Given a point in window coordinates and a view in that window, return a | 69 // Given a point in window coordinates and a view in that window, return a |
69 // flipped point in screen coordinates. | 70 // flipped point in screen coordinates. |
70 - (NSPoint)flipWindowPointToScreen:(const NSPoint&)windowPoint | 71 - (NSPoint)flipWindowPointToScreen:(const NSPoint&)windowPoint |
71 view:(NSView*)view; | 72 view:(NSView*)view; |
72 @end | 73 @end |
OLD | NEW |