Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: content/browser/web_contents/web_drag_dest_mac.h

Issue 2509933002: Drag-and-drop: Target drag messages (the sequel). (Closed)
Patch Set: Addressed comments. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "ui/gfx/geometry/point.h"
12 13
13 namespace content { 14 namespace content {
15 class RenderWidgetHostImpl;
14 class RenderViewHost; 16 class RenderViewHost;
Avi (use Gerrit) 2016/11/17 19:39:23 v < w
paulmeyer 2016/11/17 20:46:43 Done.
15 class WebContentsImpl; 17 class WebContentsImpl;
16 class WebDragDestDelegate; 18 class WebDragDestDelegate;
17 } 19 }
18 20
19 // A typedef for a RenderViewHost used for comparison purposes only. 21 // A typedef for a RenderViewHost used for comparison purposes only.
20 typedef content::RenderViewHost* RenderViewHostIdentifier; 22 typedef content::RenderViewHost* RenderViewHostIdentifier;
21 23
22 // A class that handles tracking and event processing for a drag and drop 24 // 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 25 // over the content area. Assumes something else initiates the drag, this is
24 // only for processing during a drag. 26 // only for processing during a drag.
25 CONTENT_EXPORT 27 CONTENT_EXPORT
26 @interface WebDragDest : NSObject { 28 @interface WebDragDest : NSObject {
27 @private 29 @private
28 // Our associated WebContentsImpl. Weak reference. 30 // Our associated WebContentsImpl. Weak reference.
29 content::WebContentsImpl* webContents_; 31 content::WebContentsImpl* webContents_;
30 32
31 // Delegate; weak. 33 // Delegate; weak.
32 content::WebDragDestDelegate* delegate_; 34 content::WebDragDestDelegate* delegate_;
33 35
34 // Updated asynchronously during a drag to tell us whether or not we should 36 // Updated asynchronously during a drag to tell us whether or not we should
35 // allow the drop. 37 // allow the drop.
36 NSDragOperation currentOperation_; 38 NSDragOperation currentOperation_;
37 39
40 // Tracks the current RenderWidgetHost we're dragging over.
41 base::WeakPtr<content::RenderWidgetHostImpl> currentRWHForDrag_;
42
38 // Keep track of the render view host we're dragging over. If it changes 43 // 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. 44 // during a drag, we need to re-send the DragEnter message.
40 RenderViewHostIdentifier currentRVH_; 45 RenderViewHostIdentifier currentRVH_;
41 46
42 // The data for the current drag, or NULL if none is in progress. 47 // The data for the current drag, or NULL if none is in progress.
43 std::unique_ptr<content::DropData> dropData_; 48 std::unique_ptr<content::DropData> dropData_;
44 49
45 // True if the drag has been canceled. 50 // True if the drag has been canceled.
46 bool canceled_; 51 bool canceled_;
47 } 52 }
(...skipping 12 matching lines...) Expand all
60 // next time |-draggingUpdated:| is called. 65 // next time |-draggingUpdated:| is called.
61 - (void)setCurrentOperation:(NSDragOperation)operation; 66 - (void)setCurrentOperation:(NSDragOperation)operation;
62 67
63 // Messages to send during the tracking of a drag, ususally upon receiving 68 // Messages to send during the tracking of a drag, ususally upon receiving
64 // calls from the view system. Communicates the drag messages to WebCore. 69 // calls from the view system. Communicates the drag messages to WebCore.
65 - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)info 70 - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)info
66 view:(NSView*)view; 71 view:(NSView*)view;
67 - (void)draggingExited:(id<NSDraggingInfo>)info; 72 - (void)draggingExited:(id<NSDraggingInfo>)info;
68 - (NSDragOperation)draggingUpdated:(id<NSDraggingInfo>)info 73 - (NSDragOperation)draggingUpdated:(id<NSDraggingInfo>)info
69 view:(NSView*)view; 74 view:(NSView*)view;
70 - (BOOL)performDragOperation:(id<NSDraggingInfo>)info 75 - (BOOL)performDragOperation:(id<NSDraggingInfo>)info view:(NSView*)view;
71 view:(NSView*)view; 76
77 // Helper to call WebWidgetHostInputEventRouter::GetRenderWidgetHostAtPoint().
78 - (content::RenderWidgetHostImpl*)
79 GetRenderWidgetHostAtPoint:(const NSPoint&)viewPoint
80 transformedPt:(gfx::Point*)transformedPt;
72 81
73 @end 82 @end
74 83
75 // Public use only for unit tests. 84 // Public use only for unit tests.
76 @interface WebDragDest(Testing) 85 @interface WebDragDest(Testing)
77 // Given |data|, which should not be nil, fill it in using the contents of the 86 // Given |data|, which should not be nil, fill it in using the contents of the
78 // given pasteboard. 87 // given pasteboard.
79 - (void)populateDropData:(content::DropData*)data 88 - (void)populateDropData:(content::DropData*)data
80 fromPasteboard:(NSPasteboard*)pboard; 89 fromPasteboard:(NSPasteboard*)pboard;
81 // Given a point in window coordinates and a view in that window, return a 90 // Given a point in window coordinates and a view in that window, return a
82 // flipped point in the coordinate system of |view|. 91 // flipped point in the coordinate system of |view|.
83 - (NSPoint)flipWindowPointToView:(const NSPoint&)windowPoint 92 - (NSPoint)flipWindowPointToView:(const NSPoint&)windowPoint
84 view:(NSView*)view; 93 view:(NSView*)view;
85 // Given a point in window coordinates and a view in that window, return a 94 // Given a point in window coordinates and a view in that window, return a
86 // flipped point in screen coordinates. 95 // flipped point in screen coordinates.
87 - (NSPoint)flipWindowPointToScreen:(const NSPoint&)windowPoint 96 - (NSPoint)flipWindowPointToScreen:(const NSPoint&)windowPoint
88 view:(NSView*)view; 97 view:(NSView*)view;
89 @end 98 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698