render_widget_host_view_child_frame.cc revision 6e8cce623b6e4fe0c9e4af605d675dd9d0338c38
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(ui::LatencyInfo()); 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::TextInputStateChanged( 149 const ViewHostMsg_TextInputState_Params& params) { 150} 151 152void RenderWidgetHostViewChildFrame::RenderProcessGone( 153 base::TerminationStatus status, 154 int error_code) { 155 if (frame_connector_) 156 frame_connector_->RenderProcessGone(); 157 Destroy(); 158} 159 160void RenderWidgetHostViewChildFrame::Destroy() { 161 if (frame_connector_) { 162 frame_connector_->set_view(NULL); 163 frame_connector_ = NULL; 164 } 165 166 host_->SetView(NULL); 167 host_ = NULL; 168 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); 169} 170 171void RenderWidgetHostViewChildFrame::SetTooltipText( 172 const base::string16& tooltip_text) { 173} 174 175void RenderWidgetHostViewChildFrame::SelectionChanged( 176 const base::string16& text, 177 size_t offset, 178 const gfx::Range& range) { 179} 180 181void RenderWidgetHostViewChildFrame::SelectionBoundsChanged( 182 const ViewHostMsg_SelectionBounds_Params& params) { 183} 184 185#if defined(OS_ANDROID) 186void RenderWidgetHostViewChildFrame::ShowDisambiguationPopup( 187 const gfx::Rect& target_rect, 188 const SkBitmap& zoomed_bitmap) { 189} 190 191void RenderWidgetHostViewChildFrame::LockCompositingSurface() { 192} 193 194void RenderWidgetHostViewChildFrame::UnlockCompositingSurface() { 195} 196#endif 197 198void RenderWidgetHostViewChildFrame::ScrollOffsetChanged() { 199} 200 201void RenderWidgetHostViewChildFrame::AcceleratedSurfaceInitialized(int host_id, 202 int route_id) { 203} 204 205void RenderWidgetHostViewChildFrame::AcceleratedSurfaceBuffersSwapped( 206 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, 207 int gpu_host_id) { 208 if (frame_connector_) 209 frame_connector_->ChildFrameBuffersSwapped(params, gpu_host_id); 210} 211 212void RenderWidgetHostViewChildFrame::AcceleratedSurfacePostSubBuffer( 213 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, 214 int gpu_host_id) { 215} 216 217void RenderWidgetHostViewChildFrame::OnSwapCompositorFrame( 218 uint32 output_surface_id, 219 scoped_ptr<cc::CompositorFrame> frame) { 220 if (frame_connector_) { 221 frame_connector_->ChildFrameCompositorFrameSwapped( 222 output_surface_id, 223 host_->GetProcess()->GetID(), 224 host_->GetRoutingID(), 225 frame.Pass()); 226 } 227} 228 229void RenderWidgetHostViewChildFrame::GetScreenInfo( 230 blink::WebScreenInfo* results) { 231} 232 233gfx::Rect RenderWidgetHostViewChildFrame::GetBoundsInRootWindow() { 234 // We do not have any root window specific parts in this view. 235 return GetViewBounds(); 236} 237 238#if defined(USE_AURA) 239void RenderWidgetHostViewChildFrame::ProcessAckedTouchEvent( 240 const TouchEventWithLatencyInfo& touch, 241 InputEventAckState ack_result) { 242} 243#endif // defined(USE_AURA) 244 245bool RenderWidgetHostViewChildFrame::LockMouse() { 246 return false; 247} 248 249void RenderWidgetHostViewChildFrame::UnlockMouse() { 250} 251 252#if defined(OS_MACOSX) 253void RenderWidgetHostViewChildFrame::SetActive(bool active) { 254} 255 256void RenderWidgetHostViewChildFrame::SetTakesFocusOnlyOnMouseDown(bool flag) { 257} 258 259void RenderWidgetHostViewChildFrame::SetWindowVisibility(bool visible) { 260} 261 262void RenderWidgetHostViewChildFrame::WindowFrameChanged() { 263} 264 265void RenderWidgetHostViewChildFrame::ShowDefinitionForSelection() { 266} 267 268bool RenderWidgetHostViewChildFrame::SupportsSpeech() const { 269 return false; 270} 271 272void RenderWidgetHostViewChildFrame::SpeakSelection() { 273} 274 275bool RenderWidgetHostViewChildFrame::IsSpeaking() const { 276 return false; 277} 278 279void RenderWidgetHostViewChildFrame::StopSpeaking() { 280} 281 282bool RenderWidgetHostViewChildFrame::PostProcessEventForPluginIme( 283 const NativeWebKeyboardEvent& event) { 284 return false; 285} 286#endif // defined(OS_MACOSX) 287 288void RenderWidgetHostViewChildFrame::CopyFromCompositingSurface( 289 const gfx::Rect& src_subrect, 290 const gfx::Size& /* dst_size */, 291 const base::Callback<void(bool, const SkBitmap&)>& callback, 292 const SkColorType color_type) { 293 callback.Run(false, SkBitmap()); 294} 295 296void RenderWidgetHostViewChildFrame::CopyFromCompositingSurfaceToVideoFrame( 297 const gfx::Rect& src_subrect, 298 const scoped_refptr<media::VideoFrame>& target, 299 const base::Callback<void(bool)>& callback) { 300 NOTIMPLEMENTED(); 301 callback.Run(false); 302} 303 304bool RenderWidgetHostViewChildFrame::CanCopyToVideoFrame() const { 305 return false; 306} 307 308void RenderWidgetHostViewChildFrame::AcceleratedSurfaceSuspend() { 309 NOTREACHED(); 310} 311 312void RenderWidgetHostViewChildFrame::AcceleratedSurfaceRelease() { 313} 314 315bool RenderWidgetHostViewChildFrame::HasAcceleratedSurface( 316 const gfx::Size& desired_size) { 317 return false; 318} 319 320gfx::GLSurfaceHandle RenderWidgetHostViewChildFrame::GetCompositingSurface() { 321 return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::TEXTURE_TRANSPORT); 322} 323 324#if defined(OS_WIN) 325void RenderWidgetHostViewChildFrame::SetParentNativeViewAccessible( 326 gfx::NativeViewAccessible accessible_parent) { 327} 328 329gfx::NativeViewId RenderWidgetHostViewChildFrame::GetParentForWindowlessPlugin() 330 const { 331 return NULL; 332} 333#endif // defined(OS_WIN) 334 335SkColorType RenderWidgetHostViewChildFrame::PreferredReadbackFormat() { 336 return kN32_SkColorType; 337} 338 339BrowserAccessibilityManager* 340RenderWidgetHostViewChildFrame::CreateBrowserAccessibilityManager( 341 BrowserAccessibilityDelegate* delegate) { 342 // This eventually needs to be implemented for cross-process iframes. 343 // http://crbug.com/368298 344 return NULL; 345} 346 347} // namespace content 348