| 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/output/begin_frame_args.h" | 18 #include "cc/output/begin_frame_args.h" |
| 19 #include "content/browser/accessibility/browser_accessibility_manager.h" | 19 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 20 #include "content/browser/renderer_host/delegated_frame_evictor.h" | 20 #include "content/browser/renderer_host/delegated_frame_evictor.h" |
| 21 #include "content/browser/renderer_host/image_transport_factory_android.h" | 21 #include "content/browser/renderer_host/image_transport_factory_android.h" |
| 22 #include "content/browser/renderer_host/ime_adapter_android.h" | 22 #include "content/browser/renderer_host/ime_adapter_android.h" |
| 23 #include "content/browser/renderer_host/input/gesture_text_selector.h" | 23 #include "content/browser/renderer_host/input/gesture_text_selector.h" |
| 24 #include "content/browser/renderer_host/input/touch_selection_controller.h" | 24 #include "content/browser/renderer_host/input/touch_selection_controller.h" |
| 25 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 25 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 26 #include "content/common/content_export.h" | 26 #include "content/common/content_export.h" |
| 27 #include "content/public/browser/readback_types.h" |
| 27 #include "gpu/command_buffer/common/mailbox.h" | 28 #include "gpu/command_buffer/common/mailbox.h" |
| 28 #include "third_party/skia/include/core/SkColor.h" | 29 #include "third_party/skia/include/core/SkColor.h" |
| 29 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 30 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
| 30 #include "ui/base/android/window_android_observer.h" | 31 #include "ui/base/android/window_android_observer.h" |
| 31 #include "ui/events/gesture_detection/filtered_gesture_provider.h" | 32 #include "ui/events/gesture_detection/filtered_gesture_provider.h" |
| 32 #include "ui/gfx/size.h" | 33 #include "ui/gfx/size.h" |
| 33 #include "ui/gfx/vector2d_f.h" | 34 #include "ui/gfx/vector2d_f.h" |
| 34 | 35 |
| 35 struct ViewHostMsg_TextInputState_Params; | 36 struct ViewHostMsg_TextInputState_Params; |
| 36 | 37 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 50 namespace content { | 51 namespace content { |
| 51 class ContentViewCoreImpl; | 52 class ContentViewCoreImpl; |
| 52 class OverscrollGlow; | 53 class OverscrollGlow; |
| 53 class RenderWidgetHost; | 54 class RenderWidgetHost; |
| 54 class RenderWidgetHostImpl; | 55 class RenderWidgetHostImpl; |
| 55 struct DidOverscrollParams; | 56 struct DidOverscrollParams; |
| 56 struct NativeWebKeyboardEvent; | 57 struct NativeWebKeyboardEvent; |
| 57 | 58 |
| 58 class ReadbackRequest { | 59 class ReadbackRequest { |
| 59 public: | 60 public: |
| 60 explicit ReadbackRequest( | 61 explicit ReadbackRequest(float scale, |
| 61 float scale, | 62 SkColorType color_type, |
| 62 SkColorType color_type, | 63 gfx::Rect src_subrect, |
| 63 gfx::Rect src_subrect, | 64 ReadbackRequestCallback& result_callback); |
| 64 const base::Callback<void(bool, const SkBitmap&)>& result_callback); | |
| 65 ~ReadbackRequest(); | 65 ~ReadbackRequest(); |
| 66 float GetScale() { return scale_; } | 66 float GetScale() { return scale_; } |
| 67 SkColorType GetColorFormat() { return color_type_; } | 67 SkColorType GetColorFormat() { return color_type_; } |
| 68 const gfx::Rect GetCaptureRect() { return src_subrect_; } | 68 const gfx::Rect GetCaptureRect() { return src_subrect_; } |
| 69 const base::Callback<void(bool, const SkBitmap&)>& GetResultCallback() { | 69 ReadbackRequestCallback& GetResultCallback() { return result_callback_; } |
| 70 return result_callback_; | |
| 71 } | |
| 72 | 70 |
| 73 private: | 71 private: |
| 74 ReadbackRequest(); | 72 ReadbackRequest(); |
| 75 float scale_; | 73 float scale_; |
| 76 SkColorType color_type_; | 74 SkColorType color_type_; |
| 77 gfx::Rect src_subrect_; | 75 gfx::Rect src_subrect_; |
| 78 base::Callback<void(bool, const SkBitmap&)> result_callback_; | 76 ReadbackRequestCallback result_callback_; |
| 79 }; | 77 }; |
| 80 | 78 |
| 81 // ----------------------------------------------------------------------------- | 79 // ----------------------------------------------------------------------------- |
| 82 // See comments in render_widget_host_view.h about this class and its members. | 80 // See comments in render_widget_host_view.h about this class and its members. |
| 83 // ----------------------------------------------------------------------------- | 81 // ----------------------------------------------------------------------------- |
| 84 class CONTENT_EXPORT RenderWidgetHostViewAndroid | 82 class CONTENT_EXPORT RenderWidgetHostViewAndroid |
| 85 : public RenderWidgetHostViewBase, | 83 : public RenderWidgetHostViewBase, |
| 86 public cc::DelegatedFrameResourceCollectionClient, | 84 public cc::DelegatedFrameResourceCollectionClient, |
| 87 public ImageTransportFactoryAndroidObserver, | 85 public ImageTransportFactoryAndroidObserver, |
| 88 public ui::GestureProviderClient, | 86 public ui::GestureProviderClient, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 size_t offset, | 140 size_t offset, |
| 143 const gfx::Range& range) override; | 141 const gfx::Range& range) override; |
| 144 virtual void SelectionBoundsChanged( | 142 virtual void SelectionBoundsChanged( |
| 145 const ViewHostMsg_SelectionBounds_Params& params) override; | 143 const ViewHostMsg_SelectionBounds_Params& params) override; |
| 146 virtual void AcceleratedSurfaceInitialized(int route_id) override; | 144 virtual void AcceleratedSurfaceInitialized(int route_id) override; |
| 147 virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) override; | 145 virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) override; |
| 148 virtual void SetBackgroundColor(SkColor color) override; | 146 virtual void SetBackgroundColor(SkColor color) override; |
| 149 virtual void CopyFromCompositingSurface( | 147 virtual void CopyFromCompositingSurface( |
| 150 const gfx::Rect& src_subrect, | 148 const gfx::Rect& src_subrect, |
| 151 const gfx::Size& dst_size, | 149 const gfx::Size& dst_size, |
| 152 CopyFromCompositingSurfaceCallback& callback, | 150 ReadbackRequestCallback& callback, |
| 153 const SkColorType color_type) override; | 151 const SkColorType color_type) override; |
| 154 virtual void CopyFromCompositingSurfaceToVideoFrame( | 152 virtual void CopyFromCompositingSurfaceToVideoFrame( |
| 155 const gfx::Rect& src_subrect, | 153 const gfx::Rect& src_subrect, |
| 156 const scoped_refptr<media::VideoFrame>& target, | 154 const scoped_refptr<media::VideoFrame>& target, |
| 157 const base::Callback<void(bool)>& callback) override; | 155 const base::Callback<void(bool)>& callback) override; |
| 158 virtual bool CanCopyToVideoFrame() const override; | 156 virtual bool CanCopyToVideoFrame() const override; |
| 159 virtual void GetScreenInfo(blink::WebScreenInfo* results) override; | 157 virtual void GetScreenInfo(blink::WebScreenInfo* results) override; |
| 160 virtual gfx::Rect GetBoundsInRootWindow() override; | 158 virtual gfx::Rect GetBoundsInRootWindow() override; |
| 161 virtual gfx::GLSurfaceHandle GetCompositingSurface() override; | 159 virtual gfx::GLSurfaceHandle GetCompositingSurface() override; |
| 162 virtual void ProcessAckedTouchEvent(const TouchEventWithLatencyInfo& touch, | 160 virtual void ProcessAckedTouchEvent(const TouchEventWithLatencyInfo& touch, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 bool OnTouchEvent(const ui::MotionEvent& event); | 229 bool OnTouchEvent(const ui::MotionEvent& event); |
| 232 bool OnTouchHandleEvent(const ui::MotionEvent& event); | 230 bool OnTouchHandleEvent(const ui::MotionEvent& event); |
| 233 void ResetGestureDetection(); | 231 void ResetGestureDetection(); |
| 234 void SetDoubleTapSupportEnabled(bool enabled); | 232 void SetDoubleTapSupportEnabled(bool enabled); |
| 235 void SetMultiTouchZoomSupportEnabled(bool enabled); | 233 void SetMultiTouchZoomSupportEnabled(bool enabled); |
| 236 | 234 |
| 237 long GetNativeImeAdapter(); | 235 long GetNativeImeAdapter(); |
| 238 | 236 |
| 239 void WasResized(); | 237 void WasResized(); |
| 240 | 238 |
| 241 void GetScaledContentBitmap( | 239 void GetScaledContentBitmap(float scale, |
| 242 float scale, | 240 SkColorType color_type, |
| 243 SkColorType color_type, | 241 gfx::Rect src_subrect, |
| 244 gfx::Rect src_subrect, | 242 ReadbackRequestCallback& result_callback); |
| 245 const base::Callback<void(bool, const SkBitmap&)>& result_callback); | |
| 246 | 243 |
| 247 scoped_refptr<cc::DelegatedRendererLayer> | 244 scoped_refptr<cc::DelegatedRendererLayer> |
| 248 CreateDelegatedLayerForFrameProvider() const; | 245 CreateDelegatedLayerForFrameProvider() const; |
| 249 | 246 |
| 250 bool HasValidFrame() const; | 247 bool HasValidFrame() const; |
| 251 | 248 |
| 252 void MoveCaret(const gfx::Point& point); | 249 void MoveCaret(const gfx::Point& point); |
| 253 void HideTextHandles(); | 250 void HideTextHandles(); |
| 254 void OnShowingPastePopup(const gfx::PointF& point); | 251 void OnShowingPastePopup(const gfx::PointF& point); |
| 255 | 252 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 | 287 |
| 291 void AttachLayers(); | 288 void AttachLayers(); |
| 292 void RemoveLayers(); | 289 void RemoveLayers(); |
| 293 | 290 |
| 294 // Called after async screenshot task completes. Scales and crops the result | 291 // Called after async screenshot task completes. Scales and crops the result |
| 295 // of the copy. | 292 // of the copy. |
| 296 static void PrepareTextureCopyOutputResult( | 293 static void PrepareTextureCopyOutputResult( |
| 297 const gfx::Size& dst_size_in_pixel, | 294 const gfx::Size& dst_size_in_pixel, |
| 298 const SkColorType color_type, | 295 const SkColorType color_type, |
| 299 const base::TimeTicks& start_time, | 296 const base::TimeTicks& start_time, |
| 300 const base::Callback<void(bool, const SkBitmap&)>& callback, | 297 ReadbackRequestCallback& callback, |
| 301 scoped_ptr<cc::CopyOutputResult> result); | 298 scoped_ptr<cc::CopyOutputResult> result); |
| 302 static void PrepareTextureCopyOutputResultForDelegatedReadback( | 299 static void PrepareTextureCopyOutputResultForDelegatedReadback( |
| 303 const gfx::Size& dst_size_in_pixel, | 300 const gfx::Size& dst_size_in_pixel, |
| 304 const SkColorType color_type, | 301 const SkColorType color_type, |
| 305 const base::TimeTicks& start_time, | 302 const base::TimeTicks& start_time, |
| 306 scoped_refptr<cc::Layer> readback_layer, | 303 scoped_refptr<cc::Layer> readback_layer, |
| 307 const base::Callback<void(bool, const SkBitmap&)>& callback, | 304 ReadbackRequestCallback& callback, |
| 308 scoped_ptr<cc::CopyOutputResult> result); | 305 scoped_ptr<cc::CopyOutputResult> result); |
| 309 | 306 |
| 310 // DevTools ScreenCast support for Android WebView. | 307 // DevTools ScreenCast support for Android WebView. |
| 311 void SynchronousCopyContents( | 308 void SynchronousCopyContents(const gfx::Rect& src_subrect_in_pixel, |
| 312 const gfx::Rect& src_subrect_in_pixel, | 309 const gfx::Size& dst_size_in_pixel, |
| 313 const gfx::Size& dst_size_in_pixel, | 310 ReadbackRequestCallback& callback, |
| 314 const base::Callback<void(bool, const SkBitmap&)>& callback, | 311 const SkColorType color_type); |
| 315 const SkColorType color_type); | |
| 316 | 312 |
| 317 bool IsReadbackConfigSupported(SkColorType color_type); | 313 bool IsReadbackConfigSupported(SkColorType color_type); |
| 318 | 314 |
| 319 // If we have locks on a frame during a ContentViewCore swap or a context | 315 // If we have locks on a frame during a ContentViewCore swap or a context |
| 320 // lost, the frame is no longer valid and we can safely release all the locks. | 316 // lost, the frame is no longer valid and we can safely release all the locks. |
| 321 // Use this method to release all the locks. | 317 // Use this method to release all the locks. |
| 322 void ReleaseLocksOnSurface(); | 318 void ReleaseLocksOnSurface(); |
| 323 | 319 |
| 324 // Drop any incoming frames from the renderer when there are locks on the | 320 // Drop any incoming frames from the renderer when there are locks on the |
| 325 // current frame. | 321 // current frame. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 gfx::Vector2dF last_scroll_offset_; | 417 gfx::Vector2dF last_scroll_offset_; |
| 422 | 418 |
| 423 base::WeakPtrFactory<RenderWidgetHostViewAndroid> weak_ptr_factory_; | 419 base::WeakPtrFactory<RenderWidgetHostViewAndroid> weak_ptr_factory_; |
| 424 | 420 |
| 425 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); | 421 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); |
| 426 }; | 422 }; |
| 427 | 423 |
| 428 } // namespace content | 424 } // namespace content |
| 429 | 425 |
| 430 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ | 426 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ |
| OLD | NEW |