| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "content/public/common/drop_data.h" | 11 #include "content/public/common/drop_data.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 class RenderWidgetHostImpl; |
| 14 class RenderViewHost; | 15 class RenderViewHost; |
| 15 class WebContentsImpl; | 16 class WebContentsImpl; |
| 16 class WebDragDestDelegate; | 17 class WebDragDestDelegate; |
| 17 } | 18 } |
| 18 | 19 |
| 19 // A typedef for a RenderViewHost used for comparison purposes only. | 20 // A typedef for a RenderViewHost used for comparison purposes only. |
| 20 typedef content::RenderViewHost* RenderViewHostIdentifier; | 21 typedef content::RenderViewHost* RenderViewHostIdentifier; |
| 21 | 22 |
| 22 // A class that handles tracking and event processing for a drag and drop | 23 // A class that handles tracking and event processing for a drag and drop |
| 23 // over the content area. Assumes something else initiates the drag, this is | 24 // over the content area. Assumes something else initiates the drag, this is |
| 24 // only for processing during a drag. | 25 // only for processing during a drag. |
| 25 CONTENT_EXPORT | 26 CONTENT_EXPORT |
| 26 @interface WebDragDest : NSObject { | 27 @interface WebDragDest : NSObject { |
| 27 @private | 28 @private |
| 28 // Our associated WebContentsImpl. Weak reference. | 29 // Our associated WebContentsImpl. Weak reference. |
| 29 content::WebContentsImpl* webContents_; | 30 content::WebContentsImpl* webContents_; |
| 30 | 31 |
| 31 // Delegate; weak. | 32 // Delegate; weak. |
| 32 content::WebDragDestDelegate* delegate_; | 33 content::WebDragDestDelegate* delegate_; |
| 33 | 34 |
| 34 // Updated asynchronously during a drag to tell us whether or not we should | 35 // Updated asynchronously during a drag to tell us whether or not we should |
| 35 // allow the drop. | 36 // allow the drop. |
| 36 NSDragOperation currentOperation_; | 37 NSDragOperation currentOperation_; |
| 37 | 38 |
| 39 // Tracks the current RenderWidgetHost we're dragging over. |
| 40 base::WeakPtr<content::RenderWidgetHostImpl> currentRWHForDrag_; |
| 41 |
| 38 // Keep track of the render view host we're dragging over. If it changes | 42 // 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. | 43 // during a drag, we need to re-send the DragEnter message. |
| 40 RenderViewHostIdentifier currentRVH_; | 44 RenderViewHostIdentifier currentRVH_; |
| 41 | 45 |
| 42 // The data for the current drag, or NULL if none is in progress. | 46 // The data for the current drag, or NULL if none is in progress. |
| 43 std::unique_ptr<content::DropData> dropData_; | 47 std::unique_ptr<content::DropData> dropData_; |
| 44 | 48 |
| 45 // True if the drag has been canceled. | 49 // True if the drag has been canceled. |
| 46 bool canceled_; | 50 bool canceled_; |
| 47 } | 51 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 fromPasteboard:(NSPasteboard*)pboard; | 84 fromPasteboard:(NSPasteboard*)pboard; |
| 81 // Given a point in window coordinates and a view in that window, return a | 85 // Given a point in window coordinates and a view in that window, return a |
| 82 // flipped point in the coordinate system of |view|. | 86 // flipped point in the coordinate system of |view|. |
| 83 - (NSPoint)flipWindowPointToView:(const NSPoint&)windowPoint | 87 - (NSPoint)flipWindowPointToView:(const NSPoint&)windowPoint |
| 84 view:(NSView*)view; | 88 view:(NSView*)view; |
| 85 // Given a point in window coordinates and a view in that window, return a | 89 // Given a point in window coordinates and a view in that window, return a |
| 86 // flipped point in screen coordinates. | 90 // flipped point in screen coordinates. |
| 87 - (NSPoint)flipWindowPointToScreen:(const NSPoint&)windowPoint | 91 - (NSPoint)flipWindowPointToScreen:(const NSPoint&)windowPoint |
| 88 view:(NSView*)view; | 92 view:(NSView*)view; |
| 89 @end | 93 @end |
| OLD | NEW |