Chromium Code Reviews| 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_frame_resource_collection.h" |
| 18 #include "cc/layers/delegated_renderer_layer_client.h" | 18 #include "cc/layers/delegated_renderer_layer_client.h" |
| 19 #include "cc/layers/texture_layer_client.h" | 19 #include "cc/layers/texture_layer_client.h" |
| 20 #include "cc/output/begin_frame_args.h" | 20 #include "cc/output/begin_frame_args.h" |
| 21 #include "content/browser/accessibility/browser_accessibility_manager.h" | 21 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 22 #include "content/browser/renderer_host/image_transport_factory_android.h" | 22 #include "content/browser/renderer_host/image_transport_factory_android.h" |
| 23 #include "content/browser/renderer_host/ime_adapter_android.h" | 23 #include "content/browser/renderer_host/ime_adapter_android.h" |
| 24 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 24 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 25 #include "content/public/browser/android/compositor_observer.h" | |
| 26 #include "content/public/browser/android/compositor_provider_client.h" | |
| 25 #include "gpu/command_buffer/common/mailbox.h" | 27 #include "gpu/command_buffer/common/mailbox.h" |
| 26 #include "third_party/skia/include/core/SkColor.h" | 28 #include "third_party/skia/include/core/SkColor.h" |
| 27 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 29 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
| 28 #include "ui/gfx/size.h" | 30 #include "ui/gfx/size.h" |
| 29 #include "ui/gfx/vector2d_f.h" | 31 #include "ui/gfx/vector2d_f.h" |
| 30 | 32 |
| 31 struct ViewHostMsg_TextInputState_Params; | 33 struct ViewHostMsg_TextInputState_Params; |
| 32 | 34 |
| 33 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; | 35 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; |
| 34 struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params; | 36 struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params; |
| 35 | 37 |
| 36 namespace cc { | 38 namespace cc { |
| 37 class CopyOutputResult; | 39 class CopyOutputResult; |
| 38 class DelegatedFrameProvider; | 40 class DelegatedFrameProvider; |
| 39 class DelegatedRendererLayer; | 41 class DelegatedRendererLayer; |
| 40 class Layer; | 42 class Layer; |
| 41 class SingleReleaseCallback; | 43 class SingleReleaseCallback; |
| 42 class TextureLayer; | 44 class TextureLayer; |
| 43 } | 45 } |
| 44 | 46 |
| 45 namespace blink { | 47 namespace blink { |
| 46 class WebExternalTextureLayer; | 48 class WebExternalTextureLayer; |
| 47 class WebTouchEvent; | 49 class WebTouchEvent; |
| 48 class WebMouseEvent; | 50 class WebMouseEvent; |
| 49 } | 51 } |
| 50 | 52 |
| 51 namespace content { | 53 namespace content { |
| 54 class CompositorProvider; | |
| 52 class ContentViewCoreImpl; | 55 class ContentViewCoreImpl; |
| 53 class OverscrollGlow; | 56 class OverscrollGlow; |
| 54 class RenderWidgetHost; | 57 class RenderWidgetHost; |
| 55 class RenderWidgetHostImpl; | 58 class RenderWidgetHostImpl; |
| 56 struct NativeWebKeyboardEvent; | 59 struct NativeWebKeyboardEvent; |
| 57 | 60 |
| 58 // ----------------------------------------------------------------------------- | 61 // ----------------------------------------------------------------------------- |
| 59 // See comments in render_widget_host_view.h about this class and its members. | 62 // See comments in render_widget_host_view.h about this class and its members. |
| 60 // ----------------------------------------------------------------------------- | 63 // ----------------------------------------------------------------------------- |
| 61 class RenderWidgetHostViewAndroid | 64 class RenderWidgetHostViewAndroid |
| 62 : public RenderWidgetHostViewBase, | 65 : public RenderWidgetHostViewBase, |
| 63 public BrowserAccessibilityDelegate, | 66 public BrowserAccessibilityDelegate, |
| 64 public cc::TextureLayerClient, | |
| 65 public cc::DelegatedRendererLayerClient, | |
| 66 public cc::DelegatedFrameResourceCollectionClient, | 67 public cc::DelegatedFrameResourceCollectionClient, |
| 68 public CompositorObserver, | |
| 69 public CompositorProviderClient, | |
| 67 public ImageTransportFactoryAndroidObserver { | 70 public ImageTransportFactoryAndroidObserver { |
| 68 public: | 71 public: |
| 69 RenderWidgetHostViewAndroid(RenderWidgetHostImpl* widget, | 72 RenderWidgetHostViewAndroid(RenderWidgetHostImpl* widget, |
| 70 ContentViewCoreImpl* content_view_core); | 73 ContentViewCoreImpl* content_view_core, |
| 74 CompositorProvider* compositor_provider); | |
| 71 virtual ~RenderWidgetHostViewAndroid(); | 75 virtual ~RenderWidgetHostViewAndroid(); |
| 72 | 76 |
| 73 // RenderWidgetHostView implementation. | 77 // RenderWidgetHostView implementation. |
| 74 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 78 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
| 75 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; | 79 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; |
| 76 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, | 80 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, |
| 77 const gfx::Rect& pos) OVERRIDE; | 81 const gfx::Rect& pos) OVERRIDE; |
| 78 virtual void InitAsFullscreen( | 82 virtual void InitAsFullscreen( |
| 79 RenderWidgetHostView* reference_host_view) OVERRIDE; | 83 RenderWidgetHostView* reference_host_view) OVERRIDE; |
| 80 virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; | 84 virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 183 virtual void AccessibilityDoDefaultAction(int acc_obj_id) OVERRIDE; | 187 virtual void AccessibilityDoDefaultAction(int acc_obj_id) OVERRIDE; |
| 184 virtual void AccessibilityScrollToMakeVisible( | 188 virtual void AccessibilityScrollToMakeVisible( |
| 185 int acc_obj_id, gfx::Rect subfocus) OVERRIDE; | 189 int acc_obj_id, gfx::Rect subfocus) OVERRIDE; |
| 186 virtual void AccessibilityScrollToPoint( | 190 virtual void AccessibilityScrollToPoint( |
| 187 int acc_obj_id, gfx::Point point) OVERRIDE; | 191 int acc_obj_id, gfx::Point point) OVERRIDE; |
| 188 virtual void AccessibilitySetTextSelection( | 192 virtual void AccessibilitySetTextSelection( |
| 189 int acc_obj_id, int start_offset, int end_offset) OVERRIDE; | 193 int acc_obj_id, int start_offset, int end_offset) OVERRIDE; |
| 190 virtual gfx::Point GetLastTouchEventLocation() const OVERRIDE; | 194 virtual gfx::Point GetLastTouchEventLocation() const OVERRIDE; |
| 191 virtual void FatalAccessibilityTreeError() OVERRIDE; | 195 virtual void FatalAccessibilityTreeError() OVERRIDE; |
| 192 | 196 |
| 193 // cc::TextureLayerClient implementation. | |
| 194 virtual unsigned PrepareTexture() OVERRIDE; | |
| 195 virtual bool PrepareTextureMailbox( | |
| 196 cc::TextureMailbox* mailbox, | |
| 197 scoped_ptr<cc::SingleReleaseCallback>* release_callback, | |
| 198 bool use_shared_memory) OVERRIDE; | |
| 199 | |
| 200 // cc::DelegatedRendererLayerClient implementation. | |
| 201 virtual void DidCommitFrameData() OVERRIDE; | |
| 202 | |
| 203 // cc::DelegatedFrameResourceCollectionClient implementation. | 197 // cc::DelegatedFrameResourceCollectionClient implementation. |
| 204 virtual void UnusedResourcesAreAvailable() OVERRIDE; | 198 virtual void UnusedResourcesAreAvailable() OVERRIDE; |
| 205 | 199 |
| 200 // content::CompositorObserver implementation. | |
| 201 virtual void OnCompositingDidCommit(Compositor* compositor) OVERRIDE; | |
| 202 | |
| 206 // ImageTransportFactoryAndroidObserver implementation. | 203 // ImageTransportFactoryAndroidObserver implementation. |
| 207 virtual void OnLostResources() OVERRIDE; | 204 virtual void OnLostResources() OVERRIDE; |
| 208 | 205 |
| 206 // CompositorProviderClient implementation. | |
| 207 virtual void ChangeCompositor(Compositor* new_compositor) OVERRIDE; | |
|
no sievers
2013/11/08 22:14:04
nit: maybe just 'SetCompositor'?
powei
2013/11/08 22:51:16
Done.
| |
| 208 | |
| 209 // Non-virtual methods | 209 // Non-virtual methods |
| 210 void SetContentViewCore(ContentViewCoreImpl* content_view_core); | 210 void SetContentViewCore(ContentViewCoreImpl* content_view_core); |
| 211 SkColor GetCachedBackgroundColor() const; | 211 SkColor GetCachedBackgroundColor() const; |
| 212 void SendKeyEvent(const NativeWebKeyboardEvent& event); | 212 void SendKeyEvent(const NativeWebKeyboardEvent& event); |
| 213 void SendTouchEvent(const blink::WebTouchEvent& event); | 213 void SendTouchEvent(const blink::WebTouchEvent& event); |
| 214 void SendMouseEvent(const blink::WebMouseEvent& event); | 214 void SendMouseEvent(const blink::WebMouseEvent& event); |
| 215 void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event); | 215 void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event); |
| 216 void SendGestureEvent(const blink::WebGestureEvent& event); | 216 void SendGestureEvent(const blink::WebGestureEvent& event); |
| 217 void SendBeginFrame(const cc::BeginFrameArgs& args); | 217 void SendBeginFrame(const cc::BeginFrameArgs& args); |
| 218 | 218 |
| 219 void OnTextInputStateChanged(const ViewHostMsg_TextInputState_Params& params); | 219 void OnTextInputStateChanged(const ViewHostMsg_TextInputState_Params& params); |
| 220 void OnDidChangeBodyBackgroundColor(SkColor color); | 220 void OnDidChangeBodyBackgroundColor(SkColor color); |
| 221 void OnStartContentIntent(const GURL& content_url); | 221 void OnStartContentIntent(const GURL& content_url); |
| 222 void OnSetNeedsBeginFrame(bool enabled); | 222 void OnSetNeedsBeginFrame(bool enabled); |
| 223 void SetCompositorProvider(CompositorProvider* compositor_provider); | |
|
no sievers
2013/11/08 22:14:04
That's weird. Isn't the whole point of the provide
powei
2013/11/08 22:51:16
I agree this isn't great. Maybe you can suggest a
| |
| 223 | 224 |
| 224 int GetNativeImeAdapter(); | 225 int GetNativeImeAdapter(); |
| 225 | 226 |
| 226 void WasResized(); | 227 void WasResized(); |
| 227 | 228 |
| 228 blink::WebGLId GetScaledContentTexture(float scale, gfx::Size* out_size); | 229 blink::WebGLId GetScaledContentTexture(float scale, gfx::Size* out_size); |
| 229 bool PopulateBitmapWithContents(jobject jbitmap); | 230 bool PopulateBitmapWithContents(jobject jbitmap); |
| 230 | 231 |
| 231 bool HasValidFrame() const; | 232 bool HasValidFrame() const; |
| 232 | 233 |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 263 void ResetClipping(); | 264 void ResetClipping(); |
| 264 void ClipContents(const gfx::Rect& clipping, const gfx::Size& content_size); | 265 void ClipContents(const gfx::Rect& clipping, const gfx::Size& content_size); |
| 265 | 266 |
| 266 void AttachLayers(); | 267 void AttachLayers(); |
| 267 void RemoveLayers(); | 268 void RemoveLayers(); |
| 268 | 269 |
| 269 void CreateOverscrollEffectIfNecessary(); | 270 void CreateOverscrollEffectIfNecessary(); |
| 270 void UpdateAnimationSize(const cc::CompositorFrameMetadata& frame_metadata); | 271 void UpdateAnimationSize(const cc::CompositorFrameMetadata& frame_metadata); |
| 271 void ScheduleAnimationIfNecessary(); | 272 void ScheduleAnimationIfNecessary(); |
| 272 | 273 |
| 274 Compositor* GetCompositor(); | |
| 275 void ObserveCompositor(Compositor* compositor); | |
| 276 void UnobserveCompositor(Compositor* compositor); | |
| 277 | |
| 273 // Called after async screenshot task completes. Scales and crops the result | 278 // Called after async screenshot task completes. Scales and crops the result |
| 274 // of the copy. | 279 // of the copy. |
| 275 static void PrepareTextureCopyOutputResult( | 280 static void PrepareTextureCopyOutputResult( |
| 276 const gfx::Size& dst_size_in_pixel, | 281 const gfx::Size& dst_size_in_pixel, |
| 277 const base::Callback<void(bool, const SkBitmap&)>& callback, | 282 const base::Callback<void(bool, const SkBitmap&)>& callback, |
| 278 scoped_ptr<cc::CopyOutputResult> result); | 283 scoped_ptr<cc::CopyOutputResult> result); |
| 279 static void PrepareBitmapCopyOutputResult( | 284 static void PrepareBitmapCopyOutputResult( |
| 280 const gfx::Size& dst_size_in_pixel, | 285 const gfx::Size& dst_size_in_pixel, |
| 281 const base::Callback<void(bool, const SkBitmap&)>& callback, | 286 const base::Callback<void(bool, const SkBitmap&)>& callback, |
| 282 scoped_ptr<cc::CopyOutputResult> result); | 287 scoped_ptr<cc::CopyOutputResult> result); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 333 std::queue<base::Closure> ack_callbacks_; | 338 std::queue<base::Closure> ack_callbacks_; |
| 334 | 339 |
| 335 // Used to render overscroll overlays. | 340 // Used to render overscroll overlays. |
| 336 bool overscroll_effect_enabled_; | 341 bool overscroll_effect_enabled_; |
| 337 scoped_ptr<OverscrollGlow> overscroll_effect_; | 342 scoped_ptr<OverscrollGlow> overscroll_effect_; |
| 338 | 343 |
| 339 bool flush_input_requested_; | 344 bool flush_input_requested_; |
| 340 | 345 |
| 341 int accelerated_surface_route_id_; | 346 int accelerated_surface_route_id_; |
| 342 | 347 |
| 348 CompositorProvider* compositor_provider_; | |
| 349 | |
| 343 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); | 350 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); |
| 344 }; | 351 }; |
| 345 | 352 |
| 346 } // namespace content | 353 } // namespace content |
| 347 | 354 |
| 348 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ | 355 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ |
| OLD | NEW |