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 "content/public/browser/readback_types.h"
12 #include "ui/gfx/native_widget_types.h"
13 #include "ui/gfx/rect.h"
16 class CrossProcessFrameConnector
;
17 class RenderWidgetHost
;
18 class RenderWidgetHostImpl
;
20 // RenderWidgetHostViewChildFrame implements the view for a RenderWidgetHost
21 // associated with content being rendered in a separate process from
22 // content that is embedding it. This is not a platform-specific class; rather,
23 // the embedding renderer process implements the platform containing the
24 // widget, and the top-level frame's RenderWidgetHostView will ultimately
25 // manage all native widget interaction.
27 // See comments in render_widget_host_view.h about this class and its members.
28 class CONTENT_EXPORT RenderWidgetHostViewChildFrame
29 : public RenderWidgetHostViewBase
{
31 explicit RenderWidgetHostViewChildFrame(RenderWidgetHost
* widget
);
32 ~RenderWidgetHostViewChildFrame() override
;
34 void set_cross_process_frame_connector(
35 CrossProcessFrameConnector
* frame_connector
) {
36 frame_connector_
= frame_connector
;
39 // RenderWidgetHostView implementation.
40 void InitAsChild(gfx::NativeView parent_view
) override
;
41 RenderWidgetHost
* GetRenderWidgetHost() const override
;
42 void SetSize(const gfx::Size
& size
) override
;
43 void SetBounds(const gfx::Rect
& rect
) override
;
44 void Focus() override
;
45 bool HasFocus() const override
;
46 bool IsSurfaceAvailableForCopy() const override
;
49 bool IsShowing() override
;
50 gfx::Rect
GetViewBounds() const override
;
51 gfx::Vector2dF
GetLastScrollOffset() const override
;
52 gfx::NativeView
GetNativeView() const override
;
53 gfx::NativeViewId
GetNativeViewId() const override
;
54 gfx::NativeViewAccessible
GetNativeViewAccessible() override
;
55 void SetBackgroundColor(SkColor color
) override
;
56 gfx::Size
GetPhysicalBackingSize() const override
;
58 // RenderWidgetHostViewBase implementation.
59 void InitAsPopup(RenderWidgetHostView
* parent_host_view
,
60 const gfx::Rect
& pos
) override
;
61 void InitAsFullscreen(RenderWidgetHostView
* reference_host_view
) override
;
62 void WasShown() override
;
63 void WasHidden() override
;
64 void MovePluginWindows(const std::vector
<WebPluginGeometry
>& moves
) override
;
66 void UpdateCursor(const WebCursor
& cursor
) override
;
67 void SetIsLoading(bool is_loading
) override
;
68 void TextInputTypeChanged(ui::TextInputType type
,
69 ui::TextInputMode input_mode
,
70 bool can_compose_inline
,
72 void ImeCancelComposition() override
;
73 void ImeCompositionRangeChanged(
74 const gfx::Range
& range
,
75 const std::vector
<gfx::Rect
>& character_bounds
) override
;
76 void RenderProcessGone(base::TerminationStatus status
,
77 int error_code
) override
;
78 void Destroy() override
;
79 void SetTooltipText(const base::string16
& tooltip_text
) override
;
80 void SelectionChanged(const base::string16
& text
,
82 const gfx::Range
& range
) override
;
83 void SelectionBoundsChanged(
84 const ViewHostMsg_SelectionBounds_Params
& params
) override
;
85 void CopyFromCompositingSurface(const gfx::Rect
& src_subrect
,
86 const gfx::Size
& dst_size
,
87 ReadbackRequestCallback
& callback
,
88 const SkColorType color_type
) override
;
89 void CopyFromCompositingSurfaceToVideoFrame(
90 const gfx::Rect
& src_subrect
,
91 const scoped_refptr
<media::VideoFrame
>& target
,
92 const base::Callback
<void(bool)>& callback
) override
;
93 bool CanCopyToVideoFrame() const override
;
94 bool HasAcceleratedSurface(const gfx::Size
& desired_size
) override
;
95 void OnSwapCompositorFrame(uint32 output_surface_id
,
96 scoped_ptr
<cc::CompositorFrame
> frame
) override
;
97 void GetScreenInfo(blink::WebScreenInfo
* results
) override
;
98 gfx::Rect
GetBoundsInRootWindow() override
;
99 gfx::GLSurfaceHandle
GetCompositingSurface() override
;
100 #if defined(USE_AURA)
101 void ProcessAckedTouchEvent(const TouchEventWithLatencyInfo
& touch
,
102 InputEventAckState ack_result
) override
;
103 #endif // defined(USE_AURA)
104 bool LockMouse() override
;
105 void UnlockMouse() override
;
107 #if defined(OS_MACOSX)
108 // RenderWidgetHostView implementation.
109 void SetActive(bool active
) override
;
110 void SetWindowVisibility(bool visible
) override
;
111 void WindowFrameChanged() override
;
112 void ShowDefinitionForSelection() override
;
113 bool SupportsSpeech() const override
;
114 void SpeakSelection() override
;
115 bool IsSpeaking() const override
;
116 void StopSpeaking() override
;
118 // RenderWidgetHostViewBase implementation.
119 bool PostProcessEventForPluginIme(
120 const NativeWebKeyboardEvent
& event
) override
;
121 #endif // defined(OS_MACOSX)
123 // RenderWidgetHostViewBase implementation.
124 #if defined(OS_ANDROID)
125 virtual void LockCompositingSurface() override
;
126 virtual void UnlockCompositingSurface() override
;
127 #endif // defined(OS_ANDROID)
130 virtual void SetParentNativeViewAccessible(
131 gfx::NativeViewAccessible accessible_parent
) override
;
132 virtual gfx::NativeViewId
GetParentForWindowlessPlugin() const override
;
134 BrowserAccessibilityManager
* CreateBrowserAccessibilityManager(
135 BrowserAccessibilityDelegate
* delegate
) override
;
137 SkColorType
PreferredReadbackFormat() override
;
140 friend class RenderWidgetHostView
;
142 // The last scroll offset of the view.
143 gfx::Vector2dF last_scroll_offset_
;
145 // Members will become private when RenderWidgetHostViewGuest is removed.
147 RenderWidgetHostImpl
* host_
;
149 // frame_connector_ provides a platform abstraction. Messages
150 // sent through it are routed to the embedding renderer process.
151 CrossProcessFrameConnector
* frame_connector_
;
154 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewChildFrame
);
157 } // namespace content
159 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_