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

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

Issue 2568893002: Prevent drag-and-drop events from firing over cross-site, same-page frames. (Closed)
Patch Set: Addressed comments. 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 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_
6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 void CompleteOverscrollNavigation(OverscrollMode mode); 80 void CompleteOverscrollNavigation(OverscrollMode mode);
81 81
82 void OverscrollUpdateForWebContentsDelegate(float delta_y); 82 void OverscrollUpdateForWebContentsDelegate(float delta_y);
83 83
84 ui::TouchSelectionController* GetSelectionController() const; 84 ui::TouchSelectionController* GetSelectionController() const;
85 TouchSelectionControllerClientAura* GetSelectionControllerClient() const; 85 TouchSelectionControllerClientAura* GetSelectionControllerClient() const;
86 86
87 // Returns GetNativeView unless overridden for testing. 87 // Returns GetNativeView unless overridden for testing.
88 gfx::NativeView GetRenderWidgetHostViewParent() const; 88 gfx::NativeView GetRenderWidgetHostViewParent() const;
89 89
90 // Returns whether |target_rwh| is a valid RenderWidgetHost to be dragging
91 // over. This enforces that same-page, cross-site drags are not allowed. See
92 // crbug.com/666858.
93 bool ValidDragTarget(RenderWidgetHostImpl* target_rwh) const;
Charlie Reis 2016/12/14 18:06:50 nit: IsValidDragTarget
paulmeyer 2016/12/14 18:27:49 Done.
94
90 // Overridden from WebContentsView: 95 // Overridden from WebContentsView:
91 gfx::NativeView GetNativeView() const override; 96 gfx::NativeView GetNativeView() const override;
92 gfx::NativeView GetContentNativeView() const override; 97 gfx::NativeView GetContentNativeView() const override;
93 gfx::NativeWindow GetTopLevelNativeWindow() const override; 98 gfx::NativeWindow GetTopLevelNativeWindow() const override;
94 void GetScreenInfo(ScreenInfo* screen_info) const override; 99 void GetScreenInfo(ScreenInfo* screen_info) const override;
95 void GetContainerBounds(gfx::Rect* out) const override; 100 void GetContainerBounds(gfx::Rect* out) const override;
96 void SizeContents(const gfx::Size& size) override; 101 void SizeContents(const gfx::Size& size) override;
97 void Focus() override; 102 void Focus() override;
98 void SetInitialFocus() override; 103 void SetInitialFocus() override;
99 void StoreFocus() override; 104 void StoreFocus() override;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 blink::WebDragOperationsMask current_drag_op_; 196 blink::WebDragOperationsMask current_drag_op_;
192 197
193 std::unique_ptr<DropData> current_drop_data_; 198 std::unique_ptr<DropData> current_drop_data_;
194 199
195 WebDragDestDelegate* drag_dest_delegate_; 200 WebDragDestDelegate* drag_dest_delegate_;
196 201
197 // We keep track of the RenderWidgetHost we're dragging over. If it changes 202 // We keep track of the RenderWidgetHost we're dragging over. If it changes
198 // during a drag, we need to re-send the DragEnter message. 203 // during a drag, we need to re-send the DragEnter message.
199 base::WeakPtr<RenderWidgetHostImpl> current_rwh_for_drag_; 204 base::WeakPtr<RenderWidgetHostImpl> current_rwh_for_drag_;
200 205
201 // We also keep track of the RenderViewHost we're dragging over to avoid 206 // We also keep track of the ID of the RenderViewHost we're dragging over to
Charlie Reis 2016/12/13 23:01:16 Please elaborate in both comments what each int in
Łukasz Anforowicz 2016/12/13 23:07:24 Not sure if it is applicable here + don't want to
Charlie Reis 2016/12/14 18:06:50 That's a good idea-- let's use that. (Looks like
paulmeyer 2016/12/14 18:27:48 Okay, GlobalRoutingID seems like a better thing to
202 // sending the drag exited message after leaving the current 207 // avoid sending the drag exited message after leaving the current view.
203 // view. |current_rvh_for_drag_| should not be dereferenced. 208 std::pair<int, int> current_rvh_for_drag_;
204 void* current_rvh_for_drag_; 209
210 // We track the IDs of the source RenderProcessHost and RenderViewHost from
Charlie Reis 2016/12/13 23:01:16 Nasko brought up the question about why this isn't
paulmeyer 2016/12/14 18:27:48 RenderViewHost is tracked to check the "same-page"
211 // which the current drag originated. These are used to ensure that drag
212 // events do not fire over a cross-site frame in the same page (with respect
213 // to the source frame). See crbug.com/666858.
Charlie Reis 2016/12/14 18:06:50 We should also clarify that the RPH and RVH here m
paulmeyer 2016/12/14 18:27:48 Done.
214 int drag_source_rph_;
Charlie Reis 2016/12/13 23:01:16 It's hard to tell from the name what this is. May
paulmeyer 2016/12/14 18:27:48 Actually, I noticed there are some other uses of t
Charlie Reis 2016/12/14 18:36:36 Acknowledged.
215 std::pair<int, int> drag_source_rvh_;
Charlie Reis 2016/12/13 23:01:16 drag_source_view_ids_?
Charlie Reis 2016/12/14 18:06:50 Or drag_source_view_global_routing_id_.
paulmeyer 2016/12/14 18:27:48 Renamed to drag_start_view_id_.
205 216
206 // The overscroll gesture currently in progress. 217 // The overscroll gesture currently in progress.
207 OverscrollMode current_overscroll_gesture_; 218 OverscrollMode current_overscroll_gesture_;
208 219
209 // This is the completed overscroll gesture. This is used for the animation 220 // This is the completed overscroll gesture. This is used for the animation
210 // callback that happens in response to a completed overscroll gesture. 221 // callback that happens in response to a completed overscroll gesture.
211 OverscrollMode completed_overscroll_gesture_; 222 OverscrollMode completed_overscroll_gesture_;
212 223
213 // This manages the overlay window that shows the screenshot during a history 224 // This manages the overlay window that shows the screenshot during a history
214 // navigation triggered by the overscroll gesture. 225 // navigation triggered by the overscroll gesture.
215 std::unique_ptr<OverscrollNavigationOverlay> navigation_overlay_; 226 std::unique_ptr<OverscrollNavigationOverlay> navigation_overlay_;
216 227
217 std::unique_ptr<GestureNavSimple> gesture_nav_simple_; 228 std::unique_ptr<GestureNavSimple> gesture_nav_simple_;
218 229
219 bool init_rwhv_with_null_parent_for_testing_; 230 bool init_rwhv_with_null_parent_for_testing_;
220 231
221 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAura); 232 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAura);
222 }; 233 };
223 234
224 } // namespace content 235 } // namespace content
225 236
226 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ 237 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698