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/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "content/browser/renderer_host/overscroll_controller_delegate.h" | 12 #include "content/browser/renderer_host/overscroll_controller_delegate.h" |
13 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 13 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
14 #include "content/browser/web_contents/web_contents_view.h" | 14 #include "content/browser/web_contents/web_contents_view.h" |
15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
16 #include "ui/aura/window_delegate.h" | 16 #include "ui/aura/window_delegate.h" |
17 #include "ui/aura/window_observer.h" | 17 #include "ui/aura/window_observer.h" |
18 #include "ui/compositor/layer_animation_observer.h" | 18 #include "ui/compositor/layer_animation_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 TouchSelectionControllerAura; |
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 WebContentsViewDelegate; | 36 class WebContentsViewDelegate; |
37 class WebContentsImpl; | 37 class WebContentsImpl; |
38 class WebDragDestDelegate; | 38 class WebDragDestDelegate; |
39 | 39 |
40 class WebContentsViewAura | 40 class WebContentsViewAura |
41 : public WebContentsView, | 41 : public WebContentsView, |
42 public RenderViewHostDelegateView, | 42 public RenderViewHostDelegateView, |
43 public OverscrollControllerDelegate, | 43 public OverscrollControllerDelegate, |
44 public ui::ImplicitAnimationObserver, | 44 public ui::ImplicitAnimationObserver, |
45 public aura::WindowDelegate, | 45 public aura::WindowDelegate, |
46 public aura::client::DragDropDelegate, | 46 public aura::client::DragDropDelegate, |
47 public aura::WindowObserver { | 47 public aura::WindowObserver { |
48 public: | 48 public: |
49 WebContentsViewAura(WebContentsImpl* web_contents, | 49 WebContentsViewAura(WebContentsImpl* web_contents, |
50 WebContentsViewDelegate* delegate); | 50 WebContentsViewDelegate* delegate); |
51 | 51 |
52 CONTENT_EXPORT void SetTouchEditableForTest( | |
53 TouchEditableImplAura* touch_editable); | |
54 | |
55 private: | 52 private: |
56 class WindowObserver; | 53 class WindowObserver; |
57 | 54 |
58 ~WebContentsViewAura() override; | 55 ~WebContentsViewAura() override; |
59 | 56 |
60 void SizeChangedCommon(const gfx::Size& size); | 57 void SizeChangedCommon(const gfx::Size& size); |
61 | 58 |
62 void EndDrag(blink::WebDragOperationsMask ops); | 59 void EndDrag(blink::WebDragOperationsMask ops); |
63 | 60 |
64 void InstallOverscrollControllerDelegate(RenderWidgetHostViewAura* view); | 61 void InstallOverscrollControllerDelegate(RenderWidgetHostViewAura* view); |
(...skipping 26 matching lines...) Expand all Loading... |
91 gfx::Vector2dF GetTranslationForOverscroll(float delta_x, float delta_y); | 88 gfx::Vector2dF GetTranslationForOverscroll(float delta_x, float delta_y); |
92 | 89 |
93 // A window showing the screenshot is overlayed during a navigation triggered | 90 // A window showing the screenshot is overlayed during a navigation triggered |
94 // by overscroll. This function sets this up. | 91 // by overscroll. This function sets this up. |
95 void PrepareOverscrollNavigationOverlay(); | 92 void PrepareOverscrollNavigationOverlay(); |
96 | 93 |
97 // Changes the brightness of the layer depending on the amount of horizontal | 94 // Changes the brightness of the layer depending on the amount of horizontal |
98 // overscroll (|delta_x|, in pixels). | 95 // overscroll (|delta_x|, in pixels). |
99 void UpdateOverscrollWindowBrightness(float delta_x); | 96 void UpdateOverscrollWindowBrightness(float delta_x); |
100 | 97 |
101 void AttachTouchEditableToRenderView(); | 98 void OverscrollUpdateForWebContentsDelegate(float delta_y); |
102 | 99 |
103 void OverscrollUpdateForWebContentsDelegate(float delta_y); | 100 ui::TouchSelectionControllerAura* GetSelectionController(); |
104 | 101 |
105 // Overridden from WebContentsView: | 102 // Overridden from WebContentsView: |
106 gfx::NativeView GetNativeView() const override; | 103 gfx::NativeView GetNativeView() const override; |
107 gfx::NativeView GetContentNativeView() const override; | 104 gfx::NativeView GetContentNativeView() const override; |
108 gfx::NativeWindow GetTopLevelNativeWindow() const override; | 105 gfx::NativeWindow GetTopLevelNativeWindow() const override; |
109 void GetContainerBounds(gfx::Rect* out) const override; | 106 void GetContainerBounds(gfx::Rect* out) const override; |
110 void SizeContents(const gfx::Size& size) override; | 107 void SizeContents(const gfx::Size& size) override; |
111 void Focus() override; | 108 void Focus() override; |
112 void SetInitialFocus() override; | 109 void SetInitialFocus() override; |
113 void StoreFocus() override; | 110 void StoreFocus() override; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 // This is the completed overscroll gesture. This is used for the animation | 221 // This is the completed overscroll gesture. This is used for the animation |
225 // callback that happens in response to a completed overscroll gesture. | 222 // callback that happens in response to a completed overscroll gesture. |
226 OverscrollMode completed_overscroll_gesture_; | 223 OverscrollMode completed_overscroll_gesture_; |
227 | 224 |
228 // This manages the overlay window that shows the screenshot during a history | 225 // This manages the overlay window that shows the screenshot during a history |
229 // navigation triggered by the overscroll gesture. | 226 // navigation triggered by the overscroll gesture. |
230 scoped_ptr<OverscrollNavigationOverlay> navigation_overlay_; | 227 scoped_ptr<OverscrollNavigationOverlay> navigation_overlay_; |
231 | 228 |
232 scoped_ptr<ShadowLayerDelegate> overscroll_shadow_; | 229 scoped_ptr<ShadowLayerDelegate> overscroll_shadow_; |
233 | 230 |
234 scoped_ptr<TouchEditableImplAura> touch_editable_; | |
235 scoped_ptr<GestureNavSimple> gesture_nav_simple_; | 231 scoped_ptr<GestureNavSimple> gesture_nav_simple_; |
236 | 232 |
237 // On Windows we can run into problems if resources get released within the | 233 // On Windows we can run into problems if resources get released within the |
238 // initialization phase while the content (and its dimensions) are not known. | 234 // initialization phase while the content (and its dimensions) are not known. |
239 bool is_or_was_visible_; | 235 bool is_or_was_visible_; |
240 | 236 |
241 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAura); | 237 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAura); |
242 }; | 238 }; |
243 | 239 |
244 } // namespace content | 240 } // namespace content |
245 | 241 |
246 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ | 242 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ |
OLD | NEW |