| 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/string16.h" | 8 #include "base/string16.h" |
| 9 #include "webkit/glue/webdropdata.h" | 9 #include "webkit/glue/webdropdata.h" |
| 10 | 10 |
| 11 class WebContentsImpl; | |
| 12 | 11 |
| 13 namespace content { | 12 namespace content { |
| 14 class RenderViewHost; | 13 class RenderViewHost; |
| 14 class WebContentsImpl; |
| 15 class WebDragDestDelegate; | 15 class WebDragDestDelegate; |
| 16 } | 16 } |
| 17 | 17 |
| 18 // A typedef for a RenderViewHost used for comparison purposes only. | 18 // A typedef for a RenderViewHost used for comparison purposes only. |
| 19 typedef content::RenderViewHost* RenderViewHostIdentifier; | 19 typedef content::RenderViewHost* RenderViewHostIdentifier; |
| 20 | 20 |
| 21 // 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 |
| 22 // 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 |
| 23 // only for processing during a drag. | 23 // only for processing during a drag. |
| 24 | 24 |
| 25 @interface WebDragDest : NSObject { | 25 @interface WebDragDest : NSObject { |
| 26 @private | 26 @private |
| 27 // Our associated WebContentsImpl. Weak reference. | 27 // Our associated WebContentsImpl. Weak reference. |
| 28 WebContentsImpl* webContents_; | 28 content::WebContentsImpl* webContents_; |
| 29 | 29 |
| 30 // Delegate; weak. | 30 // Delegate; weak. |
| 31 content::WebDragDestDelegate* delegate_; | 31 content::WebDragDestDelegate* delegate_; |
| 32 | 32 |
| 33 // 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 |
| 34 // allow the drop. | 34 // allow the drop. |
| 35 NSDragOperation currentOperation_; | 35 NSDragOperation currentOperation_; |
| 36 | 36 |
| 37 // 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 |
| 38 // during a drag, we need to re-send the DragEnter message. | 38 // during a drag, we need to re-send the DragEnter message. |
| 39 RenderViewHostIdentifier currentRVH_; | 39 RenderViewHostIdentifier currentRVH_; |
| 40 | 40 |
| 41 // 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. |
| 42 scoped_ptr<WebDropData> dropData_; | 42 scoped_ptr<WebDropData> dropData_; |
| 43 } | 43 } |
| 44 | 44 |
| 45 // |contents| is the WebContentsImpl representing this tab, used to communicate | 45 // |contents| is the WebContentsImpl representing this tab, used to communicate |
| 46 // drag&drop messages to WebCore and handle navigation on a successful drop | 46 // drag&drop messages to WebCore and handle navigation on a successful drop |
| 47 // (if necessary). | 47 // (if necessary). |
| 48 - (id)initWithWebContentsImpl:(WebContentsImpl*)contents; | 48 - (id)initWithWebContentsImpl:(content::WebContentsImpl*)contents; |
| 49 | 49 |
| 50 - (WebDropData*)currentDropData; | 50 - (WebDropData*)currentDropData; |
| 51 | 51 |
| 52 - (void)setDragDelegate:(content::WebDragDestDelegate*)delegate; | 52 - (void)setDragDelegate:(content::WebDragDestDelegate*)delegate; |
| 53 | 53 |
| 54 // Sets the current operation negotiated by the source and destination, | 54 // Sets the current operation negotiated by the source and destination, |
| 55 // which determines whether or not we should allow the drop. Takes effect the | 55 // which determines whether or not we should allow the drop. Takes effect the |
| 56 // next time |-draggingUpdated:| is called. | 56 // next time |-draggingUpdated:| is called. |
| 57 - (void)setCurrentOperation:(NSDragOperation)operation; | 57 - (void)setCurrentOperation:(NSDragOperation)operation; |
| 58 | 58 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 76 fromPasteboard:(NSPasteboard*)pboard; | 76 fromPasteboard:(NSPasteboard*)pboard; |
| 77 // Given a point in window coordinates and a view in that window, return a | 77 // Given a point in window coordinates and a view in that window, return a |
| 78 // flipped point in the coordinate system of |view|. | 78 // flipped point in the coordinate system of |view|. |
| 79 - (NSPoint)flipWindowPointToView:(const NSPoint&)windowPoint | 79 - (NSPoint)flipWindowPointToView:(const NSPoint&)windowPoint |
| 80 view:(NSView*)view; | 80 view:(NSView*)view; |
| 81 // Given a point in window coordinates and a view in that window, return a | 81 // Given a point in window coordinates and a view in that window, return a |
| 82 // flipped point in screen coordinates. | 82 // flipped point in screen coordinates. |
| 83 - (NSPoint)flipWindowPointToScreen:(const NSPoint&)windowPoint | 83 - (NSPoint)flipWindowPointToScreen:(const NSPoint&)windowPoint |
| 84 view:(NSView*)view; | 84 view:(NSView*)view; |
| 85 @end | 85 @end |
| OLD | NEW |