| 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 #include <queue> | 9 #include <queue> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/process/process.h" | 16 #include "base/process/process.h" |
| 17 #include "cc/layers/delegated_frame_resource_collection.h" |
| 17 #include "cc/layers/delegated_renderer_layer_client.h" | 18 #include "cc/layers/delegated_renderer_layer_client.h" |
| 18 #include "cc/layers/texture_layer_client.h" | 19 #include "cc/layers/texture_layer_client.h" |
| 19 #include "cc/output/begin_frame_args.h" | 20 #include "cc/output/begin_frame_args.h" |
| 20 #include "content/browser/accessibility/browser_accessibility_manager.h" | 21 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 21 #include "content/browser/renderer_host/image_transport_factory_android.h" | 22 #include "content/browser/renderer_host/image_transport_factory_android.h" |
| 22 #include "content/browser/renderer_host/ime_adapter_android.h" | 23 #include "content/browser/renderer_host/ime_adapter_android.h" |
| 23 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 24 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 24 #include "gpu/command_buffer/common/mailbox.h" | 25 #include "gpu/command_buffer/common/mailbox.h" |
| 25 #include "third_party/skia/include/core/SkColor.h" | 26 #include "third_party/skia/include/core/SkColor.h" |
| 26 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 27 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
| 27 #include "ui/gfx/size.h" | 28 #include "ui/gfx/size.h" |
| 28 #include "ui/gfx/vector2d_f.h" | 29 #include "ui/gfx/vector2d_f.h" |
| 29 | 30 |
| 30 struct ViewHostMsg_TextInputState_Params; | 31 struct ViewHostMsg_TextInputState_Params; |
| 31 | 32 |
| 32 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; | 33 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; |
| 33 struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params; | 34 struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params; |
| 34 | 35 |
| 35 namespace cc { | 36 namespace cc { |
| 36 class CopyOutputResult; | 37 class CopyOutputResult; |
| 38 class DelegatedFrameProvider; |
| 37 class DelegatedRendererLayer; | 39 class DelegatedRendererLayer; |
| 38 class Layer; | 40 class Layer; |
| 39 class SingleReleaseCallback; | 41 class SingleReleaseCallback; |
| 40 class TextureLayer; | 42 class TextureLayer; |
| 41 } | 43 } |
| 42 | 44 |
| 43 namespace WebKit { | 45 namespace WebKit { |
| 44 class WebExternalTextureLayer; | 46 class WebExternalTextureLayer; |
| 45 class WebTouchEvent; | 47 class WebTouchEvent; |
| 46 class WebMouseEvent; | 48 class WebMouseEvent; |
| 47 } | 49 } |
| 48 | 50 |
| 49 namespace content { | 51 namespace content { |
| 50 class ContentViewCoreImpl; | 52 class ContentViewCoreImpl; |
| 51 class OverscrollGlow; | 53 class OverscrollGlow; |
| 52 class RenderWidgetHost; | 54 class RenderWidgetHost; |
| 53 class RenderWidgetHostImpl; | 55 class RenderWidgetHostImpl; |
| 54 struct NativeWebKeyboardEvent; | 56 struct NativeWebKeyboardEvent; |
| 55 | 57 |
| 56 // ----------------------------------------------------------------------------- | 58 // ----------------------------------------------------------------------------- |
| 57 // See comments in render_widget_host_view.h about this class and its members. | 59 // See comments in render_widget_host_view.h about this class and its members. |
| 58 // ----------------------------------------------------------------------------- | 60 // ----------------------------------------------------------------------------- |
| 59 class RenderWidgetHostViewAndroid | 61 class RenderWidgetHostViewAndroid |
| 60 : public RenderWidgetHostViewBase, | 62 : public RenderWidgetHostViewBase, |
| 61 public BrowserAccessibilityDelegate, | 63 public BrowserAccessibilityDelegate, |
| 62 public cc::TextureLayerClient, | 64 public cc::TextureLayerClient, |
| 63 public cc::DelegatedRendererLayerClient, | 65 public cc::DelegatedRendererLayerClient, |
| 66 public cc::DelegatedFrameResourceCollectionClient, |
| 64 public ImageTransportFactoryAndroidObserver { | 67 public ImageTransportFactoryAndroidObserver { |
| 65 public: | 68 public: |
| 66 RenderWidgetHostViewAndroid(RenderWidgetHostImpl* widget, | 69 RenderWidgetHostViewAndroid(RenderWidgetHostImpl* widget, |
| 67 ContentViewCoreImpl* content_view_core); | 70 ContentViewCoreImpl* content_view_core); |
| 68 virtual ~RenderWidgetHostViewAndroid(); | 71 virtual ~RenderWidgetHostViewAndroid(); |
| 69 | 72 |
| 70 // RenderWidgetHostView implementation. | 73 // RenderWidgetHostView implementation. |
| 71 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 74 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
| 72 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; | 75 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; |
| 73 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, | 76 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 // cc::TextureLayerClient implementation. | 191 // cc::TextureLayerClient implementation. |
| 189 virtual unsigned PrepareTexture() OVERRIDE; | 192 virtual unsigned PrepareTexture() OVERRIDE; |
| 190 virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE; | 193 virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE; |
| 191 virtual bool PrepareTextureMailbox( | 194 virtual bool PrepareTextureMailbox( |
| 192 cc::TextureMailbox* mailbox, | 195 cc::TextureMailbox* mailbox, |
| 193 scoped_ptr<cc::SingleReleaseCallback>* release_callback, | 196 scoped_ptr<cc::SingleReleaseCallback>* release_callback, |
| 194 bool use_shared_memory) OVERRIDE; | 197 bool use_shared_memory) OVERRIDE; |
| 195 | 198 |
| 196 // cc::DelegatedRendererLayerClient implementation. | 199 // cc::DelegatedRendererLayerClient implementation. |
| 197 virtual void DidCommitFrameData() OVERRIDE; | 200 virtual void DidCommitFrameData() OVERRIDE; |
| 198 virtual void UnusedResourcesAreAvailable() OVERRIDE {} | 201 |
| 202 // cc::DelegatedFrameResourceCollectionClient implementation. |
| 203 virtual void UnusedResourcesAreAvailable() OVERRIDE; |
| 199 | 204 |
| 200 // ImageTransportFactoryAndroidObserver implementation. | 205 // ImageTransportFactoryAndroidObserver implementation. |
| 201 virtual void OnLostResources() OVERRIDE; | 206 virtual void OnLostResources() OVERRIDE; |
| 202 | 207 |
| 203 // Non-virtual methods | 208 // Non-virtual methods |
| 204 void SetContentViewCore(ContentViewCoreImpl* content_view_core); | 209 void SetContentViewCore(ContentViewCoreImpl* content_view_core); |
| 205 SkColor GetCachedBackgroundColor() const; | 210 SkColor GetCachedBackgroundColor() const; |
| 206 void SendKeyEvent(const NativeWebKeyboardEvent& event); | 211 void SendKeyEvent(const NativeWebKeyboardEvent& event); |
| 207 void SendTouchEvent(const WebKit::WebTouchEvent& event); | 212 void SendTouchEvent(const WebKit::WebTouchEvent& event); |
| 208 void SendMouseEvent(const WebKit::WebMouseEvent& event); | 213 void SendMouseEvent(const WebKit::WebMouseEvent& event); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 239 void SynchronousFrameMetadata( | 244 void SynchronousFrameMetadata( |
| 240 const cc::CompositorFrameMetadata& frame_metadata); | 245 const cc::CompositorFrameMetadata& frame_metadata); |
| 241 | 246 |
| 242 private: | 247 private: |
| 243 void BuffersSwapped(const gpu::Mailbox& mailbox, | 248 void BuffersSwapped(const gpu::Mailbox& mailbox, |
| 244 uint32_t output_surface_id, | 249 uint32_t output_surface_id, |
| 245 const base::Closure& ack_callback); | 250 const base::Closure& ack_callback); |
| 246 | 251 |
| 247 void RunAckCallbacks(); | 252 void RunAckCallbacks(); |
| 248 | 253 |
| 254 void DestroyDelegatedContent(); |
| 249 void SwapDelegatedFrame(uint32 output_surface_id, | 255 void SwapDelegatedFrame(uint32 output_surface_id, |
| 250 scoped_ptr<cc::DelegatedFrameData> frame_data); | 256 scoped_ptr<cc::DelegatedFrameData> frame_data); |
| 251 void SendDelegatedFrameAck(uint32 output_surface_id); | 257 void SendDelegatedFrameAck(uint32 output_surface_id); |
| 252 | 258 |
| 253 void UpdateContentViewCoreFrameMetadata( | 259 void UpdateContentViewCoreFrameMetadata( |
| 254 const cc::CompositorFrameMetadata& frame_metadata); | 260 const cc::CompositorFrameMetadata& frame_metadata); |
| 255 void ComputeContentsSize(const cc::CompositorFrameMetadata& frame_metadata); | 261 void ComputeContentsSize(const cc::CompositorFrameMetadata& frame_metadata); |
| 256 void ResetClipping(); | 262 void ResetClipping(); |
| 257 void ClipContents(const gfx::Rect& clipping, const gfx::Size& content_size); | 263 void ClipContents(const gfx::Rect& clipping, const gfx::Size& content_size); |
| 258 | 264 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 ContentViewCoreImpl* content_view_core_; | 296 ContentViewCoreImpl* content_view_core_; |
| 291 | 297 |
| 292 ImeAdapterAndroid ime_adapter_android_; | 298 ImeAdapterAndroid ime_adapter_android_; |
| 293 | 299 |
| 294 // Body background color of the underlying document. | 300 // Body background color of the underlying document. |
| 295 SkColor cached_background_color_; | 301 SkColor cached_background_color_; |
| 296 | 302 |
| 297 // The texture layer for this view when using browser-side compositing. | 303 // The texture layer for this view when using browser-side compositing. |
| 298 scoped_refptr<cc::TextureLayer> texture_layer_; | 304 scoped_refptr<cc::TextureLayer> texture_layer_; |
| 299 | 305 |
| 306 scoped_refptr<cc::DelegatedFrameResourceCollection> resource_collection_; |
| 307 scoped_refptr<cc::DelegatedFrameProvider> frame_provider_; |
| 300 scoped_refptr<cc::DelegatedRendererLayer> delegated_renderer_layer_; | 308 scoped_refptr<cc::DelegatedRendererLayer> delegated_renderer_layer_; |
| 301 | 309 |
| 302 // The layer used for rendering the contents of this view. | 310 // The layer used for rendering the contents of this view. |
| 303 // It is either owned by texture_layer_ or surface_texture_transport_ | 311 // It is either owned by texture_layer_ or surface_texture_transport_ |
| 304 // depending on the mode. | 312 // depending on the mode. |
| 305 scoped_refptr<cc::Layer> layer_; | 313 scoped_refptr<cc::Layer> layer_; |
| 306 | 314 |
| 307 // The most recent texture id that was pushed to the texture layer. | 315 // The most recent texture id that was pushed to the texture layer. |
| 308 unsigned int texture_id_in_layer_; | 316 unsigned int texture_id_in_layer_; |
| 309 | 317 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 326 scoped_ptr<OverscrollGlow> overscroll_effect_; | 334 scoped_ptr<OverscrollGlow> overscroll_effect_; |
| 327 | 335 |
| 328 bool flush_input_requested_; | 336 bool flush_input_requested_; |
| 329 | 337 |
| 330 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); | 338 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); |
| 331 }; | 339 }; |
| 332 | 340 |
| 333 } // namespace content | 341 } // namespace content |
| 334 | 342 |
| 335 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ | 343 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ |
| OLD | NEW |