// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_ #include "base/compiler_specific.h" #include "base/i18n/rtl.h" #include "base/memory/scoped_ptr.h" #include "base/process.h" #include "content/browser/renderer_host/ime_adapter_android.h" #include "content/browser/renderer_host/render_widget_host_view_base.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebExternalTextureLayer.h" #include "ui/gfx/size.h" struct ViewHostMsg_TextInputState_Params; struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params; namespace content { class ContentViewCoreImpl; class RenderWidgetHost; class RenderWidgetHostImpl; struct NativeWebKeyboardEvent; // ----------------------------------------------------------------------------- // See comments in render_widget_host_view.h about this class and its members. // ----------------------------------------------------------------------------- class RenderWidgetHostViewAndroid : public RenderWidgetHostViewBase { public: RenderWidgetHostViewAndroid(RenderWidgetHostImpl* widget, ContentViewCoreImpl* content_view_core); virtual ~RenderWidgetHostViewAndroid(); // RenderWidgetHostView implementation. virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, const gfx::Rect& pos) OVERRIDE; virtual void InitAsFullscreen( RenderWidgetHostView* reference_host_view) OVERRIDE; virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; virtual void WasShown() OVERRIDE; virtual void WasHidden() OVERRIDE; virtual void SetSize(const gfx::Size& size) OVERRIDE; virtual void SetBounds(const gfx::Rect& rect) OVERRIDE; virtual gfx::NativeView GetNativeView() const OVERRIDE; virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE; virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; virtual void MovePluginWindows( const std::vector& moves) OVERRIDE; virtual void Focus() OVERRIDE; virtual void Blur() OVERRIDE; virtual bool HasFocus() const OVERRIDE; virtual bool IsSurfaceAvailableForCopy() const OVERRIDE; virtual void Show() OVERRIDE; virtual void Hide() OVERRIDE; virtual bool IsShowing() OVERRIDE; virtual gfx::Rect GetViewBounds() const OVERRIDE; virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE; virtual void SetIsLoading(bool is_loading) OVERRIDE; virtual void TextInputStateChanged( const ViewHostMsg_TextInputState_Params& params) OVERRIDE; virtual void ImeCancelComposition() OVERRIDE; virtual void DidUpdateBackingStore( const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, const std::vector& copy_rects) OVERRIDE; virtual void RenderViewGone(base::TerminationStatus status, int error_code) OVERRIDE; virtual void Destroy() OVERRIDE; virtual void SetTooltipText(const string16& tooltip_text) OVERRIDE; virtual void SelectionChanged(const string16& text, size_t offset, const ui::Range& range) OVERRIDE; virtual void OnAcceleratedCompositingStateChange() OVERRIDE; virtual void AcceleratedSurfaceBuffersSwapped( const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, int gpu_host_id) OVERRIDE; virtual void AcceleratedSurfacePostSubBuffer( const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, int gpu_host_id) OVERRIDE; virtual void AcceleratedSurfaceSuspend() OVERRIDE; virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) OVERRIDE; virtual void SetBackground(const SkBitmap& background) OVERRIDE; virtual void CopyFromCompositingSurface( const gfx::Rect& src_subrect, const gfx::Size& dst_size, const base::Callback& callback, skia::PlatformCanvas* output) OVERRIDE; virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE; virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE; virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE; virtual gfx::Rect GetBoundsInRootWindow() OVERRIDE; virtual void UnhandledWheelEvent( const WebKit::WebMouseWheelEvent& event) OVERRIDE; virtual void ProcessTouchAck(WebKit::WebInputEvent::Type type, bool processed) OVERRIDE; virtual void SetHasHorizontalScrollbar( bool has_horizontal_scrollbar) OVERRIDE; virtual void SetScrollOffsetPinning( bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE; virtual bool LockMouse() OVERRIDE; virtual void UnlockMouse() OVERRIDE; virtual void StartContentIntent(const GURL& content_url) OVERRIDE; virtual void DidSetNeedTouchEvents(bool need_touch_events) OVERRIDE; void SetContentViewCore(ContentViewCoreImpl* content_view_core); void SendKeyEvent(const NativeWebKeyboardEvent& event); void TouchEvent(const WebKit::WebTouchEvent& event); void GestureEvent(const WebKit::WebGestureEvent& event); int GetNativeImeAdapter(); private: // The model object. RenderWidgetHostImpl* host_; // Whether or not this widget is hidden. bool is_hidden_; // ContentViewCoreImpl is our interface to the view system. ContentViewCoreImpl* content_view_core_; // The size that we want the renderer to be. We keep this in a separate // variable because resizing is async. gfx::Size requested_size_; ImeAdapterAndroid ime_adapter_android_; // The texture layer for this view when using browser-side compositing. scoped_ptr texture_layer_; DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAndroid); }; } // namespace content #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_ANDROID_H_