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

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

Issue 2580843003: Prevent drag-and-drop events from firing over cross-site, same-page frames. (Mac) (Closed)
Patch Set: Added initialization. Created 4 years 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/browser/loader/global_routing_id.h"
10 #include "content/common/content_export.h" 11 #include "content/common/content_export.h"
11 #include "content/public/common/drop_data.h" 12 #include "content/public/common/drop_data.h"
12 #include "ui/gfx/geometry/point.h" 13 #include "ui/gfx/geometry/point.h"
13 14
14 namespace content { 15 namespace content {
15 class RenderViewHost; 16 class RenderViewHost;
16 class RenderWidgetHostImpl; 17 class RenderWidgetHostImpl;
17 class WebContentsImpl; 18 class WebContentsImpl;
18 class WebDragDestDelegate; 19 class WebDragDestDelegate;
19 } 20 }
(...skipping 17 matching lines...) Expand all
37 // allow the drop. 38 // allow the drop.
38 NSDragOperation currentOperation_; 39 NSDragOperation currentOperation_;
39 40
40 // Tracks the current RenderWidgetHost we're dragging over. 41 // Tracks the current RenderWidgetHost we're dragging over.
41 base::WeakPtr<content::RenderWidgetHostImpl> currentRWHForDrag_; 42 base::WeakPtr<content::RenderWidgetHostImpl> currentRWHForDrag_;
42 43
43 // Keep track of the render view host we're dragging over. If it changes 44 // Keep track of the render view host we're dragging over. If it changes
44 // during a drag, we need to re-send the DragEnter message. 45 // during a drag, we need to re-send the DragEnter message.
45 RenderViewHostIdentifier currentRVH_; 46 RenderViewHostIdentifier currentRVH_;
46 47
48 // Tracks the IDs of the source RenderProcessHost and RenderViewHost from
49 // which the current drag originated. These are set in setDragStartTrackers(),
Avi (use Gerrit) 2016/12/15 19:40:08 "....These are set in -setDragStartTrackersForProc
paulmeyer 2016/12/15 20:02:51 Done.
50 // and are used to ensure that drag events do not fire over a cross-site frame
51 // (with respect to the source frame) in the same page (see crbug.com/666858).
52 // See WebContentsViewAura::drag_start_process_id_ for additional information.
53 int dragStartProcessID_;
54 content::GlobalRoutingID dragStartViewID_;
55
47 // The data for the current drag, or NULL if none is in progress. 56 // The data for the current drag, or NULL if none is in progress.
48 std::unique_ptr<content::DropData> dropData_; 57 std::unique_ptr<content::DropData> dropData_;
49 58
50 // True if the drag has been canceled. 59 // True if the drag has been canceled.
51 bool canceled_; 60 bool canceled_;
52 } 61 }
53 62
54 // |contents| is the WebContentsImpl representing this tab, used to communicate 63 // |contents| is the WebContentsImpl representing this tab, used to communicate
55 // drag&drop messages to WebCore and handle navigation on a successful drop 64 // drag&drop messages to WebCore and handle navigation on a successful drop
56 // (if necessary). 65 // (if necessary).
(...skipping 15 matching lines...) Expand all
72 - (void)draggingExited:(id<NSDraggingInfo>)info; 81 - (void)draggingExited:(id<NSDraggingInfo>)info;
73 - (NSDragOperation)draggingUpdated:(id<NSDraggingInfo>)info 82 - (NSDragOperation)draggingUpdated:(id<NSDraggingInfo>)info
74 view:(NSView*)view; 83 view:(NSView*)view;
75 - (BOOL)performDragOperation:(id<NSDraggingInfo>)info view:(NSView*)view; 84 - (BOOL)performDragOperation:(id<NSDraggingInfo>)info view:(NSView*)view;
76 85
77 // Helper to call WebWidgetHostInputEventRouter::GetRenderWidgetHostAtPoint(). 86 // Helper to call WebWidgetHostInputEventRouter::GetRenderWidgetHostAtPoint().
78 - (content::RenderWidgetHostImpl*) 87 - (content::RenderWidgetHostImpl*)
79 GetRenderWidgetHostAtPoint:(const NSPoint&)viewPoint 88 GetRenderWidgetHostAtPoint:(const NSPoint&)viewPoint
80 transformedPt:(gfx::Point*)transformedPt; 89 transformedPt:(gfx::Point*)transformedPt;
81 90
91 // Sets |dragStartProcessID_| and |dragStartViewID_|.
92 - (void)setDragStartTrackers:(int)processID;
Avi (use Gerrit) 2016/12/15 19:40:08 setDragStartTrackersForProcess:(int)processID
paulmeyer 2016/12/15 20:02:51 Done.
93
94 // Returns whether |targetRWH| is a valid RenderWidgetHost to be dragging
95 // over. This enforces that same-page, cross-site drags are not allowed. See
96 // crbug.com/666858.
97 - (bool)isValidDragTarget:(content::RenderWidgetHostImpl*)targetRWH;
98
82 @end 99 @end
83 100
84 // Public use only for unit tests. 101 // Public use only for unit tests.
85 @interface WebDragDest(Testing) 102 @interface WebDragDest(Testing)
86 // Given |data|, which should not be nil, fill it in using the contents of the 103 // Given |data|, which should not be nil, fill it in using the contents of the
87 // given pasteboard. 104 // given pasteboard.
88 - (void)populateDropData:(content::DropData*)data 105 - (void)populateDropData:(content::DropData*)data
89 fromPasteboard:(NSPasteboard*)pboard; 106 fromPasteboard:(NSPasteboard*)pboard;
90 // Given a point in window coordinates and a view in that window, return a 107 // Given a point in window coordinates and a view in that window, return a
91 // flipped point in the coordinate system of |view|. 108 // flipped point in the coordinate system of |view|.
92 - (NSPoint)flipWindowPointToView:(const NSPoint&)windowPoint 109 - (NSPoint)flipWindowPointToView:(const NSPoint&)windowPoint
93 view:(NSView*)view; 110 view:(NSView*)view;
94 // Given a point in window coordinates and a view in that window, return a 111 // Given a point in window coordinates and a view in that window, return a
95 // flipped point in screen coordinates. 112 // flipped point in screen coordinates.
96 - (NSPoint)flipWindowPointToScreen:(const NSPoint&)windowPoint 113 - (NSPoint)flipWindowPointToScreen:(const NSPoint&)windowPoint
97 view:(NSView*)view; 114 view:(NSView*)view;
98 @end 115 @end
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_view_mac.mm ('k') | content/browser/web_contents/web_drag_dest_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698