render_widget_host_view_child_frame.cc revision 5c02ac1a9c1b504631c0a3d2b6e737b5d738bae1
1561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes// Copyright 2014 The Chromium Authors. All rights reserved.
2561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes// Use of this source code is governed by a BSD-style license that can be
3561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes// found in the LICENSE file.
4561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes
5561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes#include "content/browser/frame_host/render_widget_host_view_child_frame.h"
6561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes
7561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes#include "content/browser/frame_host/cross_process_frame_connector.h"
8561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes#include "content/browser/renderer_host/render_widget_host_impl.h"
9561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes#include "content/common/gpu/gpu_messages.h"
10561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes#include "content/common/view_messages.h"
11561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes#include "content/public/browser/render_process_host.h"
12561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes
13561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughesnamespace content {
14561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes
15561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott HughesRenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame(
16561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes    RenderWidgetHost* widget_host)
17561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes    : host_(RenderWidgetHostImpl::From(widget_host)),
18561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes      frame_connector_(NULL) {
19561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes  host_->SetView(this);
20561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes}
21561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes
22561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott HughesRenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() {
23561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes}
24561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughes
25561ee011997c6c2f1befbfaa9d5f0a99771c1d63Elliott Hughesvoid RenderWidgetHostViewChildFrame::InitAsChild(
26    gfx::NativeView parent_view) {
27  NOTREACHED();
28}
29
30RenderWidgetHost* RenderWidgetHostViewChildFrame::GetRenderWidgetHost() const {
31  return host_;
32}
33
34void RenderWidgetHostViewChildFrame::SetSize(const gfx::Size& size) {
35  host_->WasResized();
36}
37
38void RenderWidgetHostViewChildFrame::SetBounds(const gfx::Rect& rect) {
39  SetSize(rect.size());
40}
41
42void RenderWidgetHostViewChildFrame::Focus() {
43}
44
45bool RenderWidgetHostViewChildFrame::HasFocus() const {
46  return false;
47}
48
49bool RenderWidgetHostViewChildFrame::IsSurfaceAvailableForCopy() const {
50  NOTIMPLEMENTED();
51  return false;
52}
53
54void RenderWidgetHostViewChildFrame::Show() {
55  WasShown();
56}
57
58void RenderWidgetHostViewChildFrame::Hide() {
59  WasHidden();
60}
61
62bool RenderWidgetHostViewChildFrame::IsShowing() {
63  return !host_->is_hidden();
64}
65
66gfx::Rect RenderWidgetHostViewChildFrame::GetViewBounds() const {
67  gfx::Rect rect;
68  if (frame_connector_)
69    rect = frame_connector_->ChildFrameRect();
70  return rect;
71}
72
73gfx::NativeView RenderWidgetHostViewChildFrame::GetNativeView() const {
74  NOTREACHED();
75  return NULL;
76}
77
78gfx::NativeViewId RenderWidgetHostViewChildFrame::GetNativeViewId() const {
79  NOTREACHED();
80  return 0;
81}
82
83gfx::NativeViewAccessible
84RenderWidgetHostViewChildFrame::GetNativeViewAccessible() {
85  NOTREACHED();
86  return NULL;
87}
88
89void RenderWidgetHostViewChildFrame::SetBackground(
90    const SkBitmap& background) {
91}
92
93gfx::Size RenderWidgetHostViewChildFrame::GetPhysicalBackingSize() const {
94  gfx::Size size;
95  if (frame_connector_)
96    size = frame_connector_->ChildFrameRect().size();
97  return size;
98}
99
100void RenderWidgetHostViewChildFrame::InitAsPopup(
101    RenderWidgetHostView* parent_host_view,
102    const gfx::Rect& pos) {
103  NOTREACHED();
104}
105
106void RenderWidgetHostViewChildFrame::InitAsFullscreen(
107    RenderWidgetHostView* reference_host_view) {
108  NOTREACHED();
109}
110
111void RenderWidgetHostViewChildFrame::ImeCancelComposition() {
112  NOTREACHED();
113}
114
115#if defined(OS_MACOSX) || defined(USE_AURA)
116void RenderWidgetHostViewChildFrame::ImeCompositionRangeChanged(
117    const gfx::Range& range,
118    const std::vector<gfx::Rect>& character_bounds) {
119  NOTREACHED();
120}
121#endif
122
123void RenderWidgetHostViewChildFrame::WasShown() {
124  if (!host_->is_hidden())
125    return;
126  host_->WasShown();
127}
128
129void RenderWidgetHostViewChildFrame::WasHidden() {
130  if (host_->is_hidden())
131    return;
132  host_->WasHidden();
133}
134
135void RenderWidgetHostViewChildFrame::MovePluginWindows(
136    const std::vector<WebPluginGeometry>& moves) {
137}
138
139void RenderWidgetHostViewChildFrame::Blur() {
140}
141
142void RenderWidgetHostViewChildFrame::UpdateCursor(const WebCursor& cursor) {
143}
144
145void RenderWidgetHostViewChildFrame::SetIsLoading(bool is_loading) {
146  NOTREACHED();
147}
148
149void RenderWidgetHostViewChildFrame::TextInputTypeChanged(
150    ui::TextInputType type,
151    ui::TextInputMode input_mode,
152    bool can_compose_inline) {
153  NOTREACHED();
154}
155
156void RenderWidgetHostViewChildFrame::RenderProcessGone(
157    base::TerminationStatus status,
158    int error_code) {
159  if (frame_connector_)
160    frame_connector_->RenderProcessGone();
161  Destroy();
162}
163
164void RenderWidgetHostViewChildFrame::Destroy() {
165  if (frame_connector_) {
166    frame_connector_->set_view(NULL);
167    frame_connector_ = NULL;
168  }
169
170  host_->SetView(NULL);
171  host_ = NULL;
172  base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
173}
174
175void RenderWidgetHostViewChildFrame::SetTooltipText(
176    const base::string16& tooltip_text) {
177}
178
179void RenderWidgetHostViewChildFrame::SelectionChanged(
180    const base::string16& text,
181    size_t offset,
182    const gfx::Range& range) {
183}
184
185void RenderWidgetHostViewChildFrame::SelectionBoundsChanged(
186    const ViewHostMsg_SelectionBounds_Params& params) {
187}
188
189#if defined(OS_ANDROID)
190void RenderWidgetHostViewChildFrame::SelectionRootBoundsChanged(
191    const gfx::Rect& bounds) {
192}
193#endif
194
195void RenderWidgetHostViewChildFrame::ScrollOffsetChanged() {
196}
197
198void RenderWidgetHostViewChildFrame::OnAcceleratedCompositingStateChange() {
199}
200
201void RenderWidgetHostViewChildFrame::AcceleratedSurfaceInitialized(int host_id,
202                                                              int route_id) {
203}
204
205void RenderWidgetHostViewChildFrame::AcceleratedSurfaceBuffersSwapped(
206    const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
207    int gpu_host_id) {
208  if (frame_connector_)
209    frame_connector_->ChildFrameBuffersSwapped(params, gpu_host_id);
210}
211
212void RenderWidgetHostViewChildFrame::AcceleratedSurfacePostSubBuffer(
213    const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
214    int gpu_host_id) {
215}
216
217void RenderWidgetHostViewChildFrame::OnSwapCompositorFrame(
218      uint32 output_surface_id,
219      scoped_ptr<cc::CompositorFrame> frame) {
220  if (frame_connector_) {
221    frame_connector_->ChildFrameCompositorFrameSwapped(
222        output_surface_id,
223        host_->GetProcess()->GetID(),
224        host_->GetRoutingID(),
225        frame.Pass());
226  }
227}
228
229void RenderWidgetHostViewChildFrame::GetScreenInfo(
230    blink::WebScreenInfo* results) {
231}
232
233gfx::Rect RenderWidgetHostViewChildFrame::GetBoundsInRootWindow() {
234  // We do not have any root window specific parts in this view.
235  return GetViewBounds();
236}
237
238#if defined(USE_AURA)
239void RenderWidgetHostViewChildFrame::ProcessAckedTouchEvent(
240    const TouchEventWithLatencyInfo& touch,
241    InputEventAckState ack_result) {
242}
243#endif  // defined(USE_AURA)
244
245bool RenderWidgetHostViewChildFrame::LockMouse() {
246  return false;
247}
248
249void RenderWidgetHostViewChildFrame::UnlockMouse() {
250}
251
252#if defined(OS_MACOSX)
253void RenderWidgetHostViewChildFrame::SetActive(bool active) {
254}
255
256void RenderWidgetHostViewChildFrame::SetTakesFocusOnlyOnMouseDown(bool flag) {
257}
258
259void RenderWidgetHostViewChildFrame::SetWindowVisibility(bool visible) {
260}
261
262void RenderWidgetHostViewChildFrame::WindowFrameChanged() {
263}
264
265void RenderWidgetHostViewChildFrame::ShowDefinitionForSelection() {
266}
267
268bool RenderWidgetHostViewChildFrame::SupportsSpeech() const {
269  return false;
270}
271
272void RenderWidgetHostViewChildFrame::SpeakSelection() {
273}
274
275bool RenderWidgetHostViewChildFrame::IsSpeaking() const {
276  return false;
277}
278
279void RenderWidgetHostViewChildFrame::StopSpeaking() {
280}
281
282bool RenderWidgetHostViewChildFrame::PostProcessEventForPluginIme(
283      const NativeWebKeyboardEvent& event) {
284  return false;
285}
286#endif // defined(OS_MACOSX)
287
288#if defined(OS_ANDROID)
289void RenderWidgetHostViewChildFrame::ShowDisambiguationPopup(
290    const gfx::Rect& target_rect,
291    const SkBitmap& zoomed_bitmap) {
292}
293#endif  // defined(OS_ANDROID)
294
295void RenderWidgetHostViewChildFrame::CopyFromCompositingSurface(
296    const gfx::Rect& src_subrect,
297    const gfx::Size& /* dst_size */,
298    const base::Callback<void(bool, const SkBitmap&)>& callback,
299    const SkBitmap::Config config) {
300  callback.Run(false, SkBitmap());
301}
302
303void RenderWidgetHostViewChildFrame::CopyFromCompositingSurfaceToVideoFrame(
304      const gfx::Rect& src_subrect,
305      const scoped_refptr<media::VideoFrame>& target,
306      const base::Callback<void(bool)>& callback) {
307  NOTIMPLEMENTED();
308  callback.Run(false);
309}
310
311bool RenderWidgetHostViewChildFrame::CanCopyToVideoFrame() const {
312  return false;
313}
314
315void RenderWidgetHostViewChildFrame::AcceleratedSurfaceSuspend() {
316  NOTREACHED();
317}
318
319void RenderWidgetHostViewChildFrame::AcceleratedSurfaceRelease() {
320}
321
322bool RenderWidgetHostViewChildFrame::HasAcceleratedSurface(
323      const gfx::Size& desired_size) {
324  return false;
325}
326
327gfx::GLSurfaceHandle RenderWidgetHostViewChildFrame::GetCompositingSurface() {
328  return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::TEXTURE_TRANSPORT);
329}
330
331void RenderWidgetHostViewChildFrame::SetScrollOffsetPinning(
332    bool is_pinned_to_left, bool is_pinned_to_right) {
333}
334
335#if defined(OS_WIN)
336void RenderWidgetHostViewChildFrame::SetParentNativeViewAccessible(
337    gfx::NativeViewAccessible accessible_parent) {
338}
339
340gfx::NativeViewId RenderWidgetHostViewChildFrame::GetParentForWindowlessPlugin()
341    const {
342  return NULL;
343}
344#endif // defined(OS_WIN)
345
346SkBitmap::Config RenderWidgetHostViewChildFrame::PreferredReadbackFormat() {
347  return SkBitmap::kARGB_8888_Config;
348}
349
350}  // namespace content
351