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::NativeView
GetNativeView() const OVERRIDE
;
53 virtual gfx::NativeViewId
GetNativeViewId() const OVERRIDE
;
54 virtual gfx::NativeViewAccessible
GetNativeViewAccessible() OVERRIDE
;
55 virtual void SetBackgroundOpaque(bool opaque
) OVERRIDE
;
56 virtual gfx::Size
GetPhysicalBackingSize() const OVERRIDE
;
58 // RenderWidgetHostViewBase implementation.
59 virtual void InitAsPopup(RenderWidgetHostView
* parent_host_view
,
60 const gfx::Rect
& pos
) OVERRIDE
;
61 virtual void InitAsFullscreen(
62 RenderWidgetHostView
* reference_host_view
) OVERRIDE
;
63 virtual void WasShown() OVERRIDE
;
64 virtual void WasHidden() OVERRIDE
;
65 virtual void MovePluginWindows(
66 const std::vector
<WebPluginGeometry
>& moves
) OVERRIDE
;
67 virtual void Blur() OVERRIDE
;
68 virtual void UpdateCursor(const WebCursor
& cursor
) OVERRIDE
;
69 virtual void SetIsLoading(bool is_loading
) OVERRIDE
;
70 virtual void TextInputStateChanged(
71 const ViewHostMsg_TextInputState_Params
& params
) OVERRIDE
;
72 virtual void ImeCancelComposition() OVERRIDE
;
73 #if defined(OS_MACOSX) || defined(USE_AURA)
74 virtual void ImeCompositionRangeChanged(
75 const gfx::Range
& range
,
76 const std::vector
<gfx::Rect
>& character_bounds
) OVERRIDE
;
78 virtual void RenderProcessGone(base::TerminationStatus status
,
79 int error_code
) OVERRIDE
;
80 virtual void Destroy() OVERRIDE
;
81 virtual void SetTooltipText(const base::string16
& tooltip_text
) OVERRIDE
;
82 virtual void SelectionChanged(const base::string16
& text
,
84 const gfx::Range
& range
) OVERRIDE
;
85 virtual void SelectionBoundsChanged(
86 const ViewHostMsg_SelectionBounds_Params
& params
) OVERRIDE
;
87 virtual void CopyFromCompositingSurface(
88 const gfx::Rect
& src_subrect
,
89 const gfx::Size
& dst_size
,
90 const base::Callback
<void(bool, const SkBitmap
&)>& callback
,
91 const SkColorType color_type
) OVERRIDE
;
92 virtual void CopyFromCompositingSurfaceToVideoFrame(
93 const gfx::Rect
& src_subrect
,
94 const scoped_refptr
<media::VideoFrame
>& target
,
95 const base::Callback
<void(bool)>& callback
) OVERRIDE
;
96 virtual bool CanCopyToVideoFrame() const OVERRIDE
;
97 virtual void AcceleratedSurfaceInitialized(int host_id
,
98 int route_id
) OVERRIDE
;
99 virtual void AcceleratedSurfaceBuffersSwapped(
100 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params
& params
,
101 int gpu_host_id
) OVERRIDE
;
102 virtual void AcceleratedSurfacePostSubBuffer(
103 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params
& params
,
104 int gpu_host_id
) OVERRIDE
;
105 virtual void AcceleratedSurfaceSuspend() OVERRIDE
;
106 virtual void AcceleratedSurfaceRelease() OVERRIDE
;
107 virtual bool HasAcceleratedSurface(const gfx::Size
& desired_size
) OVERRIDE
;
108 virtual void OnSwapCompositorFrame(
109 uint32 output_surface_id
,
110 scoped_ptr
<cc::CompositorFrame
> frame
) OVERRIDE
;
111 virtual void GetScreenInfo(blink::WebScreenInfo
* results
) OVERRIDE
;
112 virtual gfx::Rect
GetBoundsInRootWindow() OVERRIDE
;
113 virtual gfx::GLSurfaceHandle
GetCompositingSurface() OVERRIDE
;
114 #if defined(USE_AURA)
115 virtual void ProcessAckedTouchEvent(
116 const TouchEventWithLatencyInfo
& touch
,
117 InputEventAckState ack_result
) OVERRIDE
;
118 #endif // defined(USE_AURA)
119 virtual bool LockMouse() OVERRIDE
;
120 virtual void UnlockMouse() OVERRIDE
;
122 #if defined(OS_MACOSX)
123 // RenderWidgetHostView implementation.
124 virtual void SetActive(bool active
) OVERRIDE
;
125 virtual void SetTakesFocusOnlyOnMouseDown(bool flag
) OVERRIDE
;
126 virtual void SetWindowVisibility(bool visible
) OVERRIDE
;
127 virtual void WindowFrameChanged() OVERRIDE
;
128 virtual void ShowDefinitionForSelection() OVERRIDE
;
129 virtual bool SupportsSpeech() const OVERRIDE
;
130 virtual void SpeakSelection() OVERRIDE
;
131 virtual bool IsSpeaking() const OVERRIDE
;
132 virtual void StopSpeaking() OVERRIDE
;
134 // RenderWidgetHostViewBase implementation.
135 virtual bool PostProcessEventForPluginIme(
136 const NativeWebKeyboardEvent
& event
) OVERRIDE
;
137 #endif // defined(OS_MACOSX)
139 #if defined(OS_ANDROID)
140 // RenderWidgetHostViewBase implementation.
141 virtual void ShowDisambiguationPopup(
142 const gfx::Rect
& target_rect
,
143 const SkBitmap
& zoomed_bitmap
) OVERRIDE
;
144 virtual void LockCompositingSurface() OVERRIDE
;
145 virtual void UnlockCompositingSurface() OVERRIDE
;
146 #endif // defined(OS_ANDROID)
149 virtual void SetParentNativeViewAccessible(
150 gfx::NativeViewAccessible accessible_parent
) OVERRIDE
;
151 virtual gfx::NativeViewId
GetParentForWindowlessPlugin() const OVERRIDE
;
153 virtual BrowserAccessibilityManager
* CreateBrowserAccessibilityManager(
154 BrowserAccessibilityDelegate
* delegate
) OVERRIDE
;
156 virtual SkColorType
PreferredReadbackFormat() OVERRIDE
;
159 friend class RenderWidgetHostView
;
161 // Members will become private when RenderWidgetHostViewGuest is removed.
163 RenderWidgetHostImpl
* host_
;
165 // frame_connector_ provides a platform abstraction. Messages
166 // sent through it are routed to the embedding renderer process.
167 CrossProcessFrameConnector
* frame_connector_
;
170 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewChildFrame
);
173 } // namespace content
175 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_