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_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/process.h" | 14 #include "base/process.h" |
| 15 #include "base/timer.h" |
15 #include "content/browser/renderer_host/ime_adapter_android.h" | 16 #include "content/browser/renderer_host/ime_adapter_android.h" |
16 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 17 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
17 #include "gpu/command_buffer/common/mailbox.h" | 18 #include "gpu/command_buffer/common/mailbox.h" |
18 #include "third_party/skia/include/core/SkColor.h" | 19 #include "third_party/skia/include/core/SkColor.h" |
19 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" | 20 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" |
20 #include "ui/gfx/size.h" | 21 #include "ui/gfx/size.h" |
21 #include "ui/gfx/vector2d_f.h" | 22 #include "ui/gfx/vector2d_f.h" |
22 | 23 |
23 struct ViewHostMsg_TextInputState_Params; | 24 struct ViewHostMsg_TextInputState_Params; |
24 | 25 |
25 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; | 26 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; |
26 struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params; | 27 struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params; |
27 | 28 |
28 namespace cc { | 29 namespace cc { |
29 class Layer; | 30 class Layer; |
30 class TextureLayer; | 31 class TextureLayer; |
31 } | 32 } |
32 | 33 |
33 namespace WebKit { | 34 namespace WebKit { |
34 class WebExternalTextureLayer; | 35 class WebExternalTextureLayer; |
35 class WebTouchEvent; | 36 class WebTouchEvent; |
36 class WebMouseEvent; | 37 class WebMouseEvent; |
37 } | 38 } |
38 | 39 |
39 namespace content { | 40 namespace content { |
40 class ContentViewCoreImpl; | 41 class ContentViewCoreImpl; |
| 42 class OverscrollGlow; |
41 class RenderWidgetHost; | 43 class RenderWidgetHost; |
42 class RenderWidgetHostImpl; | 44 class RenderWidgetHostImpl; |
43 class SurfaceTextureTransportClient; | 45 class SurfaceTextureTransportClient; |
44 struct NativeWebKeyboardEvent; | 46 struct NativeWebKeyboardEvent; |
45 | 47 |
46 // ----------------------------------------------------------------------------- | 48 // ----------------------------------------------------------------------------- |
47 // See comments in render_widget_host_view.h about this class and its members. | 49 // See comments in render_widget_host_view.h about this class and its members. |
48 // ----------------------------------------------------------------------------- | 50 // ----------------------------------------------------------------------------- |
49 class RenderWidgetHostViewAndroid : public RenderWidgetHostViewBase { | 51 class RenderWidgetHostViewAndroid : public RenderWidgetHostViewBase { |
50 public: | 52 public: |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 virtual InputEventAckState FilterInputEvent( | 139 virtual InputEventAckState FilterInputEvent( |
138 const WebKit::WebInputEvent& input_event) OVERRIDE; | 140 const WebKit::WebInputEvent& input_event) OVERRIDE; |
139 virtual void OnAccessibilityNotifications( | 141 virtual void OnAccessibilityNotifications( |
140 const std::vector<AccessibilityHostMsg_NotificationParams>& | 142 const std::vector<AccessibilityHostMsg_NotificationParams>& |
141 params) OVERRIDE; | 143 params) OVERRIDE; |
142 virtual bool LockMouse() OVERRIDE; | 144 virtual bool LockMouse() OVERRIDE; |
143 virtual void UnlockMouse() OVERRIDE; | 145 virtual void UnlockMouse() OVERRIDE; |
144 virtual void HasTouchEventHandlers(bool need_touch_events) OVERRIDE; | 146 virtual void HasTouchEventHandlers(bool need_touch_events) OVERRIDE; |
145 virtual void OnSwapCompositorFrame( | 147 virtual void OnSwapCompositorFrame( |
146 scoped_ptr<cc::CompositorFrame> frame) OVERRIDE; | 148 scoped_ptr<cc::CompositorFrame> frame) OVERRIDE; |
| 149 virtual void OnOverscrolled(const gfx::Vector2dF& accumulated_overscroll, |
| 150 const gfx::Vector2dF& current_fling_velocity) |
| 151 OVERRIDE; |
147 virtual void ShowDisambiguationPopup(const gfx::Rect& target_rect, | 152 virtual void ShowDisambiguationPopup(const gfx::Rect& target_rect, |
148 const SkBitmap& zoomed_bitmap) OVERRIDE; | 153 const SkBitmap& zoomed_bitmap) OVERRIDE; |
149 | 154 |
150 // Non-virtual methods | 155 // Non-virtual methods |
151 void SetContentViewCore(ContentViewCoreImpl* content_view_core); | 156 void SetContentViewCore(ContentViewCoreImpl* content_view_core); |
152 SkColor GetCachedBackgroundColor() const; | 157 SkColor GetCachedBackgroundColor() const; |
153 void SendKeyEvent(const NativeWebKeyboardEvent& event); | 158 void SendKeyEvent(const NativeWebKeyboardEvent& event); |
154 void SendTouchEvent(const WebKit::WebTouchEvent& event); | 159 void SendTouchEvent(const WebKit::WebTouchEvent& event); |
155 void SendMouseEvent(const WebKit::WebMouseEvent& event); | 160 void SendMouseEvent(const WebKit::WebMouseEvent& event); |
156 void SendMouseWheelEvent(const WebKit::WebMouseWheelEvent& event); | 161 void SendMouseWheelEvent(const WebKit::WebMouseWheelEvent& event); |
(...skipping 15 matching lines...) Expand all Loading... |
172 // Select all text between the given coordinates. | 177 // Select all text between the given coordinates. |
173 void SelectRange(const gfx::Point& start, const gfx::Point& end); | 178 void SelectRange(const gfx::Point& start, const gfx::Point& end); |
174 | 179 |
175 void MoveCaret(const gfx::Point& point); | 180 void MoveCaret(const gfx::Point& point); |
176 | 181 |
177 private: | 182 private: |
178 void BuffersSwapped(const gpu::Mailbox& mailbox, | 183 void BuffersSwapped(const gpu::Mailbox& mailbox, |
179 const gfx::Size texture_size, | 184 const gfx::Size texture_size, |
180 const gfx::SizeF content_size, | 185 const gfx::SizeF content_size, |
181 const base::Closure& ack_callback); | 186 const base::Closure& ack_callback); |
| 187 void AttachLayers(); |
| 188 void RemoveLayers(); |
| 189 |
| 190 void AnimationCallback(); |
| 191 void ScheduleAnimation(); |
182 | 192 |
183 // The model object. | 193 // The model object. |
184 RenderWidgetHostImpl* host_; | 194 RenderWidgetHostImpl* host_; |
185 | 195 |
186 // Whether or not this widget is potentially attached to the view hierarchy. | 196 // Whether or not this widget is potentially attached to the view hierarchy. |
187 // This view may not actually be attached if this is true, but it should be | 197 // This view may not actually be attached if this is true, but it should be |
188 // treated as such, because as soon as a ContentViewCore is set the layer | 198 // treated as such, because as soon as a ContentViewCore is set the layer |
189 // will be attached automatically. | 199 // will be attached automatically. |
190 bool is_layer_attached_; | 200 bool are_layers_attached_; |
191 | 201 |
192 // ContentViewCoreImpl is our interface to the view system. | 202 // ContentViewCoreImpl is our interface to the view system. |
193 ContentViewCoreImpl* content_view_core_; | 203 ContentViewCoreImpl* content_view_core_; |
194 | 204 |
195 ImeAdapterAndroid ime_adapter_android_; | 205 ImeAdapterAndroid ime_adapter_android_; |
196 | 206 |
197 // Body background color of the underlying document. | 207 // Body background color of the underlying document. |
198 SkColor cached_background_color_; | 208 SkColor cached_background_color_; |
199 | 209 |
200 // The texture layer for this view when using browser-side compositing. | 210 // The texture layer for this view when using browser-side compositing. |
(...skipping 12 matching lines...) Expand all Loading... |
213 | 223 |
214 // Used for image transport when needing to share resources across threads. | 224 // Used for image transport when needing to share resources across threads. |
215 scoped_ptr<SurfaceTextureTransportClient> surface_texture_transport_; | 225 scoped_ptr<SurfaceTextureTransportClient> surface_texture_transport_; |
216 | 226 |
217 // The mailbox of the previously received frame. | 227 // The mailbox of the previously received frame. |
218 gpu::Mailbox current_mailbox_; | 228 gpu::Mailbox current_mailbox_; |
219 | 229 |
220 // The mailbox of the frame we last returned. | 230 // The mailbox of the frame we last returned. |
221 gpu::Mailbox last_mailbox_; | 231 gpu::Mailbox last_mailbox_; |
222 | 232 |
| 233 // Used to render overscroll overlays |
| 234 scoped_ptr<OverscrollGlow> overscroll_effect_; |
| 235 base::OneShotTimer<RenderWidgetHostViewAndroid> animation_timer_; |
| 236 |
223 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); | 237 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); |
224 }; | 238 }; |
225 | 239 |
226 } // namespace content | 240 } // namespace content |
227 | 241 |
228 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ | 242 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ |
OLD | NEW |