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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "content/browser/renderer_host/overscroll_controller_delegate.h" | 13 #include "content/browser/renderer_host/overscroll_controller_delegate.h" |
14 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 14 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
15 #include "content/browser/web_contents/web_contents_view.h" | 15 #include "content/browser/web_contents/web_contents_view.h" |
16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
17 #include "ui/aura/window_delegate.h" | 17 #include "ui/aura/window_delegate.h" |
18 #include "ui/aura/window_observer.h" | 18 #include "ui/aura/window_observer.h" |
19 #include "ui/wm/public/drag_drop_delegate.h" | 19 #include "ui/wm/public/drag_drop_delegate.h" |
20 | 20 |
21 namespace aura { | 21 namespace aura { |
22 class Window; | 22 class Window; |
23 } | 23 } |
24 | 24 |
25 namespace ui { | 25 namespace ui { |
26 class DropTargetEvent; | 26 class DropTargetEvent; |
| 27 class TouchSelectionController; |
27 } | 28 } |
28 | 29 |
29 namespace content { | 30 namespace content { |
30 class GestureNavSimple; | 31 class GestureNavSimple; |
31 class OverscrollNavigationOverlay; | 32 class OverscrollNavigationOverlay; |
32 class RenderWidgetHostImpl; | 33 class RenderWidgetHostImpl; |
33 class RenderWidgetHostViewAura; | 34 class RenderWidgetHostViewAura; |
34 class ShadowLayerDelegate; | 35 class ShadowLayerDelegate; |
35 class TouchEditableImplAura; | 36 class TouchSelectionControllerClientAura; |
36 class WebContentsViewDelegate; | 37 class WebContentsViewDelegate; |
37 class WebContentsImpl; | 38 class WebContentsImpl; |
38 class WebDragDestDelegate; | 39 class WebDragDestDelegate; |
39 | 40 |
40 class WebContentsViewAura | 41 class WebContentsViewAura |
41 : public WebContentsView, | 42 : public WebContentsView, |
42 public RenderViewHostDelegateView, | 43 public RenderViewHostDelegateView, |
43 public OverscrollControllerDelegate, | 44 public OverscrollControllerDelegate, |
44 public aura::WindowDelegate, | 45 public aura::WindowDelegate, |
45 public aura::client::DragDropDelegate, | 46 public aura::client::DragDropDelegate, |
46 public aura::WindowObserver { | 47 public aura::WindowObserver { |
47 public: | 48 public: |
48 WebContentsViewAura(WebContentsImpl* web_contents, | 49 WebContentsViewAura(WebContentsImpl* web_contents, |
49 WebContentsViewDelegate* delegate); | 50 WebContentsViewDelegate* delegate); |
50 | 51 |
51 CONTENT_EXPORT void SetTouchEditableForTest( | |
52 TouchEditableImplAura* touch_editable); | |
53 | |
54 private: | 52 private: |
55 class WindowObserver; | 53 class WindowObserver; |
56 | 54 |
57 ~WebContentsViewAura() override; | 55 ~WebContentsViewAura() override; |
58 | 56 |
59 void SizeChangedCommon(const gfx::Size& size); | 57 void SizeChangedCommon(const gfx::Size& size); |
60 | 58 |
61 void EndDrag(blink::WebDragOperationsMask ops); | 59 void EndDrag(blink::WebDragOperationsMask ops); |
62 | 60 |
63 void InstallOverscrollControllerDelegate(RenderWidgetHostViewAura* view); | 61 void InstallOverscrollControllerDelegate(RenderWidgetHostViewAura* view); |
64 | 62 |
65 // Sets up the content window in preparation for starting an overscroll | 63 // Sets up the content window in preparation for starting an overscroll |
66 // gesture. | 64 // gesture. |
67 void PrepareContentWindowForOverscroll(); | 65 void PrepareContentWindowForOverscroll(); |
68 | 66 |
69 // Completes the navigation in response to a completed overscroll gesture. | 67 // Completes the navigation in response to a completed overscroll gesture. |
70 // The navigation happens after an animation (either the overlay window | 68 // The navigation happens after an animation (either the overlay window |
71 // animates in, or the content window animates out). | 69 // animates in, or the content window animates out). |
72 void CompleteOverscrollNavigation(OverscrollMode mode); | 70 void CompleteOverscrollNavigation(OverscrollMode mode); |
73 | 71 |
74 void AttachTouchEditableToRenderView(); | 72 void OverscrollUpdateForWebContentsDelegate(float delta_y); |
75 | 73 |
76 void OverscrollUpdateForWebContentsDelegate(float delta_y); | 74 ui::TouchSelectionController* GetSelectionController() const; |
| 75 TouchSelectionControllerClientAura* GetSelectionControllerClient() const; |
77 | 76 |
78 // Overridden from WebContentsView: | 77 // Overridden from WebContentsView: |
79 gfx::NativeView GetNativeView() const override; | 78 gfx::NativeView GetNativeView() const override; |
80 gfx::NativeView GetContentNativeView() const override; | 79 gfx::NativeView GetContentNativeView() const override; |
81 gfx::NativeWindow GetTopLevelNativeWindow() const override; | 80 gfx::NativeWindow GetTopLevelNativeWindow() const override; |
82 void GetContainerBounds(gfx::Rect* out) const override; | 81 void GetContainerBounds(gfx::Rect* out) const override; |
83 void SizeContents(const gfx::Size& size) override; | 82 void SizeContents(const gfx::Size& size) override; |
84 void Focus() override; | 83 void Focus() override; |
85 void SetInitialFocus() override; | 84 void SetInitialFocus() override; |
86 void StoreFocus() override; | 85 void StoreFocus() override; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 OverscrollMode current_overscroll_gesture_; | 186 OverscrollMode current_overscroll_gesture_; |
188 | 187 |
189 // This is the completed overscroll gesture. This is used for the animation | 188 // This is the completed overscroll gesture. This is used for the animation |
190 // callback that happens in response to a completed overscroll gesture. | 189 // callback that happens in response to a completed overscroll gesture. |
191 OverscrollMode completed_overscroll_gesture_; | 190 OverscrollMode completed_overscroll_gesture_; |
192 | 191 |
193 // This manages the overlay window that shows the screenshot during a history | 192 // This manages the overlay window that shows the screenshot during a history |
194 // navigation triggered by the overscroll gesture. | 193 // navigation triggered by the overscroll gesture. |
195 scoped_ptr<OverscrollNavigationOverlay> navigation_overlay_; | 194 scoped_ptr<OverscrollNavigationOverlay> navigation_overlay_; |
196 | 195 |
197 scoped_ptr<TouchEditableImplAura> touch_editable_; | |
198 scoped_ptr<GestureNavSimple> gesture_nav_simple_; | 196 scoped_ptr<GestureNavSimple> gesture_nav_simple_; |
199 | 197 |
200 // On Windows we can run into problems if resources get released within the | 198 // On Windows we can run into problems if resources get released within the |
201 // initialization phase while the content (and its dimensions) are not known. | 199 // initialization phase while the content (and its dimensions) are not known. |
202 bool is_or_was_visible_; | 200 bool is_or_was_visible_; |
203 | 201 |
204 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAura); | 202 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAura); |
205 }; | 203 }; |
206 | 204 |
207 } // namespace content | 205 } // namespace content |
208 | 206 |
209 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ | 207 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ |
OLD | NEW |