render_widget_host_view_child_frame.cc revision 0529e5d033099cbfc42635f6f6183833b09dff6e
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::SetBackground( 90 const SkBitmap& background) { 91} 92 93gfx::Size RenderWidgetHostViewChildFrame::GetPhysicalBackingSize() const { 94 gfx::Size size; 95 if (frame_connector_) 96 size = frame_connector_->ChildFrameRect().size(); 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(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 Destroy(); 171} 172 173void RenderWidgetHostViewChildFrame::Destroy() { 174 if (frame_connector_) { 175 frame_connector_->set_view(NULL); 176 frame_connector_ = NULL; 177 } 178 179 host_->SetView(NULL); 180 host_ = NULL; 181 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); 182} 183 184void RenderWidgetHostViewChildFrame::SetTooltipText( 185 const base::string16& tooltip_text) { 186} 187 188void RenderWidgetHostViewChildFrame::SelectionChanged( 189 const base::string16& text, 190 size_t offset, 191 const gfx::Range& range) { 192} 193 194void RenderWidgetHostViewChildFrame::SelectionBoundsChanged( 195 const ViewHostMsg_SelectionBounds_Params& params) { 196} 197 198#if defined(OS_ANDROID) 199void RenderWidgetHostViewChildFrame::SelectionRootBoundsChanged( 200 const gfx::Rect& bounds) { 201} 202#endif 203 204void RenderWidgetHostViewChildFrame::ScrollOffsetChanged() { 205} 206 207void RenderWidgetHostViewChildFrame::OnAcceleratedCompositingStateChange() { 208} 209 210void RenderWidgetHostViewChildFrame::AcceleratedSurfaceInitialized(int host_id, 211 int route_id) { 212} 213 214void RenderWidgetHostViewChildFrame::AcceleratedSurfaceBuffersSwapped( 215 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, 216 int gpu_host_id) { 217 if (frame_connector_) 218 frame_connector_->ChildFrameBuffersSwapped(params, gpu_host_id); 219} 220 221void RenderWidgetHostViewChildFrame::AcceleratedSurfacePostSubBuffer( 222 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, 223 int gpu_host_id) { 224} 225 226void RenderWidgetHostViewChildFrame::OnSwapCompositorFrame( 227 uint32 output_surface_id, 228 scoped_ptr<cc::CompositorFrame> frame) { 229 if (frame_connector_) { 230 frame_connector_->ChildFrameCompositorFrameSwapped( 231 output_surface_id, 232 host_->GetProcess()->GetID(), 233 host_->GetRoutingID(), 234 frame.Pass()); 235 } 236} 237 238void RenderWidgetHostViewChildFrame::GetScreenInfo( 239 blink::WebScreenInfo* results) { 240} 241 242gfx::Rect RenderWidgetHostViewChildFrame::GetBoundsInRootWindow() { 243 // We do not have any root window specific parts in this view. 244 return GetViewBounds(); 245} 246 247#if defined(USE_AURA) 248void RenderWidgetHostViewChildFrame::ProcessAckedTouchEvent( 249 const TouchEventWithLatencyInfo& touch, 250 InputEventAckState ack_result) { 251} 252#endif // defined(USE_AURA) 253 254bool RenderWidgetHostViewChildFrame::LockMouse() { 255 return false; 256} 257 258void RenderWidgetHostViewChildFrame::UnlockMouse() { 259} 260 261#if defined(OS_MACOSX) 262void RenderWidgetHostViewChildFrame::SetActive(bool active) { 263} 264 265void RenderWidgetHostViewChildFrame::SetTakesFocusOnlyOnMouseDown(bool flag) { 266} 267 268void RenderWidgetHostViewChildFrame::SetWindowVisibility(bool visible) { 269} 270 271void RenderWidgetHostViewChildFrame::WindowFrameChanged() { 272} 273 274void RenderWidgetHostViewChildFrame::ShowDefinitionForSelection() { 275} 276 277bool RenderWidgetHostViewChildFrame::SupportsSpeech() const { 278 return false; 279} 280 281void RenderWidgetHostViewChildFrame::SpeakSelection() { 282} 283 284bool RenderWidgetHostViewChildFrame::IsSpeaking() const { 285 return false; 286} 287 288void RenderWidgetHostViewChildFrame::StopSpeaking() { 289} 290 291bool RenderWidgetHostViewChildFrame::PostProcessEventForPluginIme( 292 const NativeWebKeyboardEvent& event) { 293 return false; 294} 295#endif // defined(OS_MACOSX) 296 297#if defined(OS_ANDROID) 298void RenderWidgetHostViewChildFrame::ShowDisambiguationPopup( 299 const gfx::Rect& target_rect, 300 const SkBitmap& zoomed_bitmap) { 301} 302#endif // defined(OS_ANDROID) 303 304void RenderWidgetHostViewChildFrame::CopyFromCompositingSurface( 305 const gfx::Rect& src_subrect, 306 const gfx::Size& /* dst_size */, 307 const base::Callback<void(bool, const SkBitmap&)>& callback, 308 const SkBitmap::Config config) { 309 callback.Run(false, SkBitmap()); 310} 311 312void RenderWidgetHostViewChildFrame::CopyFromCompositingSurfaceToVideoFrame( 313 const gfx::Rect& src_subrect, 314 const scoped_refptr<media::VideoFrame>& target, 315 const base::Callback<void(bool)>& callback) { 316 NOTIMPLEMENTED(); 317 callback.Run(false); 318} 319 320bool RenderWidgetHostViewChildFrame::CanCopyToVideoFrame() const { 321 return false; 322} 323 324void RenderWidgetHostViewChildFrame::AcceleratedSurfaceSuspend() { 325 NOTREACHED(); 326} 327 328void RenderWidgetHostViewChildFrame::AcceleratedSurfaceRelease() { 329} 330 331bool RenderWidgetHostViewChildFrame::HasAcceleratedSurface( 332 const gfx::Size& desired_size) { 333 return false; 334} 335 336gfx::GLSurfaceHandle RenderWidgetHostViewChildFrame::GetCompositingSurface() { 337 return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::TEXTURE_TRANSPORT); 338} 339 340void RenderWidgetHostViewChildFrame::SetHasHorizontalScrollbar( 341 bool has_horizontal_scrollbar) { 342} 343 344void RenderWidgetHostViewChildFrame::SetScrollOffsetPinning( 345 bool is_pinned_to_left, bool is_pinned_to_right) { 346} 347 348#if defined(OS_WIN) 349void RenderWidgetHostViewChildFrame::SetParentNativeViewAccessible( 350 gfx::NativeViewAccessible accessible_parent) { 351} 352 353gfx::NativeViewId RenderWidgetHostViewChildFrame::GetParentForWindowlessPlugin() 354 const { 355 return NULL; 356} 357#endif // defined(OS_WIN) 358 359SkBitmap::Config RenderWidgetHostViewChildFrame::PreferredReadbackFormat() { 360 return SkBitmap::kARGB_8888_Config; 361} 362 363} // namespace content 364