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