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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 void RenderWidgetHostViewAndroid::WasResized() { | 397 void RenderWidgetHostViewAndroid::WasResized() { |
398 host_->WasResized(); | 398 host_->WasResized(); |
399 } | 399 } |
400 | 400 |
401 void RenderWidgetHostViewAndroid::SetSize(const gfx::Size& size) { | 401 void RenderWidgetHostViewAndroid::SetSize(const gfx::Size& size) { |
402 // Ignore the given size as only the Java code has the power to | 402 // Ignore the given size as only the Java code has the power to |
403 // resize the view on Android. | 403 // resize the view on Android. |
404 default_size_ = size; | 404 default_size_ = size; |
405 } | 405 } |
406 | 406 |
| 407 void RenderWidgetHostViewAndroid::GenerateNewFrameForTesting() { |
| 408 if (content_view_core_) |
| 409 content_view_core_->GenerateNewFrameForTesting(); |
| 410 } |
| 411 |
407 void RenderWidgetHostViewAndroid::SetBounds(const gfx::Rect& rect) { | 412 void RenderWidgetHostViewAndroid::SetBounds(const gfx::Rect& rect) { |
408 SetSize(rect.size()); | 413 SetSize(rect.size()); |
409 } | 414 } |
410 | 415 |
411 void RenderWidgetHostViewAndroid::AbortPendingReadbackRequests() { | 416 void RenderWidgetHostViewAndroid::AbortPendingReadbackRequests() { |
412 while (!readbacks_waiting_for_frame_.empty()) { | 417 while (!readbacks_waiting_for_frame_.empty()) { |
413 ReadbackRequest& readback_request = readbacks_waiting_for_frame_.front(); | 418 ReadbackRequest& readback_request = readbacks_waiting_for_frame_.front(); |
414 readback_request.GetResultCallback().Run(SkBitmap(), READBACK_FAILED); | 419 readback_request.GetResultCallback().Run(SkBitmap(), READBACK_FAILED); |
415 readbacks_waiting_for_frame_.pop(); | 420 readbacks_waiting_for_frame_.pop(); |
416 } | 421 } |
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 | 1100 |
1096 void RenderWidgetHostViewAndroid::ComputeContentsSize( | 1101 void RenderWidgetHostViewAndroid::ComputeContentsSize( |
1097 const cc::CompositorFrameMetadata& frame_metadata) { | 1102 const cc::CompositorFrameMetadata& frame_metadata) { |
1098 // Calculate the content size. This should be 0 if the texture_size is 0. | 1103 // Calculate the content size. This should be 0 if the texture_size is 0. |
1099 gfx::Vector2dF offset; | 1104 gfx::Vector2dF offset; |
1100 if (texture_size_in_layer_.IsEmpty()) | 1105 if (texture_size_in_layer_.IsEmpty()) |
1101 content_size_in_layer_ = gfx::Size(); | 1106 content_size_in_layer_ = gfx::Size(); |
1102 content_size_in_layer_ = gfx::ToCeiledSize(gfx::ScaleSize( | 1107 content_size_in_layer_ = gfx::ToCeiledSize(gfx::ScaleSize( |
1103 frame_metadata.scrollable_viewport_size, | 1108 frame_metadata.scrollable_viewport_size, |
1104 frame_metadata.device_scale_factor * frame_metadata.page_scale_factor)); | 1109 frame_metadata.device_scale_factor * frame_metadata.page_scale_factor)); |
1105 | 1110 last_page_scale_factor_ = frame_metadata.page_scale_factor; |
1106 } | 1111 } |
1107 | 1112 |
1108 void RenderWidgetHostViewAndroid::InternalSwapCompositorFrame( | 1113 void RenderWidgetHostViewAndroid::InternalSwapCompositorFrame( |
1109 uint32 output_surface_id, | 1114 uint32 output_surface_id, |
1110 scoped_ptr<cc::CompositorFrame> frame) { | 1115 scoped_ptr<cc::CompositorFrame> frame) { |
1111 last_scroll_offset_ = frame->metadata.root_scroll_offset; | 1116 last_scroll_offset_ = frame->metadata.root_scroll_offset; |
1112 if (!frame->delegated_frame_data) { | 1117 if (!frame->delegated_frame_data) { |
1113 LOG(ERROR) << "Non-delegated renderer path no longer supported"; | 1118 LOG(ERROR) << "Non-delegated renderer path no longer supported"; |
1114 return; | 1119 return; |
1115 } | 1120 } |
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1911 results->orientationAngle = display.RotationAsDegree(); | 1916 results->orientationAngle = display.RotationAsDegree(); |
1912 results->orientationType = | 1917 results->orientationType = |
1913 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 1918 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
1914 gfx::DeviceDisplayInfo info; | 1919 gfx::DeviceDisplayInfo info; |
1915 results->depth = info.GetBitsPerPixel(); | 1920 results->depth = info.GetBitsPerPixel(); |
1916 results->depthPerComponent = info.GetBitsPerComponent(); | 1921 results->depthPerComponent = info.GetBitsPerComponent(); |
1917 results->isMonochrome = (results->depthPerComponent == 0); | 1922 results->isMonochrome = (results->depthPerComponent == 0); |
1918 } | 1923 } |
1919 | 1924 |
1920 } // namespace content | 1925 } // namespace content |
OLD | NEW |