cc: Make picture pile base thread safe.
[chromium-blink-merge.git] / content / browser / frame_host / render_widget_host_view_child_frame.cc
blobab1bff89c8190f2157608257269ccc371f974589
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.
5 #include "content/browser/frame_host/render_widget_host_view_child_frame.h"
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"
14 namespace content {
16 RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame(
17 RenderWidgetHost* widget_host)
18 : host_(RenderWidgetHostImpl::From(widget_host)),
19 frame_connector_(NULL) {
20 host_->SetView(this);
23 RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() {
26 void RenderWidgetHostViewChildFrame::InitAsChild(
27 gfx::NativeView parent_view) {
28 NOTREACHED();
31 RenderWidgetHost* RenderWidgetHostViewChildFrame::GetRenderWidgetHost() const {
32 return host_;
35 void RenderWidgetHostViewChildFrame::SetSize(const gfx::Size& size) {
36 host_->WasResized();
39 void RenderWidgetHostViewChildFrame::SetBounds(const gfx::Rect& rect) {
40 SetSize(rect.size());
43 void RenderWidgetHostViewChildFrame::Focus() {
46 bool RenderWidgetHostViewChildFrame::HasFocus() const {
47 return false;
50 bool RenderWidgetHostViewChildFrame::IsSurfaceAvailableForCopy() const {
51 NOTIMPLEMENTED();
52 return false;
55 void RenderWidgetHostViewChildFrame::Show() {
56 WasShown();
59 void RenderWidgetHostViewChildFrame::Hide() {
60 WasHidden();
63 bool RenderWidgetHostViewChildFrame::IsShowing() {
64 return !host_->is_hidden();
67 gfx::Rect RenderWidgetHostViewChildFrame::GetViewBounds() const {
68 gfx::Rect rect;
69 if (frame_connector_)
70 rect = frame_connector_->ChildFrameRect();
71 return rect;
74 gfx::Vector2dF RenderWidgetHostViewChildFrame::GetLastScrollOffset() const {
75 return last_scroll_offset_;
78 gfx::NativeView RenderWidgetHostViewChildFrame::GetNativeView() const {
79 NOTREACHED();
80 return NULL;
83 gfx::NativeViewId RenderWidgetHostViewChildFrame::GetNativeViewId() const {
84 NOTREACHED();
85 return 0;
88 gfx::NativeViewAccessible
89 RenderWidgetHostViewChildFrame::GetNativeViewAccessible() {
90 NOTREACHED();
91 return NULL;
94 void RenderWidgetHostViewChildFrame::SetBackgroundColor(SkColor color) {
97 gfx::Size RenderWidgetHostViewChildFrame::GetPhysicalBackingSize() const {
98 gfx::Size size;
99 if (frame_connector_)
100 size = frame_connector_->ChildFrameRect().size();
101 return size;
104 void RenderWidgetHostViewChildFrame::InitAsPopup(
105 RenderWidgetHostView* parent_host_view,
106 const gfx::Rect& pos) {
107 NOTREACHED();
110 void RenderWidgetHostViewChildFrame::InitAsFullscreen(
111 RenderWidgetHostView* reference_host_view) {
112 NOTREACHED();
115 void RenderWidgetHostViewChildFrame::ImeCancelComposition() {
116 NOTREACHED();
119 #if defined(OS_MACOSX) || defined(USE_AURA) || defined(OS_ANDROID)
120 void RenderWidgetHostViewChildFrame::ImeCompositionRangeChanged(
121 const gfx::Range& range,
122 const std::vector<gfx::Rect>& character_bounds) {
123 NOTREACHED();
125 #endif
127 void RenderWidgetHostViewChildFrame::WasShown() {
128 if (!host_->is_hidden())
129 return;
130 host_->WasShown(ui::LatencyInfo());
133 void RenderWidgetHostViewChildFrame::WasHidden() {
134 if (host_->is_hidden())
135 return;
136 host_->WasHidden();
139 void RenderWidgetHostViewChildFrame::MovePluginWindows(
140 const std::vector<WebPluginGeometry>& moves) {
143 void RenderWidgetHostViewChildFrame::Blur() {
146 void RenderWidgetHostViewChildFrame::UpdateCursor(const WebCursor& cursor) {
149 void RenderWidgetHostViewChildFrame::SetIsLoading(bool is_loading) {
150 NOTREACHED();
153 void RenderWidgetHostViewChildFrame::TextInputTypeChanged(
154 ui::TextInputType type,
155 ui::TextInputMode input_mode,
156 bool can_compose_inline,
157 int flags) {
158 NOTREACHED();
161 void RenderWidgetHostViewChildFrame::RenderProcessGone(
162 base::TerminationStatus status,
163 int error_code) {
164 if (frame_connector_)
165 frame_connector_->RenderProcessGone();
166 Destroy();
169 void RenderWidgetHostViewChildFrame::Destroy() {
170 if (frame_connector_) {
171 frame_connector_->set_view(NULL);
172 frame_connector_ = NULL;
175 host_->SetView(NULL);
176 host_ = NULL;
177 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
180 void RenderWidgetHostViewChildFrame::SetTooltipText(
181 const base::string16& tooltip_text) {
184 void RenderWidgetHostViewChildFrame::SelectionChanged(
185 const base::string16& text,
186 size_t offset,
187 const gfx::Range& range) {
190 void RenderWidgetHostViewChildFrame::SelectionBoundsChanged(
191 const ViewHostMsg_SelectionBounds_Params& params) {
194 #if defined(OS_ANDROID)
195 void RenderWidgetHostViewChildFrame::LockCompositingSurface() {
198 void RenderWidgetHostViewChildFrame::UnlockCompositingSurface() {
200 #endif
202 void RenderWidgetHostViewChildFrame::OnSwapCompositorFrame(
203 uint32 output_surface_id,
204 scoped_ptr<cc::CompositorFrame> frame) {
205 last_scroll_offset_ = frame->metadata.root_scroll_offset;
206 if (frame_connector_) {
207 frame_connector_->ChildFrameCompositorFrameSwapped(
208 output_surface_id,
209 host_->GetProcess()->GetID(),
210 host_->GetRoutingID(),
211 frame.Pass());
215 void RenderWidgetHostViewChildFrame::GetScreenInfo(
216 blink::WebScreenInfo* results) {
219 gfx::Rect RenderWidgetHostViewChildFrame::GetBoundsInRootWindow() {
220 // We do not have any root window specific parts in this view.
221 return GetViewBounds();
224 #if defined(USE_AURA)
225 void RenderWidgetHostViewChildFrame::ProcessAckedTouchEvent(
226 const TouchEventWithLatencyInfo& touch,
227 InputEventAckState ack_result) {
229 #endif // defined(USE_AURA)
231 bool RenderWidgetHostViewChildFrame::LockMouse() {
232 return false;
235 void RenderWidgetHostViewChildFrame::UnlockMouse() {
238 #if defined(OS_MACOSX)
239 void RenderWidgetHostViewChildFrame::SetActive(bool active) {
242 void RenderWidgetHostViewChildFrame::SetWindowVisibility(bool visible) {
245 void RenderWidgetHostViewChildFrame::WindowFrameChanged() {
248 void RenderWidgetHostViewChildFrame::ShowDefinitionForSelection() {
251 bool RenderWidgetHostViewChildFrame::SupportsSpeech() const {
252 return false;
255 void RenderWidgetHostViewChildFrame::SpeakSelection() {
258 bool RenderWidgetHostViewChildFrame::IsSpeaking() const {
259 return false;
262 void RenderWidgetHostViewChildFrame::StopSpeaking() {
265 bool RenderWidgetHostViewChildFrame::PostProcessEventForPluginIme(
266 const NativeWebKeyboardEvent& event) {
267 return false;
269 #endif // defined(OS_MACOSX)
271 void RenderWidgetHostViewChildFrame::CopyFromCompositingSurface(
272 const gfx::Rect& src_subrect,
273 const gfx::Size& /* dst_size */,
274 CopyFromCompositingSurfaceCallback& callback,
275 const SkColorType color_type) {
276 callback.Run(false, SkBitmap());
279 void RenderWidgetHostViewChildFrame::CopyFromCompositingSurfaceToVideoFrame(
280 const gfx::Rect& src_subrect,
281 const scoped_refptr<media::VideoFrame>& target,
282 const base::Callback<void(bool)>& callback) {
283 NOTIMPLEMENTED();
284 callback.Run(false);
287 bool RenderWidgetHostViewChildFrame::CanCopyToVideoFrame() const {
288 return false;
291 bool RenderWidgetHostViewChildFrame::HasAcceleratedSurface(
292 const gfx::Size& desired_size) {
293 return false;
296 gfx::GLSurfaceHandle RenderWidgetHostViewChildFrame::GetCompositingSurface() {
297 return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::NULL_TRANSPORT);
300 #if defined(OS_WIN)
301 void RenderWidgetHostViewChildFrame::SetParentNativeViewAccessible(
302 gfx::NativeViewAccessible accessible_parent) {
305 gfx::NativeViewId RenderWidgetHostViewChildFrame::GetParentForWindowlessPlugin()
306 const {
307 return NULL;
309 #endif // defined(OS_WIN)
311 SkColorType RenderWidgetHostViewChildFrame::PreferredReadbackFormat() {
312 return kN32_SkColorType;
315 BrowserAccessibilityManager*
316 RenderWidgetHostViewChildFrame::CreateBrowserAccessibilityManager(
317 BrowserAccessibilityDelegate* delegate) {
318 return BrowserAccessibilityManager::Create(
319 BrowserAccessibilityManager::GetEmptyDocument(), delegate);
322 } // namespace content