| 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/string16.h" | 7 #include "base/string16.h" |
| 8 #include "webkit/glue/webdropdata.h" |
| 8 | 9 |
| 9 class WebContentsImpl; | 10 class WebContentsImpl; |
| 10 struct WebDropData; | |
| 11 | 11 |
| 12 namespace content { | 12 namespace content { |
| 13 class RenderViewHost; | 13 class RenderViewHost; |
| 14 class WebDragDestDelegate; | 14 class WebDragDestDelegate; |
| 15 } | 15 } |
| 16 | 16 |
| 17 // A typedef for a RenderViewHost used for comparison purposes only. | 17 // A typedef for a RenderViewHost used for comparison purposes only. |
| 18 typedef content::RenderViewHost* RenderViewHostIdentifier; | 18 typedef content::RenderViewHost* RenderViewHostIdentifier; |
| 19 | 19 |
| 20 // 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 |
| 21 // over the content area. Assumes something else initiates the drag, this is | 21 // over the content area. Assumes something else initiates the drag, this is |
| 22 // only for processing during a drag. | 22 // only for processing during a drag. |
| 23 | 23 |
| 24 @interface WebDragDest : NSObject { | 24 @interface WebDragDest : NSObject { |
| 25 @private | 25 @private |
| 26 // Our associated WebContentsImpl. Weak reference. | 26 // Our associated WebContentsImpl. Weak reference. |
| 27 WebContentsImpl* webContents_; | 27 WebContentsImpl* webContents_; |
| 28 | 28 |
| 29 // Delegate; weak. | 29 // Delegate; weak. |
| 30 content::WebDragDestDelegate* delegate_; | 30 content::WebDragDestDelegate* delegate_; |
| 31 | 31 |
| 32 // Updated asynchronously during a drag to tell us whether or not we should | 32 // Updated asynchronously during a drag to tell us whether or not we should |
| 33 // allow the drop. | 33 // allow the drop. |
| 34 NSDragOperation current_operation_; | 34 NSDragOperation currentOperation_; |
| 35 | 35 |
| 36 // Keep track of the render view host we're dragging over. If it changes | 36 // 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. | 37 // during a drag, we need to re-send the DragEnter message. |
| 38 RenderViewHostIdentifier currentRVH_; | 38 RenderViewHostIdentifier currentRVH_; |
| 39 |
| 40 // The data for the current drag, or NULL if none is in progress. |
| 41 scoped_ptr<WebDropData> dropData_; |
| 39 } | 42 } |
| 40 | 43 |
| 41 // |contents| is the WebContentsImpl representing this tab, used to communicate | 44 // |contents| is the WebContentsImpl representing this tab, used to communicate |
| 42 // drag&drop messages to WebCore and handle navigation on a successful drop | 45 // drag&drop messages to WebCore and handle navigation on a successful drop |
| 43 // (if necessary). | 46 // (if necessary). |
| 44 - (id)initWithWebContentsImpl:(WebContentsImpl*)contents; | 47 - (id)initWithWebContentsImpl:(WebContentsImpl*)contents; |
| 45 | 48 |
| 49 - (WebDropData*)currentDropData; |
| 50 |
| 46 - (void)setDragDelegate:(content::WebDragDestDelegate*)delegate; | 51 - (void)setDragDelegate:(content::WebDragDestDelegate*)delegate; |
| 47 | 52 |
| 48 // Sets the current operation negotiated by the source and destination, | 53 // Sets the current operation negotiated by the source and destination, |
| 49 // which determines whether or not we should allow the drop. Takes effect the | 54 // which determines whether or not we should allow the drop. Takes effect the |
| 50 // next time |-draggingUpdated:| is called. | 55 // next time |-draggingUpdated:| is called. |
| 51 - (void)setCurrentOperation:(NSDragOperation)operation; | 56 - (void)setCurrentOperation:(NSDragOperation)operation; |
| 52 | 57 |
| 53 // Messages to send during the tracking of a drag, ususally upon receiving | 58 // Messages to send during the tracking of a drag, ususally upon receiving |
| 54 // calls from the view system. Communicates the drag messages to WebCore. | 59 // calls from the view system. Communicates the drag messages to WebCore. |
| 55 - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)info | 60 - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)info |
| (...skipping 14 matching lines...) Expand all Loading... |
| 70 fromPasteboard:(NSPasteboard*)pboard; | 75 fromPasteboard:(NSPasteboard*)pboard; |
| 71 // 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 |
| 72 // flipped point in the coordinate system of |view|. | 77 // flipped point in the coordinate system of |view|. |
| 73 - (NSPoint)flipWindowPointToView:(const NSPoint&)windowPoint | 78 - (NSPoint)flipWindowPointToView:(const NSPoint&)windowPoint |
| 74 view:(NSView*)view; | 79 view:(NSView*)view; |
| 75 // 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 |
| 76 // flipped point in screen coordinates. | 81 // flipped point in screen coordinates. |
| 77 - (NSPoint)flipWindowPointToScreen:(const NSPoint&)windowPoint | 82 - (NSPoint)flipWindowPointToScreen:(const NSPoint&)windowPoint |
| 78 view:(NSView*)view; | 83 view:(NSView*)view; |
| 79 @end | 84 @end |
| OLD | NEW |