#include "base/memory/weak_ptr.h"
#include "base/process/process.h"
#include "cc/layers/delegated_frame_resource_collection.h"
-#include "cc/layers/texture_layer_client.h"
#include "cc/output/begin_frame_args.h"
#include "content/browser/accessibility/browser_accessibility_manager.h"
#include "content/browser/renderer_host/delegated_frame_evictor.h"
#include "content/browser/renderer_host/image_transport_factory_android.h"
#include "content/browser/renderer_host/ime_adapter_android.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
+#include "content/common/content_export.h"
#include "gpu/command_buffer/common/mailbox.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
#include "ui/base/android/window_android_observer.h"
+#include "ui/events/gesture_detection/filtered_gesture_provider.h"
#include "ui/gfx/size.h"
#include "ui/gfx/vector2d_f.h"
class DelegatedFrameProvider;
class DelegatedRendererLayer;
class Layer;
-class SingleReleaseCallback;
-class TextureLayer;
}
namespace blink {
class OverscrollGlow;
class RenderWidgetHost;
class RenderWidgetHostImpl;
+struct DidOverscrollParams;
struct NativeWebKeyboardEvent;
// -----------------------------------------------------------------------------
// See comments in render_widget_host_view.h about this class and its members.
// -----------------------------------------------------------------------------
-class RenderWidgetHostViewAndroid
+class CONTENT_EXPORT RenderWidgetHostViewAndroid
: public RenderWidgetHostViewBase,
- public BrowserAccessibilityDelegate,
public cc::DelegatedFrameResourceCollectionClient,
public ImageTransportFactoryAndroidObserver,
+ public ui::GestureProviderClient,
public ui::WindowAndroidObserver,
public DelegatedFrameEvictorClient {
public:
virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE;
virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE;
virtual void MovePluginWindows(
- const gfx::Vector2d& scroll_offset,
const std::vector<WebPluginGeometry>& moves) OVERRIDE;
virtual void Focus() OVERRIDE;
virtual void Blur() OVERRIDE;
bool can_compose_inline) OVERRIDE;
virtual void ImeCancelComposition() OVERRIDE;
virtual void FocusedNodeChanged(bool is_editable_node) OVERRIDE;
- virtual void DidUpdateBackingStore(
- const gfx::Rect& scroll_rect,
- const gfx::Vector2d& scroll_delta,
- const std::vector<gfx::Rect>& copy_rects,
- const std::vector<ui::LatencyInfo>& latency_info) OVERRIDE;
virtual void RenderProcessGone(base::TerminationStatus status,
int error_code) OVERRIDE;
virtual void Destroy() OVERRIDE;
const ViewHostMsg_SelectionBounds_Params& params) OVERRIDE;
virtual void SelectionRootBoundsChanged(const gfx::Rect& bounds) OVERRIDE;
virtual void ScrollOffsetChanged() OVERRIDE;
- virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE;
virtual void OnAcceleratedCompositingStateChange() OVERRIDE;
virtual void AcceleratedSurfaceInitialized(int host_id,
int route_id) OVERRIDE;
virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE;
virtual void ProcessAckedTouchEvent(const TouchEventWithLatencyInfo& touch,
InputEventAckState ack_result) OVERRIDE;
- virtual void SetHasHorizontalScrollbar(
- bool has_horizontal_scrollbar) OVERRIDE;
virtual void SetScrollOffsetPinning(
bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE;
virtual void UnhandledWheelEvent(
virtual void OnSwapCompositorFrame(
uint32 output_surface_id,
scoped_ptr<cc::CompositorFrame> frame) OVERRIDE;
- virtual void OnOverscrolled(gfx::Vector2dF accumulated_overscroll,
- gfx::Vector2dF current_fling_velocity) OVERRIDE;
virtual void DidStopFlinging() OVERRIDE;
virtual void ShowDisambiguationPopup(const gfx::Rect& target_rect,
const SkBitmap& zoomed_bitmap) OVERRIDE;
virtual void LockCompositingSurface() OVERRIDE;
virtual void UnlockCompositingSurface() OVERRIDE;
- // Implementation of BrowserAccessibilityDelegate:
- virtual void SetAccessibilityFocus(int acc_obj_id) OVERRIDE;
- virtual void AccessibilityDoDefaultAction(int acc_obj_id) OVERRIDE;
- virtual void AccessibilityScrollToMakeVisible(
- int acc_obj_id, gfx::Rect subfocus) OVERRIDE;
- virtual void AccessibilityScrollToPoint(
- int acc_obj_id, gfx::Point point) OVERRIDE;
- virtual void AccessibilitySetTextSelection(
- int acc_obj_id, int start_offset, int end_offset) OVERRIDE;
- virtual gfx::Point GetLastTouchEventLocation() const OVERRIDE;
- virtual void FatalAccessibilityTreeError() OVERRIDE;
-
// cc::DelegatedFrameResourceCollectionClient implementation.
virtual void UnusedResourcesAreAvailable() OVERRIDE;
+ // ui::GestureProviderClient implementation.
+ virtual void OnGestureEvent(const ui::GestureEventData& gesture) OVERRIDE;
+
// ui::WindowAndroidObserver implementation.
virtual void OnCompositingDidCommit() OVERRIDE;
virtual void OnAttachCompositor() OVERRIDE {}
virtual void OnDetachCompositor() OVERRIDE;
virtual void OnWillDestroyWindow() OVERRIDE;
+ virtual void OnVSync(base::TimeTicks frame_time,
+ base::TimeDelta vsync_period) OVERRIDE;
// ImageTransportFactoryAndroidObserver implementation.
virtual void OnLostResources() OVERRIDE;
void SendMouseEvent(const blink::WebMouseEvent& event);
void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event);
void SendGestureEvent(const blink::WebGestureEvent& event);
- void SendBeginFrame(const cc::BeginFrameArgs& args);
void OnTextInputStateChanged(const ViewHostMsg_TextInputState_Params& params);
void OnDidChangeBodyBackgroundColor(SkColor color);
+ void OnDidOverscroll(const DidOverscrollParams& params);
void OnStartContentIntent(const GURL& content_url);
void OnSetNeedsBeginFrame(bool enabled);
void OnSmartClipDataExtracted(const base::string16& result);
+ bool OnTouchEvent(const ui::MotionEvent& event);
+ void ResetGestureDetection();
+ void SetDoubleTapSupportEnabled(bool enabled);
+ void SetMultiTouchZoomSupportEnabled(bool enabled);
+
long GetNativeImeAdapter();
void WasResized();
void MoveCaret(const gfx::Point& point);
- // Returns true when animation ticks are still needed. This avoids a separate
- // round-trip for requesting follow-up animation.
- bool Animate(base::TimeTicks frame_time);
-
void SynchronousFrameMetadata(
const cc::CompositorFrameMetadata& frame_metadata);
void SetOverlayVideoMode(bool enabled);
private:
- void BuffersSwapped(const gpu::Mailbox& mailbox,
- uint32_t output_surface_id,
- const base::Closure& ack_callback);
-
void RunAckCallbacks();
void DestroyDelegatedContent();
void SendDelegatedFrameAck(uint32 output_surface_id);
void SendReturnedDelegatedResources(uint32 output_surface_id);
- void UpdateContentViewCoreFrameMetadata(
+ void OnFrameMetadataUpdated(
const cc::CompositorFrameMetadata& frame_metadata);
void ComputeContentsSize(const cc::CompositorFrameMetadata& frame_metadata);
void ResetClipping();
void AttachLayers();
void RemoveLayers();
- void UpdateAnimationSize(const cc::CompositorFrameMetadata& frame_metadata);
-
// Called after async screenshot task completes. Scales and crops the result
// of the copy.
static void PrepareTextureCopyOutputResult(
void InternalSwapCompositorFrame(uint32 output_surface_id,
scoped_ptr<cc::CompositorFrame> frame);
+ void SetNeedsAnimate();
+ bool Animate(base::TimeTicks frame_time);
+
+
// The model object.
RenderWidgetHostImpl* host_;
// Body background color of the underlying document.
SkColor cached_background_color_;
- // The texture layer for this view when using browser-side compositing.
- scoped_refptr<cc::TextureLayer> texture_layer_;
-
scoped_refptr<cc::DelegatedFrameResourceCollection> resource_collection_;
scoped_refptr<cc::DelegatedFrameProvider> frame_provider_;
- scoped_refptr<cc::DelegatedRendererLayer> delegated_renderer_layer_;
-
- // The layer used for rendering the contents of this view.
- // It is either owned by texture_layer_ or surface_texture_transport_
- // depending on the mode.
- scoped_refptr<cc::Layer> layer_;
-
- // The most recent texture id that was pushed to the texture layer.
- unsigned int texture_id_in_layer_;
+ scoped_refptr<cc::DelegatedRendererLayer> layer_;
// The most recent texture size that was pushed to the texture layer.
gfx::Size texture_size_in_layer_;
// The most recent content size that was pushed to the texture layer.
gfx::Size content_size_in_layer_;
- // The mailbox of the previously received frame.
- gpu::Mailbox current_mailbox_;
-
// The output surface id of the last received frame.
uint32_t last_output_surface_id_;
// Note: |overscroll_effect_| will never be NULL, even if it's never enabled.
scoped_ptr<OverscrollGlow> overscroll_effect_;
+ // Provides gesture synthesis given a stream of touch events (derived from
+ // Android MotionEvent's) and touch event acks.
+ ui::FilteredGestureProvider gesture_provider_;
+
bool flush_input_requested_;
int accelerated_surface_route_id_;
scoped_ptr<DelegatedFrameEvictor> frame_evictor_;
- bool using_delegated_renderer_;
-
size_t locks_on_frame_count_;
bool observing_root_window_;