| 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 28 matching lines...) Expand all Loading... |
| 39 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 39 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
| 40 #include "content/browser/gpu/compositor_util.h" | 40 #include "content/browser/gpu/compositor_util.h" |
| 41 #include "content/browser/gpu/gpu_data_manager_impl.h" | 41 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 42 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 42 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
| 43 #include "content/browser/gpu/gpu_surface_tracker.h" | 43 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 44 #include "content/browser/media/media_web_contents_observer.h" | 44 #include "content/browser/media/media_web_contents_observer.h" |
| 45 #include "content/browser/renderer_host/compositor_impl_android.h" | 45 #include "content/browser/renderer_host/compositor_impl_android.h" |
| 46 #include "content/browser/renderer_host/dip_util.h" | 46 #include "content/browser/renderer_host/dip_util.h" |
| 47 #include "content/browser/renderer_host/frame_metadata_util.h" | 47 #include "content/browser/renderer_host/frame_metadata_util.h" |
| 48 #include "content/browser/renderer_host/input/synthetic_gesture_target_android.h
" | 48 #include "content/browser/renderer_host/input/synthetic_gesture_target_android.h
" |
| 49 #include "content/browser/renderer_host/input/ui_touch_selection_helper.h" |
| 49 #include "content/browser/renderer_host/input/web_input_event_builders_android.h
" | 50 #include "content/browser/renderer_host/input/web_input_event_builders_android.h
" |
| 50 #include "content/browser/renderer_host/input/web_input_event_util.h" | 51 #include "content/browser/renderer_host/input/web_input_event_util.h" |
| 51 #include "content/browser/renderer_host/render_process_host_impl.h" | 52 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 52 #include "content/browser/renderer_host/render_view_host_impl.h" | 53 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 53 #include "content/browser/renderer_host/render_widget_host_impl.h" | 54 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 54 #include "content/common/gpu/client/gl_helper.h" | 55 #include "content/common/gpu/client/gl_helper.h" |
| 55 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 56 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 56 #include "content/common/gpu/gpu_messages.h" | 57 #include "content/common/gpu/gpu_messages.h" |
| 57 #include "content/common/gpu/gpu_process_launch_causes.h" | 58 #include "content/common/gpu/gpu_process_launch_causes.h" |
| 58 #include "content/common/input/did_overscroll_params.h" | 59 #include "content/common/input/did_overscroll_params.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 | 284 |
| 284 ui::GestureProvider::Config CreateGestureProviderConfig() { | 285 ui::GestureProvider::Config CreateGestureProviderConfig() { |
| 285 ui::GestureProvider::Config config = ui::GetGestureProviderConfig( | 286 ui::GestureProvider::Config config = ui::GetGestureProviderConfig( |
| 286 ui::GestureProviderConfigType::CURRENT_PLATFORM); | 287 ui::GestureProviderConfigType::CURRENT_PLATFORM); |
| 287 config.disable_click_delay = | 288 config.disable_click_delay = |
| 288 base::CommandLine::ForCurrentProcess()->HasSwitch( | 289 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 289 switches::kDisableClickDelay); | 290 switches::kDisableClickDelay); |
| 290 return config; | 291 return config; |
| 291 } | 292 } |
| 292 | 293 |
| 293 ui::SelectionBound::Type ConvertSelectionBoundType( | |
| 294 cc::SelectionBoundType type) { | |
| 295 switch (type) { | |
| 296 case cc::SELECTION_BOUND_LEFT: | |
| 297 return ui::SelectionBound::LEFT; | |
| 298 case cc::SELECTION_BOUND_RIGHT: | |
| 299 return ui::SelectionBound::RIGHT; | |
| 300 case cc::SELECTION_BOUND_CENTER: | |
| 301 return ui::SelectionBound::CENTER; | |
| 302 case cc::SELECTION_BOUND_EMPTY: | |
| 303 return ui::SelectionBound::EMPTY; | |
| 304 } | |
| 305 NOTREACHED() << "Unknown selection bound type"; | |
| 306 return ui::SelectionBound::EMPTY; | |
| 307 } | |
| 308 | |
| 309 ui::SelectionBound ConvertSelectionBound( | |
| 310 const cc::ViewportSelectionBound& bound) { | |
| 311 ui::SelectionBound ui_bound; | |
| 312 ui_bound.set_type(ConvertSelectionBoundType(bound.type)); | |
| 313 ui_bound.set_visible(bound.visible); | |
| 314 if (ui_bound.type() != ui::SelectionBound::EMPTY) | |
| 315 ui_bound.SetEdge(bound.edge_top, bound.edge_bottom); | |
| 316 return ui_bound; | |
| 317 } | |
| 318 | |
| 319 } // anonymous namespace | 294 } // anonymous namespace |
| 320 | 295 |
| 321 ReadbackRequest::ReadbackRequest(float scale, | 296 ReadbackRequest::ReadbackRequest(float scale, |
| 322 SkColorType color_type, | 297 SkColorType color_type, |
| 323 gfx::Rect src_subrect, | 298 gfx::Rect src_subrect, |
| 324 ReadbackRequestCallback& result_callback) | 299 ReadbackRequestCallback& result_callback) |
| 325 : scale_(scale), | 300 : scale_(scale), |
| 326 color_type_(color_type), | 301 color_type_(color_type), |
| 327 src_subrect_(src_subrect), | 302 src_subrect_(src_subrect), |
| 328 result_callback_(result_callback) { | 303 result_callback_(result_callback) { |
| (...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1341 bool is_mobile_optimized = IsMobileOptimizedFrame(frame_metadata); | 1316 bool is_mobile_optimized = IsMobileOptimizedFrame(frame_metadata); |
| 1342 gesture_provider_.SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); | 1317 gesture_provider_.SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); |
| 1343 | 1318 |
| 1344 if (!content_view_core_) | 1319 if (!content_view_core_) |
| 1345 return; | 1320 return; |
| 1346 | 1321 |
| 1347 if (overscroll_controller_) | 1322 if (overscroll_controller_) |
| 1348 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); | 1323 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); |
| 1349 | 1324 |
| 1350 if (selection_controller_) { | 1325 if (selection_controller_) { |
| 1351 selection_controller_->OnSelectionBoundsChanged( | 1326 selection_controller_->OnSelectionBoundsUpdated( |
| 1352 ConvertSelectionBound(frame_metadata.selection_start), | 1327 ConvertSelectionBound(frame_metadata.selection_start), |
| 1353 ConvertSelectionBound(frame_metadata.selection_end)); | 1328 ConvertSelectionBound(frame_metadata.selection_end)); |
| 1354 } | 1329 } |
| 1355 | 1330 |
| 1356 // All offsets and sizes are in CSS pixels. | 1331 // All offsets and sizes are in CSS pixels. |
| 1357 content_view_core_->UpdateFrameInfo( | 1332 content_view_core_->UpdateFrameInfo( |
| 1358 frame_metadata.root_scroll_offset, | 1333 frame_metadata.root_scroll_offset, |
| 1359 frame_metadata.page_scale_factor, | 1334 frame_metadata.page_scale_factor, |
| 1360 gfx::Vector2dF(frame_metadata.min_page_scale_factor, | 1335 gfx::Vector2dF(frame_metadata.min_page_scale_factor, |
| 1361 frame_metadata.max_page_scale_factor), | 1336 frame_metadata.max_page_scale_factor), |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1661 // of the region have been updated, explicitly set the properties now. | 1636 // of the region have been updated, explicitly set the properties now. |
| 1662 // TODO(jdduke): Remove this workaround when auxiliary paste popup | 1637 // TODO(jdduke): Remove this workaround when auxiliary paste popup |
| 1663 // notifications are no longer required, crbug.com/398170. | 1638 // notifications are no longer required, crbug.com/398170. |
| 1664 ui::SelectionBound insertion_bound; | 1639 ui::SelectionBound insertion_bound; |
| 1665 insertion_bound.set_type(ui::SelectionBound::CENTER); | 1640 insertion_bound.set_type(ui::SelectionBound::CENTER); |
| 1666 insertion_bound.set_visible(true); | 1641 insertion_bound.set_visible(true); |
| 1667 insertion_bound.SetEdge(point, point); | 1642 insertion_bound.SetEdge(point, point); |
| 1668 selection_controller_->HideAndDisallowShowingAutomatically(); | 1643 selection_controller_->HideAndDisallowShowingAutomatically(); |
| 1669 selection_controller_->OnSelectionEditable(true); | 1644 selection_controller_->OnSelectionEditable(true); |
| 1670 selection_controller_->OnSelectionEmpty(true); | 1645 selection_controller_->OnSelectionEmpty(true); |
| 1671 selection_controller_->OnSelectionBoundsChanged(insertion_bound, | 1646 selection_controller_->OnSelectionBoundsUpdated(insertion_bound, |
| 1672 insertion_bound); | 1647 insertion_bound); |
| 1673 selection_controller_->AllowShowingFromCurrentSelection(); | 1648 selection_controller_->AllowShowingFromCurrentSelection(); |
| 1674 } | 1649 } |
| 1675 | 1650 |
| 1676 SkColor RenderWidgetHostViewAndroid::GetCachedBackgroundColor() const { | 1651 SkColor RenderWidgetHostViewAndroid::GetCachedBackgroundColor() const { |
| 1677 return cached_background_color_; | 1652 return cached_background_color_; |
| 1678 } | 1653 } |
| 1679 | 1654 |
| 1680 void RenderWidgetHostViewAndroid::DidOverscroll( | 1655 void RenderWidgetHostViewAndroid::DidOverscroll( |
| 1681 const DidOverscrollParams& params) { | 1656 const DidOverscrollParams& params) { |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1940 results->orientationAngle = display.RotationAsDegree(); | 1915 results->orientationAngle = display.RotationAsDegree(); |
| 1941 results->orientationType = | 1916 results->orientationType = |
| 1942 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 1917 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
| 1943 gfx::DeviceDisplayInfo info; | 1918 gfx::DeviceDisplayInfo info; |
| 1944 results->depth = info.GetBitsPerPixel(); | 1919 results->depth = info.GetBitsPerPixel(); |
| 1945 results->depthPerComponent = info.GetBitsPerComponent(); | 1920 results->depthPerComponent = info.GetBitsPerComponent(); |
| 1946 results->isMonochrome = (results->depthPerComponent == 0); | 1921 results->isMonochrome = (results->depthPerComponent == 0); |
| 1947 } | 1922 } |
| 1948 | 1923 |
| 1949 } // namespace content | 1924 } // namespace content |
| OLD | NEW |