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 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 public aura::WindowDelegate, | 46 public aura::WindowDelegate, |
47 public aura::client::DragDropDelegate, | 47 public aura::client::DragDropDelegate, |
48 public aura::WindowObserver { | 48 public aura::WindowObserver { |
49 public: | 49 public: |
50 WebContentsViewAura(WebContentsImpl* web_contents, | 50 WebContentsViewAura(WebContentsImpl* web_contents, |
51 WebContentsViewDelegate* delegate); | 51 WebContentsViewDelegate* delegate); |
52 | 52 |
53 // Allow the WebContentsViewDelegate to be set explicitly. | 53 // Allow the WebContentsViewDelegate to be set explicitly. |
54 void SetDelegateForTesting(WebContentsViewDelegate* delegate); | 54 void SetDelegateForTesting(WebContentsViewDelegate* delegate); |
55 | 55 |
| 56 // Set a flag to pass nullptr as the parent_view argument to |
| 57 // RenderWidgetHostViewAura::InitAsChild(). |
| 58 void set_init_rwhv_with_null_parent_for_testing(bool set) { |
| 59 init_rwhv_with_null_parent_for_testing_ = set; |
| 60 } |
| 61 |
56 private: | 62 private: |
57 class WindowObserver; | 63 class WindowObserver; |
58 | 64 |
59 ~WebContentsViewAura() override; | 65 ~WebContentsViewAura() override; |
60 | 66 |
61 void SizeChangedCommon(const gfx::Size& size); | 67 void SizeChangedCommon(const gfx::Size& size); |
62 | 68 |
63 void EndDrag(blink::WebDragOperationsMask ops); | 69 void EndDrag(blink::WebDragOperationsMask ops); |
64 | 70 |
65 void InstallOverscrollControllerDelegate(RenderWidgetHostViewAura* view); | 71 void InstallOverscrollControllerDelegate(RenderWidgetHostViewAura* view); |
66 | 72 |
67 // Sets up the content window in preparation for starting an overscroll | 73 // Sets up the content window in preparation for starting an overscroll |
68 // gesture. | 74 // gesture. |
69 void PrepareContentWindowForOverscroll(); | 75 void PrepareContentWindowForOverscroll(); |
70 | 76 |
71 // Completes the navigation in response to a completed overscroll gesture. | 77 // Completes the navigation in response to a completed overscroll gesture. |
72 // The navigation happens after an animation (either the overlay window | 78 // The navigation happens after an animation (either the overlay window |
73 // animates in, or the content window animates out). | 79 // animates in, or the content window animates out). |
74 void CompleteOverscrollNavigation(OverscrollMode mode); | 80 void CompleteOverscrollNavigation(OverscrollMode mode); |
75 | 81 |
76 void OverscrollUpdateForWebContentsDelegate(float delta_y); | 82 void OverscrollUpdateForWebContentsDelegate(float delta_y); |
77 | 83 |
78 ui::TouchSelectionController* GetSelectionController() const; | 84 ui::TouchSelectionController* GetSelectionController() const; |
79 TouchSelectionControllerClientAura* GetSelectionControllerClient() const; | 85 TouchSelectionControllerClientAura* GetSelectionControllerClient() const; |
80 | 86 |
| 87 // Returns GetNativeView unless overridden for testing. |
| 88 gfx::NativeView GetRenderWidgetHostViewParent() const; |
| 89 |
81 // Overridden from WebContentsView: | 90 // Overridden from WebContentsView: |
82 gfx::NativeView GetNativeView() const override; | 91 gfx::NativeView GetNativeView() const override; |
83 gfx::NativeView GetContentNativeView() const override; | 92 gfx::NativeView GetContentNativeView() const override; |
84 gfx::NativeWindow GetTopLevelNativeWindow() const override; | 93 gfx::NativeWindow GetTopLevelNativeWindow() const override; |
85 void GetContainerBounds(gfx::Rect* out) const override; | 94 void GetContainerBounds(gfx::Rect* out) const override; |
86 void SizeContents(const gfx::Size& size) override; | 95 void SizeContents(const gfx::Size& size) override; |
87 void Focus() override; | 96 void Focus() override; |
88 void SetInitialFocus() override; | 97 void SetInitialFocus() override; |
89 void StoreFocus() override; | 98 void StoreFocus() override; |
90 void RestoreFocus() override; | 99 void RestoreFocus() override; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 // This is the completed overscroll gesture. This is used for the animation | 192 // This is the completed overscroll gesture. This is used for the animation |
184 // callback that happens in response to a completed overscroll gesture. | 193 // callback that happens in response to a completed overscroll gesture. |
185 OverscrollMode completed_overscroll_gesture_; | 194 OverscrollMode completed_overscroll_gesture_; |
186 | 195 |
187 // This manages the overlay window that shows the screenshot during a history | 196 // This manages the overlay window that shows the screenshot during a history |
188 // navigation triggered by the overscroll gesture. | 197 // navigation triggered by the overscroll gesture. |
189 std::unique_ptr<OverscrollNavigationOverlay> navigation_overlay_; | 198 std::unique_ptr<OverscrollNavigationOverlay> navigation_overlay_; |
190 | 199 |
191 std::unique_ptr<GestureNavSimple> gesture_nav_simple_; | 200 std::unique_ptr<GestureNavSimple> gesture_nav_simple_; |
192 | 201 |
| 202 bool init_rwhv_with_null_parent_for_testing_; |
| 203 |
193 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAura); | 204 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAura); |
194 }; | 205 }; |
195 | 206 |
196 } // namespace content | 207 } // namespace content |
197 | 208 |
198 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ | 209 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ |
OLD | NEW |