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 "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 #include "webkit/common/webdropdata.h" | 10 #include "content/public/common/drop_data.h" |
11 | |
12 | 11 |
13 namespace content { | 12 namespace content { |
14 class RenderViewHost; | 13 class RenderViewHost; |
15 class WebContentsImpl; | 14 class WebContentsImpl; |
16 class WebDragDestDelegate; | 15 class WebDragDestDelegate; |
17 } | 16 } |
18 | 17 |
19 // A typedef for a RenderViewHost used for comparison purposes only. | 18 // A typedef for a RenderViewHost used for comparison purposes only. |
20 typedef content::RenderViewHost* RenderViewHostIdentifier; | 19 typedef content::RenderViewHost* RenderViewHostIdentifier; |
21 | 20 |
(...skipping 11 matching lines...) Expand all Loading... |
33 | 32 |
34 // 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 |
35 // allow the drop. | 34 // allow the drop. |
36 NSDragOperation currentOperation_; | 35 NSDragOperation currentOperation_; |
37 | 36 |
38 // 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 |
39 // during a drag, we need to re-send the DragEnter message. | 38 // during a drag, we need to re-send the DragEnter message. |
40 RenderViewHostIdentifier currentRVH_; | 39 RenderViewHostIdentifier currentRVH_; |
41 | 40 |
42 // The data for the current drag, or NULL if none is in progress. | 41 // The data for the current drag, or NULL if none is in progress. |
43 scoped_ptr<WebDropData> dropData_; | 42 scoped_ptr<content::DropData> dropData_; |
44 | 43 |
45 // True if the drag has been canceled. | 44 // True if the drag has been canceled. |
46 bool canceled_; | 45 bool canceled_; |
47 } | 46 } |
48 | 47 |
49 // |contents| is the WebContentsImpl representing this tab, used to communicate | 48 // |contents| is the WebContentsImpl representing this tab, used to communicate |
50 // drag&drop messages to WebCore and handle navigation on a successful drop | 49 // drag&drop messages to WebCore and handle navigation on a successful drop |
51 // (if necessary). | 50 // (if necessary). |
52 - (id)initWithWebContentsImpl:(content::WebContentsImpl*)contents; | 51 - (id)initWithWebContentsImpl:(content::WebContentsImpl*)contents; |
53 | 52 |
54 - (WebDropData*)currentDropData; | 53 - (content::DropData*)currentDropData; |
55 | 54 |
56 - (void)setDragDelegate:(content::WebDragDestDelegate*)delegate; | 55 - (void)setDragDelegate:(content::WebDragDestDelegate*)delegate; |
57 | 56 |
58 // Sets the current operation negotiated by the source and destination, | 57 // Sets the current operation negotiated by the source and destination, |
59 // which determines whether or not we should allow the drop. Takes effect the | 58 // which determines whether or not we should allow the drop. Takes effect the |
60 // next time |-draggingUpdated:| is called. | 59 // next time |-draggingUpdated:| is called. |
61 - (void)setCurrentOperation:(NSDragOperation)operation; | 60 - (void)setCurrentOperation:(NSDragOperation)operation; |
62 | 61 |
63 // Messages to send during the tracking of a drag, ususally upon receiving | 62 // Messages to send during the tracking of a drag, ususally upon receiving |
64 // calls from the view system. Communicates the drag messages to WebCore. | 63 // calls from the view system. Communicates the drag messages to WebCore. |
65 - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)info | 64 - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)info |
66 view:(NSView*)view; | 65 view:(NSView*)view; |
67 - (void)draggingExited:(id<NSDraggingInfo>)info; | 66 - (void)draggingExited:(id<NSDraggingInfo>)info; |
68 - (NSDragOperation)draggingUpdated:(id<NSDraggingInfo>)info | 67 - (NSDragOperation)draggingUpdated:(id<NSDraggingInfo>)info |
69 view:(NSView*)view; | 68 view:(NSView*)view; |
70 - (BOOL)performDragOperation:(id<NSDraggingInfo>)info | 69 - (BOOL)performDragOperation:(id<NSDraggingInfo>)info |
71 view:(NSView*)view; | 70 view:(NSView*)view; |
72 | 71 |
73 @end | 72 @end |
74 | 73 |
75 // Public use only for unit tests. | 74 // Public use only for unit tests. |
76 @interface WebDragDest(Testing) | 75 @interface WebDragDest(Testing) |
77 // Given |data|, which should not be nil, fill it in using the contents of the | 76 // Given |data|, which should not be nil, fill it in using the contents of the |
78 // given pasteboard. | 77 // given pasteboard. |
79 - (void)populateWebDropData:(WebDropData*)data | 78 - (void)populateDropData:(content::DropData*)data |
80 fromPasteboard:(NSPasteboard*)pboard; | 79 fromPasteboard:(NSPasteboard*)pboard; |
81 // Given a point in window coordinates and a view in that window, return a | 80 // Given a point in window coordinates and a view in that window, return a |
82 // flipped point in the coordinate system of |view|. | 81 // flipped point in the coordinate system of |view|. |
83 - (NSPoint)flipWindowPointToView:(const NSPoint&)windowPoint | 82 - (NSPoint)flipWindowPointToView:(const NSPoint&)windowPoint |
84 view:(NSView*)view; | 83 view:(NSView*)view; |
85 // Given a point in window coordinates and a view in that window, return a | 84 // Given a point in window coordinates and a view in that window, return a |
86 // flipped point in screen coordinates. | 85 // flipped point in screen coordinates. |
87 - (NSPoint)flipWindowPointToScreen:(const NSPoint&)windowPoint | 86 - (NSPoint)flipWindowPointToScreen:(const NSPoint&)windowPoint |
88 view:(NSView*)view; | 87 view:(NSView*)view; |
89 @end | 88 @end |
OLD | NEW |