| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
| 6 | 6 |
| 7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
| 8 | 8 |
| 9 #include "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1224 frame_metadata.location_bar_content_translation); | 1224 frame_metadata.location_bar_content_translation); |
| 1225 #if defined(VIDEO_HOLE) | 1225 #if defined(VIDEO_HOLE) |
| 1226 if (host_ && host_->IsRenderView()) { | 1226 if (host_ && host_->IsRenderView()) { |
| 1227 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( | 1227 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( |
| 1228 RenderViewHost::From(host_)); | 1228 RenderViewHost::From(host_)); |
| 1229 rvhi->media_web_contents_observer()->OnFrameInfoUpdated(); | 1229 rvhi->media_web_contents_observer()->OnFrameInfoUpdated(); |
| 1230 } | 1230 } |
| 1231 #endif // defined(VIDEO_HOLE) | 1231 #endif // defined(VIDEO_HOLE) |
| 1232 } | 1232 } |
| 1233 | 1233 |
| 1234 void RenderWidgetHostViewAndroid::AcceleratedSurfaceInitialized(int host_id, | 1234 void RenderWidgetHostViewAndroid::AcceleratedSurfaceInitialized(int route_id) { |
| 1235 int route_id) { | 1235 // TODO: remove need for the surface id here |
| 1236 accelerated_surface_route_id_ = route_id; | 1236 accelerated_surface_route_id_ = route_id; |
| 1237 } | 1237 } |
| 1238 | 1238 |
| 1239 void RenderWidgetHostViewAndroid::AcceleratedSurfaceBuffersSwapped( | |
| 1240 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, | |
| 1241 int gpu_host_id) { | |
| 1242 NOTREACHED() << "Need --composite-to-mailbox or --enable-delegated-renderer"; | |
| 1243 } | |
| 1244 | |
| 1245 void RenderWidgetHostViewAndroid::AttachLayers() { | 1239 void RenderWidgetHostViewAndroid::AttachLayers() { |
| 1246 if (!content_view_core_) | 1240 if (!content_view_core_) |
| 1247 return; | 1241 return; |
| 1248 if (!layer_.get()) | 1242 if (!layer_.get()) |
| 1249 return; | 1243 return; |
| 1250 | 1244 |
| 1251 content_view_core_->AttachLayer(layer_); | 1245 content_view_core_->AttachLayer(layer_); |
| 1252 if (overscroll_effect_) | 1246 if (overscroll_effect_) |
| 1253 overscroll_effect_->Enable(); | 1247 overscroll_effect_->Enable(); |
| 1254 layer_->SetHideLayerAndSubtree(!is_showing_); | 1248 layer_->SetHideLayerAndSubtree(!is_showing_); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1326 } | 1320 } |
| 1327 | 1321 |
| 1328 bool RenderWidgetHostViewAndroid::Animate(base::TimeTicks frame_time) { | 1322 bool RenderWidgetHostViewAndroid::Animate(base::TimeTicks frame_time) { |
| 1329 bool needs_animate = | 1323 bool needs_animate = |
| 1330 overscroll_effect_ ? overscroll_effect_->Animate(frame_time) : false; | 1324 overscroll_effect_ ? overscroll_effect_->Animate(frame_time) : false; |
| 1331 if (selection_controller_) | 1325 if (selection_controller_) |
| 1332 needs_animate |= selection_controller_->Animate(frame_time); | 1326 needs_animate |= selection_controller_->Animate(frame_time); |
| 1333 return needs_animate; | 1327 return needs_animate; |
| 1334 } | 1328 } |
| 1335 | 1329 |
| 1336 void RenderWidgetHostViewAndroid::AcceleratedSurfacePostSubBuffer( | |
| 1337 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, | |
| 1338 int gpu_host_id) { | |
| 1339 NOTREACHED(); | |
| 1340 } | |
| 1341 | |
| 1342 void RenderWidgetHostViewAndroid::AcceleratedSurfaceSuspend() { | |
| 1343 NOTREACHED(); | |
| 1344 } | |
| 1345 | |
| 1346 void RenderWidgetHostViewAndroid::AcceleratedSurfaceRelease() { | |
| 1347 NOTREACHED(); | |
| 1348 } | |
| 1349 | |
| 1350 void RenderWidgetHostViewAndroid::EvictDelegatedFrame() { | 1330 void RenderWidgetHostViewAndroid::EvictDelegatedFrame() { |
| 1351 if (layer_.get()) | 1331 if (layer_.get()) |
| 1352 DestroyDelegatedContent(); | 1332 DestroyDelegatedContent(); |
| 1353 frame_evictor_->DiscardedFrame(); | 1333 frame_evictor_->DiscardedFrame(); |
| 1354 // We are evicting the delegated frame, | 1334 // We are evicting the delegated frame, |
| 1355 // so there should be no pending readback requests | 1335 // so there should be no pending readback requests |
| 1356 DCHECK(readbacks_waiting_for_frame_.empty()); | 1336 DCHECK(readbacks_waiting_for_frame_.empty()); |
| 1357 } | 1337 } |
| 1358 | 1338 |
| 1359 bool RenderWidgetHostViewAndroid::HasAcceleratedSurface( | 1339 bool RenderWidgetHostViewAndroid::HasAcceleratedSurface( |
| 1360 const gfx::Size& desired_size) { | 1340 const gfx::Size& desired_size) { |
| 1361 NOTREACHED(); | 1341 NOTREACHED(); |
| 1362 return false; | 1342 return false; |
| 1363 } | 1343 } |
| 1364 | 1344 |
| 1365 void RenderWidgetHostViewAndroid::GetScreenInfo(blink::WebScreenInfo* result) { | 1345 void RenderWidgetHostViewAndroid::GetScreenInfo(blink::WebScreenInfo* result) { |
| 1366 // ScreenInfo isn't tied to the widget on Android. Always return the default. | 1346 // ScreenInfo isn't tied to the widget on Android. Always return the default. |
| 1367 RenderWidgetHostViewBase::GetDefaultScreenInfo(result); | 1347 RenderWidgetHostViewBase::GetDefaultScreenInfo(result); |
| 1368 } | 1348 } |
| 1369 | 1349 |
| 1370 // TODO(jrg): Find out the implications and answer correctly here, | 1350 // TODO(jrg): Find out the implications and answer correctly here, |
| 1371 // as we are returning the WebView and not root window bounds. | 1351 // as we are returning the WebView and not root window bounds. |
| 1372 gfx::Rect RenderWidgetHostViewAndroid::GetBoundsInRootWindow() { | 1352 gfx::Rect RenderWidgetHostViewAndroid::GetBoundsInRootWindow() { |
| 1373 return GetViewBounds(); | 1353 return GetViewBounds(); |
| 1374 } | 1354 } |
| 1375 | 1355 |
| 1376 gfx::GLSurfaceHandle RenderWidgetHostViewAndroid::GetCompositingSurface() { | 1356 gfx::GLSurfaceHandle RenderWidgetHostViewAndroid::GetCompositingSurface() { |
| 1377 gfx::GLSurfaceHandle handle = | 1357 gfx::GLSurfaceHandle handle = |
| 1378 gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::NATIVE_TRANSPORT); | 1358 gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::NULL_TRANSPORT); |
| 1379 if (CompositorImpl::IsInitialized()) { | 1359 if (CompositorImpl::IsInitialized()) { |
| 1380 handle.parent_client_id = | 1360 handle.parent_client_id = |
| 1381 ImageTransportFactoryAndroid::GetInstance()->GetChannelID(); | 1361 ImageTransportFactoryAndroid::GetInstance()->GetChannelID(); |
| 1382 } | 1362 } |
| 1383 return handle; | 1363 return handle; |
| 1384 } | 1364 } |
| 1385 | 1365 |
| 1386 void RenderWidgetHostViewAndroid::ProcessAckedTouchEvent( | 1366 void RenderWidgetHostViewAndroid::ProcessAckedTouchEvent( |
| 1387 const TouchEventWithLatencyInfo& touch, InputEventAckState ack_result) { | 1367 const TouchEventWithLatencyInfo& touch, InputEventAckState ack_result) { |
| 1388 const bool event_consumed = ack_result == INPUT_EVENT_ACK_STATE_CONSUMED; | 1368 const bool event_consumed = ack_result == INPUT_EVENT_ACK_STATE_CONSUMED; |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1807 results->orientationAngle = display.RotationAsDegree(); | 1787 results->orientationAngle = display.RotationAsDegree(); |
| 1808 results->orientationType = | 1788 results->orientationType = |
| 1809 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 1789 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
| 1810 gfx::DeviceDisplayInfo info; | 1790 gfx::DeviceDisplayInfo info; |
| 1811 results->depth = info.GetBitsPerPixel(); | 1791 results->depth = info.GetBitsPerPixel(); |
| 1812 results->depthPerComponent = info.GetBitsPerComponent(); | 1792 results->depthPerComponent = info.GetBitsPerComponent(); |
| 1813 results->isMonochrome = (results->depthPerComponent == 0); | 1793 results->isMonochrome = (results->depthPerComponent == 0); |
| 1814 } | 1794 } |
| 1815 | 1795 |
| 1816 } // namespace content | 1796 } // namespace content |
| OLD | NEW |