render_widget_host_view_child_frame.h revision 5c02ac1a9c1b504631c0a3d2b6e737b5d738bae1
1// Copyright 2014 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_ 6#define CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_ 7 8#include "base/memory/scoped_ptr.h" 9#include "content/browser/renderer_host/render_widget_host_view_base.h" 10#include "content/common/content_export.h" 11#include "ui/gfx/native_widget_types.h" 12#include "ui/gfx/rect.h" 13 14namespace content { 15class CrossProcessFrameConnector; 16class RenderWidgetHost; 17class RenderWidgetHostImpl; 18 19// RenderWidgetHostViewChildFrame implements the view for a RenderWidgetHost 20// associated with content being rendered in a separate process from 21// content that is embedding it. This is not a platform-specific class; rather, 22// the embedding renderer process implements the platform containing the 23// widget, and the top-level frame's RenderWidgetHostView will ultimately 24// manage all native widget interaction. 25// 26// See comments in render_widget_host_view.h about this class and its members. 27class CONTENT_EXPORT RenderWidgetHostViewChildFrame 28 : public RenderWidgetHostViewBase { 29 public: 30 explicit RenderWidgetHostViewChildFrame(RenderWidgetHost* widget); 31 virtual ~RenderWidgetHostViewChildFrame(); 32 33 void set_cross_process_frame_connector( 34 CrossProcessFrameConnector* frame_connector) { 35 frame_connector_ = frame_connector; 36 } 37 38 // RenderWidgetHostView implementation. 39 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; 40 virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; 41 virtual void SetSize(const gfx::Size& size) OVERRIDE; 42 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE; 43 virtual void Focus() OVERRIDE; 44 virtual bool HasFocus() const OVERRIDE; 45 virtual bool IsSurfaceAvailableForCopy() const OVERRIDE; 46 virtual void Show() OVERRIDE; 47 virtual void Hide() OVERRIDE; 48 virtual bool IsShowing() OVERRIDE; 49 virtual gfx::Rect GetViewBounds() const OVERRIDE; 50 virtual gfx::NativeView GetNativeView() const OVERRIDE; 51 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE; 52 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; 53 virtual void SetBackground(const SkBitmap& background) OVERRIDE; 54 virtual gfx::Size GetPhysicalBackingSize() const OVERRIDE; 55 56 // RenderWidgetHostViewPort implementation. 57 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, 58 const gfx::Rect& pos) OVERRIDE; 59 virtual void InitAsFullscreen( 60 RenderWidgetHostView* reference_host_view) OVERRIDE; 61 virtual void WasShown() OVERRIDE; 62 virtual void WasHidden() OVERRIDE; 63 virtual void MovePluginWindows( 64 const std::vector<WebPluginGeometry>& moves) OVERRIDE; 65 virtual void Blur() OVERRIDE; 66 virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE; 67 virtual void SetIsLoading(bool is_loading) OVERRIDE; 68 virtual void TextInputTypeChanged(ui::TextInputType type, 69 ui::TextInputMode input_mode, 70 bool can_compose_inline) OVERRIDE; 71 virtual void ImeCancelComposition() OVERRIDE; 72#if defined(OS_MACOSX) || defined(USE_AURA) 73 virtual void ImeCompositionRangeChanged( 74 const gfx::Range& range, 75 const std::vector<gfx::Rect>& character_bounds) OVERRIDE; 76#endif 77 virtual void RenderProcessGone(base::TerminationStatus status, 78 int error_code) OVERRIDE; 79 virtual void Destroy() OVERRIDE; 80 virtual void SetTooltipText(const base::string16& tooltip_text) OVERRIDE; 81 virtual void SelectionChanged(const base::string16& text, 82 size_t offset, 83 const gfx::Range& range) OVERRIDE; 84 virtual void SelectionBoundsChanged( 85 const ViewHostMsg_SelectionBounds_Params& params) OVERRIDE; 86#if defined(OS_ANDROID) 87 virtual void SelectionRootBoundsChanged(const gfx::Rect& bounds) OVERRIDE; 88#endif 89 virtual void ScrollOffsetChanged() OVERRIDE; 90 virtual void CopyFromCompositingSurface( 91 const gfx::Rect& src_subrect, 92 const gfx::Size& dst_size, 93 const base::Callback<void(bool, const SkBitmap&)>& callback, 94 const SkBitmap::Config config) OVERRIDE; 95 virtual void CopyFromCompositingSurfaceToVideoFrame( 96 const gfx::Rect& src_subrect, 97 const scoped_refptr<media::VideoFrame>& target, 98 const base::Callback<void(bool)>& callback) OVERRIDE; 99 virtual bool CanCopyToVideoFrame() const OVERRIDE; 100 virtual void OnAcceleratedCompositingStateChange() OVERRIDE; 101 virtual void AcceleratedSurfaceInitialized(int host_id, 102 int route_id) OVERRIDE; 103 virtual void AcceleratedSurfaceBuffersSwapped( 104 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, 105 int gpu_host_id) OVERRIDE; 106 virtual void AcceleratedSurfacePostSubBuffer( 107 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, 108 int gpu_host_id) OVERRIDE; 109 virtual void AcceleratedSurfaceSuspend() OVERRIDE; 110 virtual void AcceleratedSurfaceRelease() OVERRIDE; 111 virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) OVERRIDE; 112 virtual void OnSwapCompositorFrame( 113 uint32 output_surface_id, 114 scoped_ptr<cc::CompositorFrame> frame) OVERRIDE; 115 virtual void GetScreenInfo(blink::WebScreenInfo* results) OVERRIDE; 116 virtual gfx::Rect GetBoundsInRootWindow() OVERRIDE; 117 virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE; 118 virtual void SetScrollOffsetPinning( 119 bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE; 120#if defined(USE_AURA) 121 virtual void ProcessAckedTouchEvent( 122 const TouchEventWithLatencyInfo& touch, 123 InputEventAckState ack_result) OVERRIDE; 124#endif // defined(USE_AURA) 125 virtual bool LockMouse() OVERRIDE; 126 virtual void UnlockMouse() OVERRIDE; 127 128#if defined(OS_MACOSX) 129 // RenderWidgetHostView implementation. 130 virtual void SetActive(bool active) OVERRIDE; 131 virtual void SetTakesFocusOnlyOnMouseDown(bool flag) OVERRIDE; 132 virtual void SetWindowVisibility(bool visible) OVERRIDE; 133 virtual void WindowFrameChanged() OVERRIDE; 134 virtual void ShowDefinitionForSelection() OVERRIDE; 135 virtual bool SupportsSpeech() const OVERRIDE; 136 virtual void SpeakSelection() OVERRIDE; 137 virtual bool IsSpeaking() const OVERRIDE; 138 virtual void StopSpeaking() OVERRIDE; 139 140 // RenderWidgetHostViewPort implementation. 141 virtual bool PostProcessEventForPluginIme( 142 const NativeWebKeyboardEvent& event) OVERRIDE; 143#endif // defined(OS_MACOSX) 144 145#if defined(OS_ANDROID) 146 // RenderWidgetHostViewPort implementation. 147 virtual void ShowDisambiguationPopup( 148 const gfx::Rect& target_rect, 149 const SkBitmap& zoomed_bitmap) OVERRIDE; 150#endif // defined(OS_ANDROID) 151 152#if defined(OS_WIN) 153 virtual void SetParentNativeViewAccessible( 154 gfx::NativeViewAccessible accessible_parent) OVERRIDE; 155 virtual gfx::NativeViewId GetParentForWindowlessPlugin() const OVERRIDE; 156#endif 157 158 virtual SkBitmap::Config PreferredReadbackFormat() OVERRIDE; 159 160 protected: 161 friend class RenderWidgetHostView; 162 163 // Members will become private when RenderWidgetHostViewGuest is removed. 164 // The model object. 165 RenderWidgetHostImpl* host_; 166 167 // frame_connector_ provides a platform abstraction. Messages 168 // sent through it are routed to the embedding renderer process. 169 CrossProcessFrameConnector* frame_connector_; 170 171 private: 172 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewChildFrame); 173}; 174 175} // namespace content 176 177#endif // CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_ 178