render_widget_host_view_child_frame.cc revision 5d1f7b1de12d16ceb2c938c56701a3e8bfa558f7
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  size_ = size;
36  host_->WasResized();
37}
38
39void RenderWidgetHostViewChildFrame::SetBounds(const gfx::Rect& rect) {
40  SetSize(rect.size());
41}
42
43void RenderWidgetHostViewChildFrame::Focus() {
44}
45
46bool RenderWidgetHostViewChildFrame::HasFocus() const {
47  return false;
48}
49
50bool RenderWidgetHostViewChildFrame::IsSurfaceAvailableForCopy() const {
51  NOTIMPLEMENTED();
52  return false;
53}
54
55void RenderWidgetHostViewChildFrame::Show() {
56  WasShown();
57}
58
59void RenderWidgetHostViewChildFrame::Hide() {
60  WasHidden();
61}
62
63bool RenderWidgetHostViewChildFrame::IsShowing() {
64  return !host_->is_hidden();
65}
66
67gfx::Rect RenderWidgetHostViewChildFrame::GetViewBounds() const {
68  gfx::Rect rect;
69  if (frame_connector_)
70    rect = frame_connector_->ChildFrameRect();
71  rect.set_width(size_.width());
72  rect.set_height(size_.height());
73  return rect;
74}
75
76gfx::NativeView RenderWidgetHostViewChildFrame::GetNativeView() const {
77  NOTREACHED();
78  return NULL;
79}
80
81gfx::NativeViewId RenderWidgetHostViewChildFrame::GetNativeViewId() const {
82  NOTREACHED();
83  return 0;
84}
85
86gfx::NativeViewAccessible
87RenderWidgetHostViewChildFrame::GetNativeViewAccessible() {
88  NOTREACHED();
89  return NULL;
90}
91
92void RenderWidgetHostViewChildFrame::SetBackground(
93    const SkBitmap& background) {
94}
95
96gfx::Size RenderWidgetHostViewChildFrame::GetPhysicalBackingSize() const {
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(OS_WIN) || 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::DidUpdateBackingStore(
124    const gfx::Rect& scroll_rect,
125    const gfx::Vector2d& scroll_delta,
126    const std::vector<gfx::Rect>& copy_rects,
127    const std::vector<ui::LatencyInfo>& latency_info) {
128  NOTREACHED();
129}
130
131void RenderWidgetHostViewChildFrame::WasShown() {
132  if (!host_->is_hidden())
133    return;
134  host_->WasShown();
135}
136
137void RenderWidgetHostViewChildFrame::WasHidden() {
138  if (host_->is_hidden())
139    return;
140  host_->WasHidden();
141}
142
143void RenderWidgetHostViewChildFrame::MovePluginWindows(
144    const gfx::Vector2d& scroll_offset,
145    const std::vector<WebPluginGeometry>& moves) {
146}
147
148void RenderWidgetHostViewChildFrame::Blur() {
149}
150
151void RenderWidgetHostViewChildFrame::UpdateCursor(const WebCursor& cursor) {
152}
153
154void RenderWidgetHostViewChildFrame::SetIsLoading(bool is_loading) {
155  NOTREACHED();
156}
157
158void RenderWidgetHostViewChildFrame::TextInputTypeChanged(
159    ui::TextInputType type,
160    ui::TextInputMode input_mode,
161    bool can_compose_inline) {
162  NOTREACHED();
163}
164
165void RenderWidgetHostViewChildFrame::RenderProcessGone(
166    base::TerminationStatus status,
167    int error_code) {
168  if (frame_connector_)
169    frame_connector_->RenderProcessGone();
170}
171
172void RenderWidgetHostViewChildFrame::Destroy() {
173  frame_connector_ = NULL;
174
175  host_->SetView(NULL);
176  host_ = NULL;
177  base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
178}
179
180void RenderWidgetHostViewChildFrame::SetTooltipText(
181    const base::string16& tooltip_text) {
182}
183
184void RenderWidgetHostViewChildFrame::SelectionChanged(
185    const base::string16& text,
186    size_t offset,
187    const gfx::Range& range) {
188}
189
190void RenderWidgetHostViewChildFrame::SelectionBoundsChanged(
191    const ViewHostMsg_SelectionBounds_Params& params) {
192}
193
194void RenderWidgetHostViewChildFrame::ScrollOffsetChanged() {
195}
196
197void RenderWidgetHostViewChildFrame::OnAcceleratedCompositingStateChange() {
198}
199
200void RenderWidgetHostViewChildFrame::AcceleratedSurfaceInitialized(int host_id,
201                                                              int route_id) {
202}
203
204void RenderWidgetHostViewChildFrame::AcceleratedSurfaceBuffersSwapped(
205    const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
206    int gpu_host_id) {
207  if (frame_connector_)
208    frame_connector_->ChildFrameBuffersSwapped(params, gpu_host_id);
209}
210
211void RenderWidgetHostViewChildFrame::AcceleratedSurfacePostSubBuffer(
212    const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
213    int gpu_host_id) {
214}
215
216void RenderWidgetHostViewChildFrame::OnSwapCompositorFrame(
217      uint32 output_surface_id,
218      scoped_ptr<cc::CompositorFrame> frame) {
219  if (frame_connector_) {
220    frame_connector_->ChildFrameCompositorFrameSwapped(
221        output_surface_id,
222        host_->GetProcess()->GetID(),
223        host_->GetRoutingID(),
224        frame.Pass());
225  }
226}
227
228void RenderWidgetHostViewChildFrame::GetScreenInfo(
229    blink::WebScreenInfo* results) {
230}
231
232gfx::Rect RenderWidgetHostViewChildFrame::GetBoundsInRootWindow() {
233  // We do not have any root window specific parts in this view.
234  return GetViewBounds();
235}
236
237#if defined(OS_WIN) || defined(USE_AURA)
238void RenderWidgetHostViewChildFrame::ProcessAckedTouchEvent(
239    const TouchEventWithLatencyInfo& touch,
240    InputEventAckState ack_result) {
241}
242#endif  // defined(OS_WIN) || defined(USE_AURA)
243
244bool RenderWidgetHostViewChildFrame::LockMouse() {
245  return false;
246}
247
248void RenderWidgetHostViewChildFrame::UnlockMouse() {
249}
250
251#if defined(OS_MACOSX)
252void RenderWidgetHostViewChildFrame::SetActive(bool active) {
253}
254
255void RenderWidgetHostViewChildFrame::SetTakesFocusOnlyOnMouseDown(bool flag) {
256}
257
258void RenderWidgetHostViewChildFrame::SetWindowVisibility(bool visible) {
259}
260
261void RenderWidgetHostViewChildFrame::WindowFrameChanged() {
262}
263
264void RenderWidgetHostViewChildFrame::ShowDefinitionForSelection() {
265}
266
267bool RenderWidgetHostViewChildFrame::SupportsSpeech() const {
268  return false;
269}
270
271void RenderWidgetHostViewChildFrame::SpeakSelection() {
272}
273
274bool RenderWidgetHostViewChildFrame::IsSpeaking() const {
275  return false;
276}
277
278void RenderWidgetHostViewChildFrame::StopSpeaking() {
279}
280
281bool RenderWidgetHostViewChildFrame::PostProcessEventForPluginIme(
282      const NativeWebKeyboardEvent& event) {
283  return false;
284}
285#endif // defined(OS_MACOSX)
286
287#if defined(OS_ANDROID)
288void RenderWidgetHostViewChildFrame::ShowDisambiguationPopup(
289    const gfx::Rect& target_rect,
290    const SkBitmap& zoomed_bitmap) {
291}
292#endif  // defined(OS_ANDROID)
293
294#if defined(TOOLKIT_GTK)
295GdkEventButton* RenderWidgetHostViewChildFrame::GetLastMouseDown() {
296  return NULL;
297}
298
299gfx::NativeView RenderWidgetHostViewChildFrame::BuildInputMethodsGtkMenu() {
300  return NULL;
301}
302#endif  // defined(TOOLKIT_GTK)
303
304BackingStore* RenderWidgetHostViewChildFrame::AllocBackingStore(
305    const gfx::Size& size) {
306  NOTREACHED();
307  return NULL;
308}
309
310void RenderWidgetHostViewChildFrame::CopyFromCompositingSurface(
311    const gfx::Rect& src_subrect,
312    const gfx::Size& /* dst_size */,
313    const base::Callback<void(bool, const SkBitmap&)>& callback,
314    const SkBitmap::Config config) {
315  callback.Run(false, SkBitmap());
316}
317
318void RenderWidgetHostViewChildFrame::CopyFromCompositingSurfaceToVideoFrame(
319      const gfx::Rect& src_subrect,
320      const scoped_refptr<media::VideoFrame>& target,
321      const base::Callback<void(bool)>& callback) {
322  NOTIMPLEMENTED();
323  callback.Run(false);
324}
325
326bool RenderWidgetHostViewChildFrame::CanCopyToVideoFrame() const {
327  return false;
328}
329
330void RenderWidgetHostViewChildFrame::AcceleratedSurfaceSuspend() {
331  NOTREACHED();
332}
333
334void RenderWidgetHostViewChildFrame::AcceleratedSurfaceRelease() {
335}
336
337bool RenderWidgetHostViewChildFrame::HasAcceleratedSurface(
338      const gfx::Size& desired_size) {
339  return false;
340}
341
342gfx::GLSurfaceHandle RenderWidgetHostViewChildFrame::GetCompositingSurface() {
343  return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::TEXTURE_TRANSPORT);
344}
345
346void RenderWidgetHostViewChildFrame::SetHasHorizontalScrollbar(
347    bool has_horizontal_scrollbar) {
348}
349
350void RenderWidgetHostViewChildFrame::SetScrollOffsetPinning(
351    bool is_pinned_to_left, bool is_pinned_to_right) {
352}
353
354#if defined(OS_WIN)
355void RenderWidgetHostViewChildFrame::SetParentNativeViewAccessible(
356    gfx::NativeViewAccessible accessible_parent) {
357}
358
359gfx::NativeViewId RenderWidgetHostViewChildFrame::GetParentForWindowlessPlugin()
360    const {
361  return NULL;
362}
363#endif // defined(OS_WIN)
364
365}  // namespace content
366