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.
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_
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"
14 struct ViewHostMsg_TextInputState_Params
;
17 class CrossProcessFrameConnector
;
18 class RenderWidgetHost
;
19 class RenderWidgetHostImpl
;
21 // RenderWidgetHostViewChildFrame implements the view for a RenderWidgetHost
22 // associated with content being rendered in a separate process from
23 // content that is embedding it. This is not a platform-specific class; rather,
24 // the embedding renderer process implements the platform containing the
25 // widget, and the top-level frame's RenderWidgetHostView will ultimately
26 // manage all native widget interaction.
28 // See comments in render_widget_host_view.h about this class and its members.
29 class CONTENT_EXPORT RenderWidgetHostViewChildFrame
30 : public RenderWidgetHostViewBase
{
32 explicit RenderWidgetHostViewChildFrame(RenderWidgetHost
* widget
);
33 virtual ~RenderWidgetHostViewChildFrame();
35 void set_cross_process_frame_connector(
36 CrossProcessFrameConnector
* frame_connector
) {
37 frame_connector_
= frame_connector
;
40 // RenderWidgetHostView implementation.
41 virtual void InitAsChild(gfx::NativeView parent_view
) OVERRIDE
;
42 virtual RenderWidgetHost
* GetRenderWidgetHost() const OVERRIDE
;
43 virtual void SetSize(const gfx::Size
& size
) OVERRIDE
;
44 virtual void SetBounds(const gfx::Rect
& rect
) OVERRIDE
;
45 virtual void Focus() OVERRIDE
;
46 virtual bool HasFocus() const OVERRIDE
;
47 virtual bool IsSurfaceAvailableForCopy() const OVERRIDE
;
48 virtual void Show() OVERRIDE
;
49 virtual void Hide() OVERRIDE
;
50 virtual bool IsShowing() OVERRIDE
;
51 virtual gfx::Rect
GetViewBounds() const OVERRIDE
;
52 virtual gfx::Vector2dF
GetLastScrollOffset() const OVERRIDE
;
53 virtual gfx::NativeView
GetNativeView() const OVERRIDE
;
54 virtual gfx::NativeViewId
GetNativeViewId() const OVERRIDE
;
55 virtual gfx::NativeViewAccessible
GetNativeViewAccessible() OVERRIDE
;
56 virtual void SetBackgroundOpaque(bool opaque
) OVERRIDE
;
57 virtual gfx::Size
GetPhysicalBackingSize() const OVERRIDE
;
59 // RenderWidgetHostViewBase implementation.
60 virtual void InitAsPopup(RenderWidgetHostView
* parent_host_view
,
61 const gfx::Rect
& pos
) OVERRIDE
;
62 virtual void InitAsFullscreen(
63 RenderWidgetHostView
* reference_host_view
) OVERRIDE
;
64 virtual void WasShown() OVERRIDE
;
65 virtual void WasHidden() OVERRIDE
;
66 virtual void MovePluginWindows(
67 const std::vector
<WebPluginGeometry
>& moves
) OVERRIDE
;
68 virtual void Blur() OVERRIDE
;
69 virtual void UpdateCursor(const WebCursor
& cursor
) OVERRIDE
;
70 virtual void SetIsLoading(bool is_loading
) OVERRIDE
;
71 virtual void TextInputStateChanged(
72 const ViewHostMsg_TextInputState_Params
& params
) OVERRIDE
;
73 virtual void ImeCancelComposition() OVERRIDE
;
74 #if defined(OS_MACOSX) || defined(USE_AURA)
75 virtual void ImeCompositionRangeChanged(
76 const gfx::Range
& range
,
77 const std::vector
<gfx::Rect
>& character_bounds
) OVERRIDE
;
79 virtual void RenderProcessGone(base::TerminationStatus status
,
80 int error_code
) OVERRIDE
;
81 virtual void Destroy() OVERRIDE
;
82 virtual void SetTooltipText(const base::string16
& tooltip_text
) OVERRIDE
;
83 virtual void SelectionChanged(const base::string16
& text
,
85 const gfx::Range
& range
) OVERRIDE
;
86 virtual void SelectionBoundsChanged(
87 const ViewHostMsg_SelectionBounds_Params
& params
) OVERRIDE
;
88 virtual void CopyFromCompositingSurface(
89 const gfx::Rect
& src_subrect
,
90 const gfx::Size
& dst_size
,
91 const base::Callback
<void(bool, const SkBitmap
&)>& callback
,
92 const SkColorType color_type
) OVERRIDE
;
93 virtual void CopyFromCompositingSurfaceToVideoFrame(
94 const gfx::Rect
& src_subrect
,
95 const scoped_refptr
<media::VideoFrame
>& target
,
96 const base::Callback
<void(bool)>& callback
) OVERRIDE
;
97 virtual bool CanCopyToVideoFrame() const OVERRIDE
;
98 virtual void AcceleratedSurfaceInitialized(int host_id
,
99 int route_id
) OVERRIDE
;
100 virtual void AcceleratedSurfaceBuffersSwapped(
101 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params
& params
,
102 int gpu_host_id
) OVERRIDE
;
103 virtual void AcceleratedSurfacePostSubBuffer(
104 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params
& params
,
105 int gpu_host_id
) OVERRIDE
;
106 virtual void AcceleratedSurfaceSuspend() OVERRIDE
;
107 virtual void AcceleratedSurfaceRelease() OVERRIDE
;
108 virtual bool HasAcceleratedSurface(const gfx::Size
& desired_size
) OVERRIDE
;
109 virtual void OnSwapCompositorFrame(
110 uint32 output_surface_id
,
111 scoped_ptr
<cc::CompositorFrame
> frame
) OVERRIDE
;
112 virtual void GetScreenInfo(blink::WebScreenInfo
* results
) OVERRIDE
;
113 virtual gfx::Rect
GetBoundsInRootWindow() OVERRIDE
;
114 virtual gfx::GLSurfaceHandle
GetCompositingSurface() OVERRIDE
;
115 #if defined(USE_AURA)
116 virtual void ProcessAckedTouchEvent(
117 const TouchEventWithLatencyInfo
& touch
,
118 InputEventAckState ack_result
) OVERRIDE
;
119 #endif // defined(USE_AURA)
120 virtual bool LockMouse() OVERRIDE
;
121 virtual void UnlockMouse() OVERRIDE
;
123 #if defined(OS_MACOSX)
124 // RenderWidgetHostView implementation.
125 virtual void SetActive(bool active
) OVERRIDE
;
126 virtual void SetTakesFocusOnlyOnMouseDown(bool flag
) OVERRIDE
;
127 virtual void SetWindowVisibility(bool visible
) OVERRIDE
;
128 virtual void WindowFrameChanged() OVERRIDE
;
129 virtual void ShowDefinitionForSelection() OVERRIDE
;
130 virtual bool SupportsSpeech() const OVERRIDE
;
131 virtual void SpeakSelection() OVERRIDE
;
132 virtual bool IsSpeaking() const OVERRIDE
;
133 virtual void StopSpeaking() OVERRIDE
;
135 // RenderWidgetHostViewBase implementation.
136 virtual bool PostProcessEventForPluginIme(
137 const NativeWebKeyboardEvent
& event
) OVERRIDE
;
138 #endif // defined(OS_MACOSX)
140 #if defined(OS_ANDROID)
141 // RenderWidgetHostViewBase implementation.
142 virtual void ShowDisambiguationPopup(
143 const gfx::Rect
& target_rect
,
144 const SkBitmap
& zoomed_bitmap
) OVERRIDE
;
145 virtual void LockCompositingSurface() OVERRIDE
;
146 virtual void UnlockCompositingSurface() OVERRIDE
;
147 #endif // defined(OS_ANDROID)
150 virtual void SetParentNativeViewAccessible(
151 gfx::NativeViewAccessible accessible_parent
) OVERRIDE
;
152 virtual gfx::NativeViewId
GetParentForWindowlessPlugin() const OVERRIDE
;
154 virtual BrowserAccessibilityManager
* CreateBrowserAccessibilityManager(
155 BrowserAccessibilityDelegate
* delegate
) OVERRIDE
;
157 virtual SkColorType
PreferredReadbackFormat() OVERRIDE
;
160 friend class RenderWidgetHostView
;
162 // The last scroll offset of the view.
163 gfx::Vector2dF last_scroll_offset_
;
165 // Members will become private when RenderWidgetHostViewGuest is removed.
167 RenderWidgetHostImpl
* host_
;
169 // frame_connector_ provides a platform abstraction. Messages
170 // sent through it are routed to the embedding renderer process.
171 CrossProcessFrameConnector
* frame_connector_
;
174 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewChildFrame
);
177 } // namespace content
179 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_