| 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 #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 |
| 11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "content/browser/loader/global_routing_id.h" |
| 15 #include "content/browser/renderer_host/overscroll_controller_delegate.h" | 16 #include "content/browser/renderer_host/overscroll_controller_delegate.h" |
| 16 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 17 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
| 17 #include "content/browser/web_contents/web_contents_view.h" | 18 #include "content/browser/web_contents/web_contents_view.h" |
| 18 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
| 19 #include "ui/aura/client/drag_drop_delegate.h" | 20 #include "ui/aura/client/drag_drop_delegate.h" |
| 20 #include "ui/aura/window_delegate.h" | 21 #include "ui/aura/window_delegate.h" |
| 21 #include "ui/aura/window_observer.h" | 22 #include "ui/aura/window_observer.h" |
| 22 | 23 |
| 23 namespace aura { | 24 namespace aura { |
| 24 class Window; | 25 class Window; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 void CompleteOverscrollNavigation(OverscrollMode mode); | 81 void CompleteOverscrollNavigation(OverscrollMode mode); |
| 81 | 82 |
| 82 void OverscrollUpdateForWebContentsDelegate(float delta_y); | 83 void OverscrollUpdateForWebContentsDelegate(float delta_y); |
| 83 | 84 |
| 84 ui::TouchSelectionController* GetSelectionController() const; | 85 ui::TouchSelectionController* GetSelectionController() const; |
| 85 TouchSelectionControllerClientAura* GetSelectionControllerClient() const; | 86 TouchSelectionControllerClientAura* GetSelectionControllerClient() const; |
| 86 | 87 |
| 87 // Returns GetNativeView unless overridden for testing. | 88 // Returns GetNativeView unless overridden for testing. |
| 88 gfx::NativeView GetRenderWidgetHostViewParent() const; | 89 gfx::NativeView GetRenderWidgetHostViewParent() const; |
| 89 | 90 |
| 91 // Returns whether |target_rwh| is a valid RenderWidgetHost to be dragging |
| 92 // over. This enforces that same-page, cross-site drags are not allowed. See |
| 93 // crbug.com/666858. |
| 94 bool IsValidDragTarget(RenderWidgetHostImpl* target_rwh) const; |
| 95 |
| 90 // Overridden from WebContentsView: | 96 // Overridden from WebContentsView: |
| 91 gfx::NativeView GetNativeView() const override; | 97 gfx::NativeView GetNativeView() const override; |
| 92 gfx::NativeView GetContentNativeView() const override; | 98 gfx::NativeView GetContentNativeView() const override; |
| 93 gfx::NativeWindow GetTopLevelNativeWindow() const override; | 99 gfx::NativeWindow GetTopLevelNativeWindow() const override; |
| 94 void GetScreenInfo(ScreenInfo* screen_info) const override; | 100 void GetScreenInfo(ScreenInfo* screen_info) const override; |
| 95 void GetContainerBounds(gfx::Rect* out) const override; | 101 void GetContainerBounds(gfx::Rect* out) const override; |
| 96 void SizeContents(const gfx::Size& size) override; | 102 void SizeContents(const gfx::Size& size) override; |
| 97 void Focus() override; | 103 void Focus() override; |
| 98 void SetInitialFocus() override; | 104 void SetInitialFocus() override; |
| 99 void StoreFocus() override; | 105 void StoreFocus() override; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 blink::WebDragOperationsMask current_drag_op_; | 197 blink::WebDragOperationsMask current_drag_op_; |
| 192 | 198 |
| 193 std::unique_ptr<DropData> current_drop_data_; | 199 std::unique_ptr<DropData> current_drop_data_; |
| 194 | 200 |
| 195 WebDragDestDelegate* drag_dest_delegate_; | 201 WebDragDestDelegate* drag_dest_delegate_; |
| 196 | 202 |
| 197 // We keep track of the RenderWidgetHost we're dragging over. If it changes | 203 // 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. | 204 // during a drag, we need to re-send the DragEnter message. |
| 199 base::WeakPtr<RenderWidgetHostImpl> current_rwh_for_drag_; | 205 base::WeakPtr<RenderWidgetHostImpl> current_rwh_for_drag_; |
| 200 | 206 |
| 201 // We also keep track of the RenderViewHost we're dragging over to avoid | 207 // We also keep track of the ID of the RenderViewHost we're dragging over to |
| 202 // sending the drag exited message after leaving the current | 208 // avoid sending the drag exited message after leaving the current view. |
| 203 // view. |current_rvh_for_drag_| should not be dereferenced. | 209 GlobalRoutingID current_rvh_for_drag_; |
| 204 void* current_rvh_for_drag_; | 210 |
| 211 // We track the IDs of the source RenderProcessHost and RenderViewHost from |
| 212 // which the current drag originated. These are used to ensure that drag |
| 213 // events do not fire over a cross-site frame (with respect to the source |
| 214 // frame) in the same page (see crbug.com/666858). Specifically, the |
| 215 // RenderViewHost is used to check the "same page" property, while the |
| 216 // RenderProcessHost is used to check the "cross-site" property. Note that the |
| 217 // reason the RenderProcessHost is tracked instead of the RenderWidgetHost is |
| 218 // so that we still allow drags between non-contiguous same-site frames (such |
| 219 // frames will have the same process, but different widgets). Note also that |
| 220 // the RenderViewHost may not be in the same process as the RenderProcessHost, |
| 221 // since the view corresponds to the page, while the process is specific to |
| 222 // the frame from which the drag started. |
| 223 int drag_start_process_id_; |
| 224 GlobalRoutingID drag_start_view_id_; |
| 205 | 225 |
| 206 // The overscroll gesture currently in progress. | 226 // The overscroll gesture currently in progress. |
| 207 OverscrollMode current_overscroll_gesture_; | 227 OverscrollMode current_overscroll_gesture_; |
| 208 | 228 |
| 209 // This is the completed overscroll gesture. This is used for the animation | 229 // This is the completed overscroll gesture. This is used for the animation |
| 210 // callback that happens in response to a completed overscroll gesture. | 230 // callback that happens in response to a completed overscroll gesture. |
| 211 OverscrollMode completed_overscroll_gesture_; | 231 OverscrollMode completed_overscroll_gesture_; |
| 212 | 232 |
| 213 // This manages the overlay window that shows the screenshot during a history | 233 // This manages the overlay window that shows the screenshot during a history |
| 214 // navigation triggered by the overscroll gesture. | 234 // navigation triggered by the overscroll gesture. |
| 215 std::unique_ptr<OverscrollNavigationOverlay> navigation_overlay_; | 235 std::unique_ptr<OverscrollNavigationOverlay> navigation_overlay_; |
| 216 | 236 |
| 217 std::unique_ptr<GestureNavSimple> gesture_nav_simple_; | 237 std::unique_ptr<GestureNavSimple> gesture_nav_simple_; |
| 218 | 238 |
| 219 bool init_rwhv_with_null_parent_for_testing_; | 239 bool init_rwhv_with_null_parent_for_testing_; |
| 220 | 240 |
| 221 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAura); | 241 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAura); |
| 222 }; | 242 }; |
| 223 | 243 |
| 224 } // namespace content | 244 } // namespace content |
| 225 | 245 |
| 226 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ | 246 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ |
| OLD | NEW |