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