99e58e81e2eecc1b2b365f3e1aa0789da5433d60
[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/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
14 namespace content {
15
16 RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame(
17     RenderWidgetHost* widget_host)
18     : host_(RenderWidgetHostImpl::From(widget_host)),
19       frame_connector_(NULL) {
20   host_->SetView(this);
21 }
22
23 RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() {
24 }
25
26 void RenderWidgetHostViewChildFrame::InitAsChild(
27     gfx::NativeView parent_view) {
28   NOTREACHED();
29 }
30
31 RenderWidgetHost* RenderWidgetHostViewChildFrame::GetRenderWidgetHost() const {
32   return host_;
33 }
34
35 void RenderWidgetHostViewChildFrame::SetSize(const gfx::Size& size) {
36   host_->WasResized();
37 }
38
39 void RenderWidgetHostViewChildFrame::SetBounds(const gfx::Rect& rect) {
40   SetSize(rect.size());
41 }
42
43 void RenderWidgetHostViewChildFrame::Focus() {
44 }
45
46 bool RenderWidgetHostViewChildFrame::HasFocus() const {
47   return false;
48 }
49
50 bool RenderWidgetHostViewChildFrame::IsSurfaceAvailableForCopy() const {
51   NOTIMPLEMENTED();
52   return false;
53 }
54
55 void RenderWidgetHostViewChildFrame::Show() {
56   WasShown();
57 }
58
59 void RenderWidgetHostViewChildFrame::Hide() {
60   WasHidden();
61 }
62
63 bool RenderWidgetHostViewChildFrame::IsShowing() {
64   return !host_->is_hidden();
65 }
66
67 gfx::Rect RenderWidgetHostViewChildFrame::GetViewBounds() const {
68   gfx::Rect rect;
69   if (frame_connector_)
70     rect = frame_connector_->ChildFrameRect();
71   return rect;
72 }
73
74 gfx::Vector2dF RenderWidgetHostViewChildFrame::GetLastScrollOffset() const {
75   return last_scroll_offset_;
76 }
77
78 gfx::NativeView RenderWidgetHostViewChildFrame::GetNativeView() const {
79   NOTREACHED();
80   return NULL;
81 }
82
83 gfx::NativeViewId RenderWidgetHostViewChildFrame::GetNativeViewId() const {
84   NOTREACHED();
85   return 0;
86 }
87
88 gfx::NativeViewAccessible
89 RenderWidgetHostViewChildFrame::GetNativeViewAccessible() {
90   NOTREACHED();
91   return NULL;
92 }
93
94 void RenderWidgetHostViewChildFrame::SetBackgroundOpaque(bool opaque) {
95 }
96
97 gfx::Size RenderWidgetHostViewChildFrame::GetPhysicalBackingSize() const {
98   gfx::Size size;
99   if (frame_connector_)
100     size = frame_connector_->ChildFrameRect().size();
101   return size;
102 }
103
104 void RenderWidgetHostViewChildFrame::InitAsPopup(
105     RenderWidgetHostView* parent_host_view,
106     const gfx::Rect& pos) {
107   NOTREACHED();
108 }
109
110 void RenderWidgetHostViewChildFrame::InitAsFullscreen(
111     RenderWidgetHostView* reference_host_view) {
112   NOTREACHED();
113 }
114
115 void RenderWidgetHostViewChildFrame::ImeCancelComposition() {
116   NOTREACHED();
117 }
118
119 #if defined(OS_MACOSX) || defined(USE_AURA)
120 void RenderWidgetHostViewChildFrame::ImeCompositionRangeChanged(
121     const gfx::Range& range,
122     const std::vector<gfx::Rect>& character_bounds) {
123   NOTREACHED();
124 }
125 #endif
126
127 void RenderWidgetHostViewChildFrame::WasShown() {
128   if (!host_->is_hidden())
129     return;
130   host_->WasShown(ui::LatencyInfo());
131 }
132
133 void RenderWidgetHostViewChildFrame::WasHidden() {
134   if (host_->is_hidden())
135     return;
136   host_->WasHidden();
137 }
138
139 void RenderWidgetHostViewChildFrame::MovePluginWindows(
140     const std::vector<WebPluginGeometry>& moves) {
141 }
142
143 void RenderWidgetHostViewChildFrame::Blur() {
144 }
145
146 void RenderWidgetHostViewChildFrame::UpdateCursor(const WebCursor& cursor) {
147 }
148
149 void RenderWidgetHostViewChildFrame::SetIsLoading(bool is_loading) {
150   NOTREACHED();
151 }
152
153 void RenderWidgetHostViewChildFrame::TextInputStateChanged(
154     const ViewHostMsg_TextInputState_Params& params) {
155 }
156
157 void RenderWidgetHostViewChildFrame::RenderProcessGone(
158     base::TerminationStatus status,
159     int error_code) {
160   if (frame_connector_)
161     frame_connector_->RenderProcessGone();
162   Destroy();
163 }
164
165 void 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
176 void RenderWidgetHostViewChildFrame::SetTooltipText(
177     const base::string16& tooltip_text) {
178 }
179
180 void RenderWidgetHostViewChildFrame::SelectionChanged(
181     const base::string16& text,
182     size_t offset,
183     const gfx::Range& range) {
184 }
185
186 void RenderWidgetHostViewChildFrame::SelectionBoundsChanged(
187     const ViewHostMsg_SelectionBounds_Params& params) {
188 }
189
190 #if defined(OS_ANDROID) || defined(TOOLKIT_VIEWS) || defined(USE_AURA)
191 void RenderWidgetHostViewChildFrame::ShowDisambiguationPopup(
192     const gfx::Rect& rect_pixels,
193     const SkBitmap& zoomed_bitmap) {
194 }
195 #endif
196
197 #if defined(OS_ANDROID)
198 void RenderWidgetHostViewChildFrame::LockCompositingSurface() {
199 }
200
201 void RenderWidgetHostViewChildFrame::UnlockCompositingSurface() {
202 }
203 #endif
204
205 void RenderWidgetHostViewChildFrame::AcceleratedSurfaceInitialized(int host_id,
206                                                               int route_id) {
207 }
208
209 void RenderWidgetHostViewChildFrame::AcceleratedSurfaceBuffersSwapped(
210     const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
211     int gpu_host_id) {
212   NOTREACHED();
213 }
214
215 void RenderWidgetHostViewChildFrame::AcceleratedSurfacePostSubBuffer(
216     const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
217     int gpu_host_id) {
218 }
219
220 void 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
233 void RenderWidgetHostViewChildFrame::GetScreenInfo(
234     blink::WebScreenInfo* results) {
235 }
236
237 gfx::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)
243 void RenderWidgetHostViewChildFrame::ProcessAckedTouchEvent(
244     const TouchEventWithLatencyInfo& touch,
245     InputEventAckState ack_result) {
246 }
247 #endif  // defined(USE_AURA)
248
249 bool RenderWidgetHostViewChildFrame::LockMouse() {
250   return false;
251 }
252
253 void RenderWidgetHostViewChildFrame::UnlockMouse() {
254 }
255
256 #if defined(OS_MACOSX)
257 void RenderWidgetHostViewChildFrame::SetActive(bool active) {
258 }
259
260 void RenderWidgetHostViewChildFrame::SetTakesFocusOnlyOnMouseDown(bool flag) {
261 }
262
263 void RenderWidgetHostViewChildFrame::SetWindowVisibility(bool visible) {
264 }
265
266 void RenderWidgetHostViewChildFrame::WindowFrameChanged() {
267 }
268
269 void RenderWidgetHostViewChildFrame::ShowDefinitionForSelection() {
270 }
271
272 bool RenderWidgetHostViewChildFrame::SupportsSpeech() const {
273   return false;
274 }
275
276 void RenderWidgetHostViewChildFrame::SpeakSelection() {
277 }
278
279 bool RenderWidgetHostViewChildFrame::IsSpeaking() const {
280   return false;
281 }
282
283 void RenderWidgetHostViewChildFrame::StopSpeaking() {
284 }
285
286 bool RenderWidgetHostViewChildFrame::PostProcessEventForPluginIme(
287       const NativeWebKeyboardEvent& event) {
288   return false;
289 }
290 #endif // defined(OS_MACOSX)
291
292 void 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
300 void 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
308 bool RenderWidgetHostViewChildFrame::CanCopyToVideoFrame() const {
309   return false;
310 }
311
312 void RenderWidgetHostViewChildFrame::AcceleratedSurfaceSuspend() {
313   NOTREACHED();
314 }
315
316 void RenderWidgetHostViewChildFrame::AcceleratedSurfaceRelease() {
317 }
318
319 bool RenderWidgetHostViewChildFrame::HasAcceleratedSurface(
320       const gfx::Size& desired_size) {
321   return false;
322 }
323
324 gfx::GLSurfaceHandle RenderWidgetHostViewChildFrame::GetCompositingSurface() {
325   return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::TEXTURE_TRANSPORT);
326 }
327
328 #if defined(OS_WIN)
329 void RenderWidgetHostViewChildFrame::SetParentNativeViewAccessible(
330     gfx::NativeViewAccessible accessible_parent) {
331 }
332
333 gfx::NativeViewId RenderWidgetHostViewChildFrame::GetParentForWindowlessPlugin()
334     const {
335   return NULL;
336 }
337 #endif // defined(OS_WIN)
338
339 SkColorType RenderWidgetHostViewChildFrame::PreferredReadbackFormat() {
340   return kN32_SkColorType;
341 }
342
343 BrowserAccessibilityManager*
344 RenderWidgetHostViewChildFrame::CreateBrowserAccessibilityManager(
345     BrowserAccessibilityDelegate* delegate) {
346   return BrowserAccessibilityManager::Create(
347       BrowserAccessibilityManager::GetEmptyDocument(), delegate);
348 }
349
350 }  // namespace content