Chromium Code Reviews| Index: content/browser/frame_host/render_widget_host_view_child_frame.cc |
| diff --git a/content/browser/frame_host/render_widget_host_view_child_frame.cc b/content/browser/frame_host/render_widget_host_view_child_frame.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..163aec1782438e180fc296d0809a388034f3f5c4 |
| --- /dev/null |
| +++ b/content/browser/frame_host/render_widget_host_view_child_frame.cc |
| @@ -0,0 +1,281 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| + |
| +#include "content/browser/frame_host/cross_process_frame_connector.h" |
| +#include "content/browser/renderer_host/render_widget_host_impl.h" |
| +#include "content/common/gpu/gpu_messages.h" |
| +#include "content/common/view_messages.h" |
| +#include "content/public/browser/render_process_host.h" |
| + |
| +namespace content { |
| + |
| +RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame( |
| + RenderWidgetHost* widget_host) |
| + : host_(RenderWidgetHostImpl::From(widget_host)), |
| + frame_connector_(NULL) { |
| + host_->SetView(this); |
| +} |
| + |
| +RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() { |
| +} |
| + |
| +void RenderWidgetHostViewChildFrame::SetCrossProcessFrameConnector( |
| + CrossProcessFrameConnector* frame_connector) { |
| + frame_connector_ = frame_connector; |
| +} |
| + |
| +void RenderWidgetHostViewChildFrame::InitAsChild( |
| + gfx::NativeView parent_view) { |
| + NOTREACHED(); |
| +} |
| + |
| +RenderWidgetHost* RenderWidgetHostViewChildFrame::GetRenderWidgetHost() const { |
| + return host_; |
| +} |
| + |
| +void RenderWidgetHostViewChildFrame::SetSize(const gfx::Size& size) { |
| + size_ = size; |
| + host_->WasResized(); |
| +} |
| + |
| +void RenderWidgetHostViewChildFrame::SetBounds(const gfx::Rect& rect) { |
| + SetSize(rect.size()); |
| +} |
| + |
| +void RenderWidgetHostViewChildFrame::Focus() { |
| +} |
| + |
| +bool RenderWidgetHostViewChildFrame::HasFocus() const { |
| + return false; |
| +} |
| + |
| +bool RenderWidgetHostViewChildFrame::IsSurfaceAvailableForCopy() const { |
| + NOTIMPLEMENTED(); |
| + return false; |
| +} |
| + |
| +void RenderWidgetHostViewChildFrame::Show() { |
| + WasShown(); |
| +} |
| + |
| +void RenderWidgetHostViewChildFrame::Hide() { |
| + WasHidden(); |
| +} |
| + |
| +bool RenderWidgetHostViewChildFrame::IsShowing() { |
| + return !host_->is_hidden(); |
| +} |
| + |
| +gfx::Rect RenderWidgetHostViewChildFrame::GetViewBounds() const { |
| + gfx::Rect rect; |
| + if (frame_connector_) |
| + rect = frame_connector_->ChildFrameRect(); |
| + rect.set_width(size_.width()); |
| + rect.set_height(size_.height()); |
| + return rect; |
| +} |
| + |
| +gfx::NativeView RenderWidgetHostViewChildFrame::GetNativeView() const { |
| + NOTREACHED(); |
| + return 0; |
| +} |
| + |
| +gfx::NativeViewId RenderWidgetHostViewChildFrame::GetNativeViewId() const { |
| + NOTREACHED(); |
| + return 0; |
| +} |
| + |
| +gfx::NativeViewAccessible |
| + RenderWidgetHostViewChildFrame::GetNativeViewAccessible() { |
| + NOTREACHED(); |
| + return 0; |
| +} |
| + |
| +gfx::Size RenderWidgetHostViewChildFrame::GetPhysicalBackingSize() const { |
| + return size_; |
| +} |
| + |
| +void RenderWidgetHostViewChildFrame::InitAsPopup( |
| + RenderWidgetHostView* parent_host_view, |
| + const gfx::Rect& pos) { |
| + NOTREACHED(); |
| +} |
| + |
| +void RenderWidgetHostViewChildFrame::InitAsFullscreen( |
| + RenderWidgetHostView* reference_host_view) { |
| + NOTREACHED(); |
| +} |
| + |
| +void RenderWidgetHostViewChildFrame::ImeCancelComposition() { |
| + NOTREACHED(); |
| +} |
| + |
| +#if defined(OS_MACOSX) || defined(OS_WIN) || defined(USE_AURA) |
| +void RenderWidgetHostViewChildFrame::ImeCompositionRangeChanged( |
| + const gfx::Range& range, |
| + const std::vector<gfx::Rect>& character_bounds) { |
| + NOTREACHED(); |
| +} |
| +#endif |
| + |
| +void RenderWidgetHostViewChildFrame::DidUpdateBackingStore( |
| + const gfx::Rect& scroll_rect, |
| + const gfx::Vector2d& scroll_delta, |
| + const std::vector<gfx::Rect>& copy_rects, |
| + const ui::LatencyInfo& latency_info) { |
| + NOTREACHED(); |
| +} |
| + |
| +void RenderWidgetHostViewChildFrame::WasShown() { |
| + if (!host_->is_hidden()) |
| + return; |
| + host_->WasShown(); |
| +} |
| + |
| +void RenderWidgetHostViewChildFrame::WasHidden() { |
| + if (host_->is_hidden()) |
| + return; |
| + host_->WasHidden(); |
| +} |
| + |
| +void RenderWidgetHostViewChildFrame::Destroy() { |
| + if (frame_connector_) { |
| + frame_connector_->Destroy(); |
|
awong
2013/12/14 02:25:14
Hmm...this looks like RenderWidgetHostViewChildFra
|
| + frame_connector_ = NULL; |
| + } |
| + |
| + host_->SetView(NULL); |
| + host_ = NULL; |
| + base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| +} |
| + |
| +void RenderWidgetHostViewChildFrame::OnAcceleratedCompositingStateChange() { |
|
nasko
2013/12/16 23:16:32
There are several empty methods here, why not keep
|
| +} |
| + |
| +void RenderWidgetHostViewChildFrame::AcceleratedSurfaceInitialized(int host_id, |
| + int route_id) { |
| +} |
| + |
| +void RenderWidgetHostViewChildFrame::AcceleratedSurfaceBuffersSwapped( |
| + const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
| + int gpu_host_id) { |
| + if (frame_connector_) |
| + frame_connector_->ChildFrameBuffersSwapped(params, gpu_host_id); |
| +} |
| + |
| +void RenderWidgetHostViewChildFrame::OnSwapCompositorFrame( |
| + uint32 output_surface_id, |
| + scoped_ptr<cc::CompositorFrame> frame) { |
| + if (frame_connector_) |
| + frame_connector_->ChildFrameCompositorFrameSwapped( |
| + output_surface_id, frame.Pass()); |
| +} |
| + |
| +gfx::Rect RenderWidgetHostViewChildFrame::GetBoundsInRootWindow() { |
| + // We do not have any root window specific parts in this view. |
| + return GetViewBounds(); |
| +} |
| + |
| +bool RenderWidgetHostViewChildFrame::LockMouse() { |
| + return false; |
| +} |
| + |
| +#if defined(OS_MACOSX) |
| +bool RenderWidgetHostViewChildFrame::SupportsSpeech() const { |
| + return false; |
| +} |
| + |
| +bool RenderWidgetHostViewChildFrame::IsSpeaking() const { |
| + return false; |
| +} |
| + |
| +bool RenderWidgetHostViewChildFrame::PostProcessEventForPluginIme( |
| + const NativeWebKeyboardEvent& event) { |
|
nasko
2013/12/16 23:16:32
style: Only 4 spaces for indent.
|
| + return false; |
| +} |
| +#endif // defined(OS_MACOSX) |
| + |
| +#if defined(TOOLKIT_GTK) |
| +GdkEventButton* RenderWidgetHostViewChildFrame::GetLastMouseDown() { |
| + return 0; |
| +} |
| + |
| +gfx::NativeView RenderWidgetHostViewChildFrame::BuildInputMethodsGtkMenu() { |
| + return 0; |
| +} |
| +#endif // defined(TOOLKIT_GTK) |
| + |
| +void RenderWidgetHostViewChildFrame::Blur() { |
| +} |
| + |
| +void RenderWidgetHostViewChildFrame::SetIsLoading(bool is_loading) { |
| + NOTREACHED(); |
| +} |
| + |
| +void RenderWidgetHostViewChildFrame::TextInputTypeChanged( |
| + ui::TextInputType type, |
| + ui::TextInputMode input_mode, |
| + bool can_compose_inline) { |
| + NOTREACHED(); |
| +} |
| + |
| +void RenderWidgetHostViewChildFrame::ScrollOffsetChanged() { |
| +} |
| + |
| +BackingStore* RenderWidgetHostViewChildFrame::AllocBackingStore( |
| + const gfx::Size& size) { |
| + NOTREACHED(); |
| + return NULL; |
| +} |
| + |
| +void RenderWidgetHostViewChildFrame::CopyFromCompositingSurface( |
| + const gfx::Rect& src_subrect, |
| + const gfx::Size& /* dst_size */, |
| + const base::Callback<void(bool, const SkBitmap&)>& callback) { |
| + callback.Run(false, SkBitmap()); |
| +} |
| + |
| +void RenderWidgetHostViewChildFrame::CopyFromCompositingSurfaceToVideoFrame( |
| + const gfx::Rect& src_subrect, |
|
nasko
2013/12/16 23:16:32
style: Only 4 spaces needed.
|
| + const scoped_refptr<media::VideoFrame>& target, |
| + const base::Callback<void(bool)>& callback) { |
| + NOTIMPLEMENTED(); |
| + callback.Run(false); |
| +} |
| + |
| +bool RenderWidgetHostViewChildFrame::CanCopyToVideoFrame() const { |
| + return false; |
| +} |
| + |
| +void RenderWidgetHostViewChildFrame::AcceleratedSurfaceSuspend() { |
| + NOTREACHED(); |
| +} |
| + |
| +void RenderWidgetHostViewChildFrame::AcceleratedSurfaceRelease() { |
| +} |
| + |
| +bool RenderWidgetHostViewChildFrame::HasAcceleratedSurface( |
| + const gfx::Size& desired_size) { |
|
nasko
2013/12/16 23:16:32
style: Only 4 space needed.
|
| + return false; |
| +} |
| + |
| +#if defined(OS_WIN) && !defined(USE_AURA) |
| +void RenderWidgetHostViewChildFrame::SetClickthroughRegion(SkRegion* region) { |
| +} |
| +#endif // defined(OS_WIN) && !defined(USE_AURA) |
| + |
| +gfx::GLSurfaceHandle RenderWidgetHostViewChildFrame::GetCompositingSurface() { |
| + return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::TEXTURE_TRANSPORT); |
| +} |
| + |
| +#if defined(OS_WIN) && defined(USE_AURA) |
| +gfx::NativeViewId RenderWidgetHostViewChildFrame::GetParentForWindowlessPlugin() |
| + const { |
| + return 0; |
| +} |
| +#endif // defined(OS_WIN) && defined(USE_AURA) |
| + |
| +} // namespace content |