| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #import <Cocoa/Cocoa.h> | |
| 6 | |
| 7 #include "base/string16.h" | |
| 8 | |
| 9 class WebContentsImpl; | |
| 10 struct WebDropData; | |
| 11 | |
| 12 namespace content { | |
| 13 class RenderViewHost; | |
| 14 class WebDragDestDelegate; | |
| 15 } | |
| 16 | |
| 17 // A typedef for a RenderViewHost used for comparison purposes only. | |
| 18 typedef content::RenderViewHost* RenderViewHostIdentifier; | |
| 19 | |
| 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 | |
| 22 // only for processing during a drag. | |
| 23 | |
| 24 @interface WebDragDest : NSObject { | |
| 25 @private | |
| 26 // Our associated WebContentsImpl. Weak reference. | |
| 27 WebContentsImpl* webContents_; | |
| 28 | |
| 29 // Delegate; weak. | |
| 30 content::WebDragDestDelegate* delegate_; | |
| 31 | |
| 32 // Updated asynchronously during a drag to tell us whether or not we should | |
| 33 // allow the drop. | |
| 34 NSDragOperation current_operation_; | |
| 35 | |
| 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. | |
| 38 RenderViewHostIdentifier currentRVH_; | |
| 39 } | |
| 40 | |
| 41 // |contents| is the WebContentsImpl representing this tab, used to communicate | |
| 42 // drag&drop messages to WebCore and handle navigation on a successful drop | |
| 43 // (if necessary). | |
| 44 - (id)initWithWebContentsImpl:(WebContentsImpl*)contents; | |
| 45 | |
| 46 - (void)setDragDelegate:(content::WebDragDestDelegate*)delegate; | |
| 47 | |
| 48 // Sets the current operation negotiated by the source and destination, | |
| 49 // which determines whether or not we should allow the drop. Takes effect the | |
| 50 // next time |-draggingUpdated:| is called. | |
| 51 - (void)setCurrentOperation:(NSDragOperation)operation; | |
| 52 | |
| 53 // Messages to send during the tracking of a drag, ususally upon receiving | |
| 54 // calls from the view system. Communicates the drag messages to WebCore. | |
| 55 - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)info | |
| 56 view:(NSView*)view; | |
| 57 - (void)draggingExited:(id<NSDraggingInfo>)info; | |
| 58 - (NSDragOperation)draggingUpdated:(id<NSDraggingInfo>)info | |
| 59 view:(NSView*)view; | |
| 60 - (BOOL)performDragOperation:(id<NSDraggingInfo>)info | |
| 61 view:(NSView*)view; | |
| 62 | |
| 63 @end | |
| 64 | |
| 65 // Public use only for unit tests. | |
| 66 @interface WebDragDest(Testing) | |
| 67 // Given |data|, which should not be nil, fill it in using the contents of the | |
| 68 // given pasteboard. | |
| 69 - (void)populateWebDropData:(WebDropData*)data | |
| 70 fromPasteboard:(NSPasteboard*)pboard; | |
| 71 // Given a point in window coordinates and a view in that window, return a | |
| 72 // flipped point in the coordinate system of |view|. | |
| 73 - (NSPoint)flipWindowPointToView:(const NSPoint&)windowPoint | |
| 74 view:(NSView*)view; | |
| 75 // Given a point in window coordinates and a view in that window, return a | |
| 76 // flipped point in screen coordinates. | |
| 77 - (NSPoint)flipWindowPointToScreen:(const NSPoint&)windowPoint | |
| 78 view:(NSView*)view; | |
| 79 @end | |
| OLD | NEW |