| 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 <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1200 } | 1200 } |
| 1201 | 1201 |
| 1202 void RenderWidgetHostViewAndroid::ClearCompositorFrame() { | 1202 void RenderWidgetHostViewAndroid::ClearCompositorFrame() { |
| 1203 DestroyDelegatedContent(); | 1203 DestroyDelegatedContent(); |
| 1204 } | 1204 } |
| 1205 | 1205 |
| 1206 void RenderWidgetHostViewAndroid::SynchronousFrameMetadata( | 1206 void RenderWidgetHostViewAndroid::SynchronousFrameMetadata( |
| 1207 cc::CompositorFrameMetadata frame_metadata) { | 1207 cc::CompositorFrameMetadata frame_metadata) { |
| 1208 if (!content_view_core_) | 1208 if (!content_view_core_) |
| 1209 return; | 1209 return; |
| 1210 | 1210 bool enable_force_zoom = false; |
| 1211 bool is_mobile_optimized = IsMobileOptimizedFrame(frame_metadata); | 1211 if (host_) |
| 1212 enable_force_zoom = |
| 1213 RenderViewHost::From(host_)->GetWebkitPreferences().force_enable_zoom; |
| 1214 bool is_mobile_optimized = |
| 1215 IsMobileOptimizedFrame(frame_metadata, enable_force_zoom); |
| 1212 | 1216 |
| 1213 if (host_ && host_->input_router()) { | 1217 if (host_ && host_->input_router()) { |
| 1214 host_->input_router()->NotifySiteIsMobileOptimized( | 1218 host_->input_router()->NotifySiteIsMobileOptimized( |
| 1215 is_mobile_optimized); | 1219 is_mobile_optimized); |
| 1216 } | 1220 } |
| 1217 | 1221 |
| 1218 // This is a subset of OnSwapCompositorFrame() used in the synchronous | 1222 // This is a subset of OnSwapCompositorFrame() used in the synchronous |
| 1219 // compositor flow. | 1223 // compositor flow. |
| 1220 OnFrameMetadataUpdated(frame_metadata.Clone(), false); | 1224 OnFrameMetadataUpdated(frame_metadata.Clone(), false); |
| 1221 | 1225 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1338 canvas.scale( | 1342 canvas.scale( |
| 1339 (float)output_width / (float)input_size_in_pixel.width(), | 1343 (float)output_width / (float)input_size_in_pixel.width(), |
| 1340 (float)output_height / (float)input_size_in_pixel.height()); | 1344 (float)output_height / (float)input_size_in_pixel.height()); |
| 1341 sync_compositor_->DemandDrawSw(&canvas); | 1345 sync_compositor_->DemandDrawSw(&canvas); |
| 1342 callback.Run(bitmap, READBACK_SUCCESS); | 1346 callback.Run(bitmap, READBACK_SUCCESS); |
| 1343 } | 1347 } |
| 1344 | 1348 |
| 1345 void RenderWidgetHostViewAndroid::OnFrameMetadataUpdated( | 1349 void RenderWidgetHostViewAndroid::OnFrameMetadataUpdated( |
| 1346 const cc::CompositorFrameMetadata& frame_metadata, | 1350 const cc::CompositorFrameMetadata& frame_metadata, |
| 1347 bool is_transparent) { | 1351 bool is_transparent) { |
| 1348 bool is_mobile_optimized = IsMobileOptimizedFrame(frame_metadata); | 1352 bool enable_force_zoom = false; |
| 1353 if (host_) |
| 1354 enable_force_zoom = |
| 1355 RenderViewHost::From(host_)->GetWebkitPreferences().force_enable_zoom; |
| 1356 bool is_mobile_optimized = |
| 1357 IsMobileOptimizedFrame(frame_metadata, enable_force_zoom); |
| 1349 gesture_provider_.SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); | 1358 gesture_provider_.SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); |
| 1350 | 1359 |
| 1351 if (!content_view_core_) | 1360 if (!content_view_core_) |
| 1352 return; | 1361 return; |
| 1353 | 1362 |
| 1354 if (overscroll_controller_) | 1363 if (overscroll_controller_) |
| 1355 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); | 1364 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); |
| 1356 | 1365 |
| 1357 if (selection_controller_) { | 1366 if (selection_controller_) { |
| 1358 selection_controller_->OnSelectionBoundsChanged( | 1367 selection_controller_->OnSelectionBoundsChanged( |
| (...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2130 | 2139 |
| 2131 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); | 2140 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); |
| 2132 if (!compositor) | 2141 if (!compositor) |
| 2133 return; | 2142 return; |
| 2134 | 2143 |
| 2135 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( | 2144 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( |
| 2136 overscroll_refresh_handler, compositor, view_.GetDipScale()); | 2145 overscroll_refresh_handler, compositor, view_.GetDipScale()); |
| 2137 } | 2146 } |
| 2138 | 2147 |
| 2139 } // namespace content | 2148 } // namespace content |
| OLD | NEW |