OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/string16.h" | 7 #include "base/string16.h" |
8 | 8 |
9 class GURL; | 9 class GURL; |
10 class RenderViewHost; | 10 class RenderViewHost; |
11 class TabContents; | 11 class TabContents; |
12 class TabContentsWrapper; | |
13 struct WebDropData; | 12 struct WebDropData; |
14 | 13 |
| 14 namespace content { |
| 15 class WebDragDestDelegate; |
| 16 } |
| 17 |
15 // A typedef for a RenderViewHost used for comparison purposes only. | 18 // A typedef for a RenderViewHost used for comparison purposes only. |
16 typedef RenderViewHost* RenderViewHostIdentifier; | 19 typedef RenderViewHost* RenderViewHostIdentifier; |
17 | 20 |
18 // A class that handles tracking and event processing for a drag and drop | 21 // A class that handles tracking and event processing for a drag and drop |
19 // over the content area. Assumes something else initiates the drag, this is | 22 // over the content area. Assumes something else initiates the drag, this is |
20 // only for processing during a drag. | 23 // only for processing during a drag. |
21 | 24 |
22 @interface WebDropTarget : NSObject { | 25 @interface WebDropTarget : NSObject { |
23 @private | 26 @private |
24 // Our associated TabContents. Weak reference. | 27 // Our associated TabContents. Weak reference. |
25 TabContents* tabContents_; | 28 TabContents* tabContents_; |
26 | 29 |
27 // The TabContentsWrapper for |tab_contents_|. | 30 // Delegate; weak. |
28 // Weak reference; may be NULL if the contents aren't contained in a wrapper | 31 content::WebDragDestDelegate* delegate_; |
29 // (e.g. WebUI dialogs). | |
30 TabContentsWrapper* tab_; | |
31 | 32 |
32 // Updated asynchronously during a drag to tell us whether or not we should | 33 // Updated asynchronously during a drag to tell us whether or not we should |
33 // allow the drop. | 34 // allow the drop. |
34 NSDragOperation current_operation_; | 35 NSDragOperation current_operation_; |
35 | 36 |
36 // Keep track of the render view host we're dragging over. If it changes | 37 // Keep track of the render view host we're dragging over. If it changes |
37 // during a drag, we need to re-send the DragEnter message. | 38 // during a drag, we need to re-send the DragEnter message. |
38 RenderViewHostIdentifier currentRVH_; | 39 RenderViewHostIdentifier currentRVH_; |
39 } | 40 } |
40 | 41 |
41 // |contents| is the TabContents representing this tab, used to communicate | 42 // |contents| is the TabContents representing this tab, used to communicate |
42 // drag&drop messages to WebCore and handle navigation on a successful drop | 43 // drag&drop messages to WebCore and handle navigation on a successful drop |
43 // (if necessary). | 44 // (if necessary). |
44 - (id)initWithTabContents:(TabContents*)contents; | 45 - (id)initWithTabContents:(TabContents*)contents; |
45 | 46 |
| 47 - (void)setDragDelegate:(content::WebDragDestDelegate*)delegate; |
| 48 |
46 // Sets the current operation negotiated by the source and destination, | 49 // Sets the current operation negotiated by the source and destination, |
47 // which determines whether or not we should allow the drop. Takes effect the | 50 // which determines whether or not we should allow the drop. Takes effect the |
48 // next time |-draggingUpdated:| is called. | 51 // next time |-draggingUpdated:| is called. |
49 - (void)setCurrentOperation: (NSDragOperation)operation; | 52 - (void)setCurrentOperation: (NSDragOperation)operation; |
50 | 53 |
51 // Messages to send during the tracking of a drag, ususally upon receiving | 54 // Messages to send during the tracking of a drag, ususally upon receiving |
52 // calls from the view system. Communicates the drag messages to WebCore. | 55 // calls from the view system. Communicates the drag messages to WebCore. |
53 - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)info | 56 - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)info |
54 view:(NSView*)view; | 57 view:(NSView*)view; |
55 - (void)draggingExited:(id<NSDraggingInfo>)info; | 58 - (void)draggingExited:(id<NSDraggingInfo>)info; |
(...skipping 12 matching lines...) Expand all Loading... |
68 fromPasteboard:(NSPasteboard*)pboard; | 71 fromPasteboard:(NSPasteboard*)pboard; |
69 // Given a point in window coordinates and a view in that window, return a | 72 // Given a point in window coordinates and a view in that window, return a |
70 // flipped point in the coordinate system of |view|. | 73 // flipped point in the coordinate system of |view|. |
71 - (NSPoint)flipWindowPointToView:(const NSPoint&)windowPoint | 74 - (NSPoint)flipWindowPointToView:(const NSPoint&)windowPoint |
72 view:(NSView*)view; | 75 view:(NSView*)view; |
73 // Given a point in window coordinates and a view in that window, return a | 76 // Given a point in window coordinates and a view in that window, return a |
74 // flipped point in screen coordinates. | 77 // flipped point in screen coordinates. |
75 - (NSPoint)flipWindowPointToScreen:(const NSPoint&)windowPoint | 78 - (NSPoint)flipWindowPointToScreen:(const NSPoint&)windowPoint |
76 view:(NSView*)view; | 79 view:(NSView*)view; |
77 @end | 80 @end |
OLD | NEW |