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