| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 44 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
| 45 #include "content/browser/gpu/compositor_util.h" | 45 #include "content/browser/gpu/compositor_util.h" |
| 46 #include "content/browser/gpu/gpu_data_manager_impl.h" | 46 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 47 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 47 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
| 48 #include "content/browser/gpu/gpu_surface_tracker.h" | 48 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 49 #include "content/browser/media/media_web_contents_observer.h" | 49 #include "content/browser/media/media_web_contents_observer.h" |
| 50 #include "content/browser/renderer_host/compositor_impl_android.h" | 50 #include "content/browser/renderer_host/compositor_impl_android.h" |
| 51 #include "content/browser/renderer_host/dip_util.h" | 51 #include "content/browser/renderer_host/dip_util.h" |
| 52 #include "content/browser/renderer_host/frame_metadata_util.h" | 52 #include "content/browser/renderer_host/frame_metadata_util.h" |
| 53 #include "content/browser/renderer_host/input/synthetic_gesture_target_android.h
" | 53 #include "content/browser/renderer_host/input/synthetic_gesture_target_android.h
" |
| 54 #include "content/browser/renderer_host/input/ui_touch_selection_helper.h" |
| 54 #include "content/browser/renderer_host/input/web_input_event_builders_android.h
" | 55 #include "content/browser/renderer_host/input/web_input_event_builders_android.h
" |
| 55 #include "content/browser/renderer_host/input/web_input_event_util.h" | 56 #include "content/browser/renderer_host/input/web_input_event_util.h" |
| 56 #include "content/browser/renderer_host/render_process_host_impl.h" | 57 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 57 #include "content/browser/renderer_host/render_view_host_impl.h" | 58 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 58 #include "content/browser/renderer_host/render_widget_host_impl.h" | 59 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 59 #include "content/common/gpu/client/gl_helper.h" | 60 #include "content/common/gpu/client/gl_helper.h" |
| 60 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 61 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 61 #include "content/common/gpu/gpu_messages.h" | 62 #include "content/common/gpu/gpu_messages.h" |
| 62 #include "content/common/gpu/gpu_process_launch_causes.h" | 63 #include "content/common/gpu/gpu_process_launch_causes.h" |
| 63 #include "content/common/input/did_overscroll_params.h" | 64 #include "content/common/input/did_overscroll_params.h" |
| (...skipping 219 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 gfx::RectF GetSelectionRect(const ui::TouchSelectionController& controller) { | 294 gfx::RectF GetSelectionRect(const ui::TouchSelectionController& controller) { |
| 320 gfx::RectF rect = controller.GetRectBetweenBounds(); | 295 gfx::RectF rect = controller.GetRectBetweenBounds(); |
| 321 if (rect.IsEmpty()) | 296 if (rect.IsEmpty()) |
| 322 return rect; | 297 return rect; |
| 323 | 298 |
| 324 rect.Union(controller.GetStartHandleRect()); | 299 rect.Union(controller.GetStartHandleRect()); |
| 325 rect.Union(controller.GetEndHandleRect()); | 300 rect.Union(controller.GetEndHandleRect()); |
| 326 return rect; | 301 return rect; |
| 327 } | 302 } |
| 328 | 303 |
| (...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1334 return content_view_core_->CreatePopupTouchHandleDrawable(); | 1309 return content_view_core_->CreatePopupTouchHandleDrawable(); |
| 1335 | 1310 |
| 1336 return scoped_ptr<ui::TouchHandleDrawable>(new CompositedTouchHandleDrawable( | 1311 return scoped_ptr<ui::TouchHandleDrawable>(new CompositedTouchHandleDrawable( |
| 1337 content_view_core_->GetLayer().get(), | 1312 content_view_core_->GetLayer().get(), |
| 1338 content_view_core_->GetDpiScale(), | 1313 content_view_core_->GetDpiScale(), |
| 1339 // Use the activity context (instead of the application context) to ensure | 1314 // Use the activity context (instead of the application context) to ensure |
| 1340 // proper handle theming. | 1315 // proper handle theming. |
| 1341 content_view_core_->GetContext().obj())); | 1316 content_view_core_->GetContext().obj())); |
| 1342 } | 1317 } |
| 1343 | 1318 |
| 1319 void RenderWidgetHostViewAndroid::OnScrollStarted() { |
| 1320 } |
| 1321 |
| 1322 void RenderWidgetHostViewAndroid::OnScrollCompleted() { |
| 1323 } |
| 1324 |
| 1344 void RenderWidgetHostViewAndroid::SynchronousCopyContents( | 1325 void RenderWidgetHostViewAndroid::SynchronousCopyContents( |
| 1345 const gfx::Rect& src_subrect_in_pixel, | 1326 const gfx::Rect& src_subrect_in_pixel, |
| 1346 const gfx::Size& dst_size_in_pixel, | 1327 const gfx::Size& dst_size_in_pixel, |
| 1347 ReadbackRequestCallback& callback, | 1328 ReadbackRequestCallback& callback, |
| 1348 const SkColorType color_type) { | 1329 const SkColorType color_type) { |
| 1349 gfx::Size input_size_in_pixel; | 1330 gfx::Size input_size_in_pixel; |
| 1350 if (src_subrect_in_pixel.IsEmpty()) | 1331 if (src_subrect_in_pixel.IsEmpty()) |
| 1351 input_size_in_pixel = content_size_in_layer_; | 1332 input_size_in_pixel = content_size_in_layer_; |
| 1352 else | 1333 else |
| 1353 input_size_in_pixel = src_subrect_in_pixel.size(); | 1334 input_size_in_pixel = src_subrect_in_pixel.size(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1390 return; | 1371 return; |
| 1391 | 1372 |
| 1392 if (overscroll_controller_) | 1373 if (overscroll_controller_) |
| 1393 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); | 1374 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); |
| 1394 | 1375 |
| 1395 if (selection_controller_) { | 1376 if (selection_controller_) { |
| 1396 selection_controller_->OnSelectionEditable( | 1377 selection_controller_->OnSelectionEditable( |
| 1397 frame_metadata.selection.is_editable); | 1378 frame_metadata.selection.is_editable); |
| 1398 selection_controller_->OnSelectionEmpty( | 1379 selection_controller_->OnSelectionEmpty( |
| 1399 frame_metadata.selection.is_empty_text_form_control); | 1380 frame_metadata.selection.is_empty_text_form_control); |
| 1400 selection_controller_->OnSelectionBoundsChanged( | 1381 selection_controller_->OnSelectionBoundsUpdated( |
| 1401 ConvertSelectionBound(frame_metadata.selection.start), | 1382 ConvertSelectionBound(frame_metadata.selection.start), |
| 1402 ConvertSelectionBound(frame_metadata.selection.end)); | 1383 ConvertSelectionBound(frame_metadata.selection.end)); |
| 1403 } | 1384 } |
| 1404 | 1385 |
| 1405 // All offsets and sizes are in CSS pixels. | 1386 // All offsets and sizes are in CSS pixels. |
| 1406 content_view_core_->UpdateFrameInfo( | 1387 content_view_core_->UpdateFrameInfo( |
| 1407 frame_metadata.root_scroll_offset, | 1388 frame_metadata.root_scroll_offset, |
| 1408 frame_metadata.page_scale_factor, | 1389 frame_metadata.page_scale_factor, |
| 1409 gfx::Vector2dF(frame_metadata.min_page_scale_factor, | 1390 gfx::Vector2dF(frame_metadata.min_page_scale_factor, |
| 1410 frame_metadata.max_page_scale_factor), | 1391 frame_metadata.max_page_scale_factor), |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1780 // of the region have been updated, explicitly set the properties now. | 1761 // of the region have been updated, explicitly set the properties now. |
| 1781 // TODO(jdduke): Remove this workaround when auxiliary paste popup | 1762 // TODO(jdduke): Remove this workaround when auxiliary paste popup |
| 1782 // notifications are no longer required, crbug.com/398170. | 1763 // notifications are no longer required, crbug.com/398170. |
| 1783 ui::SelectionBound insertion_bound; | 1764 ui::SelectionBound insertion_bound; |
| 1784 insertion_bound.set_type(ui::SelectionBound::CENTER); | 1765 insertion_bound.set_type(ui::SelectionBound::CENTER); |
| 1785 insertion_bound.set_visible(true); | 1766 insertion_bound.set_visible(true); |
| 1786 insertion_bound.SetEdge(point, point); | 1767 insertion_bound.SetEdge(point, point); |
| 1787 selection_controller_->HideAndDisallowShowingAutomatically(); | 1768 selection_controller_->HideAndDisallowShowingAutomatically(); |
| 1788 selection_controller_->OnSelectionEditable(true); | 1769 selection_controller_->OnSelectionEditable(true); |
| 1789 selection_controller_->OnSelectionEmpty(true); | 1770 selection_controller_->OnSelectionEmpty(true); |
| 1790 selection_controller_->OnSelectionBoundsChanged(insertion_bound, | 1771 selection_controller_->OnSelectionBoundsUpdated(insertion_bound, |
| 1791 insertion_bound); | 1772 insertion_bound); |
| 1792 selection_controller_->AllowShowingFromCurrentSelection(); | 1773 selection_controller_->AllowShowingFromCurrentSelection(); |
| 1793 } | 1774 } |
| 1794 | 1775 |
| 1795 SkColor RenderWidgetHostViewAndroid::GetCachedBackgroundColor() const { | 1776 SkColor RenderWidgetHostViewAndroid::GetCachedBackgroundColor() const { |
| 1796 return cached_background_color_; | 1777 return cached_background_color_; |
| 1797 } | 1778 } |
| 1798 | 1779 |
| 1799 void RenderWidgetHostViewAndroid::DidOverscroll( | 1780 void RenderWidgetHostViewAndroid::DidOverscroll( |
| 1800 const DidOverscrollParams& params) { | 1781 const DidOverscrollParams& params) { |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2076 results->orientationAngle = display.RotationAsDegree(); | 2057 results->orientationAngle = display.RotationAsDegree(); |
| 2077 results->orientationType = | 2058 results->orientationType = |
| 2078 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 2059 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
| 2079 gfx::DeviceDisplayInfo info; | 2060 gfx::DeviceDisplayInfo info; |
| 2080 results->depth = info.GetBitsPerPixel(); | 2061 results->depth = info.GetBitsPerPixel(); |
| 2081 results->depthPerComponent = info.GetBitsPerComponent(); | 2062 results->depthPerComponent = info.GetBitsPerComponent(); |
| 2082 results->isMonochrome = (results->depthPerComponent == 0); | 2063 results->isMonochrome = (results->depthPerComponent == 0); |
| 2083 } | 2064 } |
| 2084 | 2065 |
| 2085 } // namespace content | 2066 } // namespace content |
| OLD | NEW |