render_widget_host_view_child_frame.cc revision cedac228d2dd51db4b79ea1e72c7f249408ee061
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#include "content/browser/frame_host/render_widget_host_view_child_frame.h"
6
7#include "content/browser/frame_host/cross_process_frame_connector.h"
8#include "content/browser/renderer_host/render_widget_host_impl.h"
9#include "content/common/gpu/gpu_messages.h"
10#include "content/common/view_messages.h"
11#include "content/public/browser/render_process_host.h"
12
13namespace content {
14
15RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame(
16    RenderWidgetHost* widget_host)
17    : host_(RenderWidgetHostImpl::From(widget_host)),
18      frame_connector_(NULL) {
19  host_->SetView(this);
20}
21
22RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() {
23}
24
25void 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::SetBackgroundOpaque(bool opaque) {
90}
91
92gfx::Size RenderWidgetHostViewChildFrame::GetPhysicalBackingSize() const {
93  gfx::Size size;
94  if (frame_connector_)
95    size = frame_connector_->ChildFrameRect().size();
96  return size;
97}
98
99void RenderWidgetHostViewChildFrame::InitAsPopup(
100    RenderWidgetHostView* parent_host_view,
101    const gfx::Rect& pos) {
102  NOTREACHED();
103}
104
105void RenderWidgetHostViewChildFrame::InitAsFullscreen(
106    RenderWidgetHostView* reference_host_view) {
107  NOTREACHED();
108}
109
110void RenderWidgetHostViewChildFrame::ImeCancelComposition() {
111  NOTREACHED();
112}
113
114#if defined(OS_MACOSX) || defined(USE_AURA)
115void RenderWidgetHostViewChildFrame::ImeCompositionRangeChanged(
116    const gfx::Range& range,
117    const std::vector<gfx::Rect>& character_bounds) {
118  NOTREACHED();
119}
120#endif
121
122void RenderWidgetHostViewChildFrame::WasShown() {
123  if (!host_->is_hidden())
124    return;
125  host_->WasShown();
126}
127
128void RenderWidgetHostViewChildFrame::WasHidden() {
129  if (host_->is_hidden())
130    return;
131  host_->WasHidden();
132}
133
134void RenderWidgetHostViewChildFrame::MovePluginWindows(
135    const std::vector<WebPluginGeometry>& moves) {
136}
137
138void RenderWidgetHostViewChildFrame::Blur() {
139}
140
141void RenderWidgetHostViewChildFrame::UpdateCursor(const WebCursor& cursor) {
142}
143
144void RenderWidgetHostViewChildFrame::SetIsLoading(bool is_loading) {
145  NOTREACHED();
146}
147
148void RenderWidgetHostViewChildFrame::TextInputTypeChanged(
149    ui::TextInputType type,
150    ui::TextInputMode input_mode,
151    bool can_compose_inline) {
152  NOTREACHED();
153}
154
155void RenderWidgetHostViewChildFrame::RenderProcessGone(
156    base::TerminationStatus status,
157    int error_code) {
158  if (frame_connector_)
159    frame_connector_->RenderProcessGone();
160  Destroy();
161}
162
163void RenderWidgetHostViewChildFrame::Destroy() {
164  if (frame_connector_) {
165    frame_connector_->set_view(NULL);
166    frame_connector_ = NULL;
167  }
168
169  host_->SetView(NULL);
170  host_ = NULL;
171  base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
172}
173
174void RenderWidgetHostViewChildFrame::SetTooltipText(
175    const base::string16& tooltip_text) {
176}
177
178void RenderWidgetHostViewChildFrame::SelectionChanged(
179    const base::string16& text,
180    size_t offset,
181    const gfx::Range& range) {
182}
183
184void RenderWidgetHostViewChildFrame::SelectionBoundsChanged(
185    const ViewHostMsg_SelectionBounds_Params& params) {
186}
187
188#if defined(OS_ANDROID)
189void RenderWidgetHostViewChildFrame::ShowDisambiguationPopup(
190    const gfx::Rect& target_rect,
191    const SkBitmap& zoomed_bitmap) {
192}
193
194void RenderWidgetHostViewChildFrame::LockCompositingSurface() {
195}
196
197void RenderWidgetHostViewChildFrame::UnlockCompositingSurface() {
198}
199#endif
200
201void RenderWidgetHostViewChildFrame::ScrollOffsetChanged() {
202}
203
204void RenderWidgetHostViewChildFrame::AcceleratedSurfaceInitialized(int host_id,
205                                                              int route_id) {
206}
207
208void RenderWidgetHostViewChildFrame::AcceleratedSurfaceBuffersSwapped(
209    const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
210    int gpu_host_id) {
211  if (frame_connector_)
212    frame_connector_->ChildFrameBuffersSwapped(params, gpu_host_id);
213}
214
215void RenderWidgetHostViewChildFrame::AcceleratedSurfacePostSubBuffer(
216    const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
217    int gpu_host_id) {
218}
219
220void RenderWidgetHostViewChildFrame::OnSwapCompositorFrame(
221      uint32 output_surface_id,
222      scoped_ptr<cc::CompositorFrame> frame) {
223  if (frame_connector_) {
224    frame_connector_->ChildFrameCompositorFrameSwapped(
225        output_surface_id,
226        host_->GetProcess()->GetID(),
227        host_->GetRoutingID(),
228        frame.Pass());
229  }
230}
231
232void RenderWidgetHostViewChildFrame::GetScreenInfo(
233    blink::WebScreenInfo* results) {
234}
235
236gfx::Rect RenderWidgetHostViewChildFrame::GetBoundsInRootWindow() {
237  // We do not have any root window specific parts in this view.
238  return GetViewBounds();
239}
240
241#if defined(USE_AURA)
242void RenderWidgetHostViewChildFrame::ProcessAckedTouchEvent(
243    const TouchEventWithLatencyInfo& touch,
244    InputEventAckState ack_result) {
245}
246#endif  // defined(USE_AURA)
247
248bool RenderWidgetHostViewChildFrame::LockMouse() {
249  return false;
250}
251
252void RenderWidgetHostViewChildFrame::UnlockMouse() {
253}
254
255#if defined(OS_MACOSX)
256void RenderWidgetHostViewChildFrame::SetActive(bool active) {
257}
258
259void RenderWidgetHostViewChildFrame::SetTakesFocusOnlyOnMouseDown(bool flag) {
260}
261
262void RenderWidgetHostViewChildFrame::SetWindowVisibility(bool visible) {
263}
264
265void RenderWidgetHostViewChildFrame::WindowFrameChanged() {
266}
267
268void RenderWidgetHostViewChildFrame::ShowDefinitionForSelection() {
269}
270
271bool RenderWidgetHostViewChildFrame::SupportsSpeech() const {
272  return false;
273}
274
275void RenderWidgetHostViewChildFrame::SpeakSelection() {
276}
277
278bool RenderWidgetHostViewChildFrame::IsSpeaking() const {
279  return false;
280}
281
282void RenderWidgetHostViewChildFrame::StopSpeaking() {
283}
284
285bool RenderWidgetHostViewChildFrame::PostProcessEventForPluginIme(
286      const NativeWebKeyboardEvent& event) {
287  return false;
288}
289#endif // defined(OS_MACOSX)
290
291void RenderWidgetHostViewChildFrame::CopyFromCompositingSurface(
292    const gfx::Rect& src_subrect,
293    const gfx::Size& /* dst_size */,
294    const base::Callback<void(bool, const SkBitmap&)>& callback,
295    const SkBitmap::Config config) {
296  callback.Run(false, SkBitmap());
297}
298
299void RenderWidgetHostViewChildFrame::CopyFromCompositingSurfaceToVideoFrame(
300      const gfx::Rect& src_subrect,
301      const scoped_refptr<media::VideoFrame>& target,
302      const base::Callback<void(bool)>& callback) {
303  NOTIMPLEMENTED();
304  callback.Run(false);
305}
306
307bool RenderWidgetHostViewChildFrame::CanCopyToVideoFrame() const {
308  return false;
309}
310
311void RenderWidgetHostViewChildFrame::AcceleratedSurfaceSuspend() {
312  NOTREACHED();
313}
314
315void RenderWidgetHostViewChildFrame::AcceleratedSurfaceRelease() {
316}
317
318bool RenderWidgetHostViewChildFrame::HasAcceleratedSurface(
319      const gfx::Size& desired_size) {
320  return false;
321}
322
323gfx::GLSurfaceHandle RenderWidgetHostViewChildFrame::GetCompositingSurface() {
324  return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::TEXTURE_TRANSPORT);
325}
326
327void RenderWidgetHostViewChildFrame::SetScrollOffsetPinning(
328    bool is_pinned_to_left, bool is_pinned_to_right) {
329}
330
331#if defined(OS_WIN)
332void RenderWidgetHostViewChildFrame::SetParentNativeViewAccessible(
333    gfx::NativeViewAccessible accessible_parent) {
334}
335
336gfx::NativeViewId RenderWidgetHostViewChildFrame::GetParentForWindowlessPlugin()
337    const {
338  return NULL;
339}
340#endif // defined(OS_WIN)
341
342SkBitmap::Config RenderWidgetHostViewChildFrame::PreferredReadbackFormat() {
343  return SkBitmap::kARGB_8888_Config;
344}
345
346}  // namespace content
347