| 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 26 matching lines...) Expand all Loading... |
| 37 #include "content/browser/android/overscroll_glow.h" | 37 #include "content/browser/android/overscroll_glow.h" |
| 38 #include "content/browser/devtools/render_view_devtools_agent_host.h" | 38 #include "content/browser/devtools/render_view_devtools_agent_host.h" |
| 39 #include "content/browser/gpu/compositor_util.h" | 39 #include "content/browser/gpu/compositor_util.h" |
| 40 #include "content/browser/gpu/gpu_data_manager_impl.h" | 40 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 41 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 41 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
| 42 #include "content/browser/gpu/gpu_surface_tracker.h" | 42 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 43 #include "content/browser/media/media_web_contents_observer.h" | 43 #include "content/browser/media/media_web_contents_observer.h" |
| 44 #include "content/browser/renderer_host/compositor_impl_android.h" | 44 #include "content/browser/renderer_host/compositor_impl_android.h" |
| 45 #include "content/browser/renderer_host/dip_util.h" | 45 #include "content/browser/renderer_host/dip_util.h" |
| 46 #include "content/browser/renderer_host/image_transport_factory_android.h" | 46 #include "content/browser/renderer_host/image_transport_factory_android.h" |
| 47 #include "content/browser/renderer_host/input/input_router.h" |
| 47 #include "content/browser/renderer_host/input/synthetic_gesture_target_android.h
" | 48 #include "content/browser/renderer_host/input/synthetic_gesture_target_android.h
" |
| 48 #include "content/browser/renderer_host/input/touch_selection_controller.h" | 49 #include "content/browser/renderer_host/input/touch_selection_controller.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/gpu_messages.h" | 56 #include "content/common/gpu/gpu_messages.h" |
| 56 #include "content/common/input/did_overscroll_params.h" | 57 #include "content/common/input/did_overscroll_params.h" |
| 57 #include "content/common/input_messages.h" | 58 #include "content/common/input_messages.h" |
| 58 #include "content/common/view_messages.h" | 59 #include "content/common/view_messages.h" |
| 59 #include "content/public/browser/browser_thread.h" | 60 #include "content/public/browser/browser_thread.h" |
| 60 #include "content/public/browser/devtools_agent_host.h" | 61 #include "content/public/browser/devtools_agent_host.h" |
| 61 #include "content/public/browser/render_view_host.h" | 62 #include "content/public/browser/render_view_host.h" |
| 62 #include "content/public/common/content_switches.h" | 63 #include "content/public/common/content_switches.h" |
| 63 #include "gpu/command_buffer/client/gles2_interface.h" | 64 #include "gpu/command_buffer/client/gles2_interface.h" |
| 64 #include "gpu/config/gpu_driver_bug_workaround_type.h" | 65 #include "gpu/config/gpu_driver_bug_workaround_type.h" |
| 65 #include "skia/ext/image_operations.h" | 66 #include "skia/ext/image_operations.h" |
| 66 #include "third_party/khronos/GLES2/gl2.h" | 67 #include "third_party/khronos/GLES2/gl2.h" |
| 67 #include "third_party/khronos/GLES2/gl2ext.h" | 68 #include "third_party/khronos/GLES2/gl2ext.h" |
| 68 #include "third_party/skia/include/core/SkCanvas.h" | 69 #include "third_party/skia/include/core/SkCanvas.h" |
| 69 #include "ui/base/android/window_android.h" | 70 #include "ui/base/android/window_android.h" |
| 70 #include "ui/base/android/window_android_compositor.h" | 71 #include "ui/base/android/window_android_compositor.h" |
| 71 #include "ui/events/gesture_detection/gesture_config_helper.h" | 72 #include "ui/events/gesture_detection/gesture_config_helper.h" |
| 72 #include "ui/events/gesture_detection/motion_event.h" | 73 #include "ui/events/gesture_detection/motion_event_generic.h" |
| 73 #include "ui/gfx/android/device_display_info.h" | 74 #include "ui/gfx/android/device_display_info.h" |
| 74 #include "ui/gfx/android/java_bitmap.h" | 75 #include "ui/gfx/android/java_bitmap.h" |
| 75 #include "ui/gfx/android/view_configuration.h" | 76 #include "ui/gfx/android/view_configuration.h" |
| 76 #include "ui/gfx/display.h" | 77 #include "ui/gfx/display.h" |
| 77 #include "ui/gfx/screen.h" | 78 #include "ui/gfx/screen.h" |
| 78 #include "ui/gfx/size_conversions.h" | 79 #include "ui/gfx/size_conversions.h" |
| 79 | 80 |
| 80 namespace content { | 81 namespace content { |
| 81 | 82 |
| 82 namespace { | 83 namespace { |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 host_->ForwardTouchEventWithLatencyInfo(web_event, | 717 host_->ForwardTouchEventWithLatencyInfo(web_event, |
| 717 CreateLatencyInfo(web_event)); | 718 CreateLatencyInfo(web_event)); |
| 718 } else { | 719 } else { |
| 719 const bool event_consumed = false; | 720 const bool event_consumed = false; |
| 720 gesture_provider_.OnTouchEventAck(event_consumed); | 721 gesture_provider_.OnTouchEventAck(event_consumed); |
| 721 } | 722 } |
| 722 | 723 |
| 723 // Send a proactive BeginFrame on the next vsync to reduce latency. | 724 // Send a proactive BeginFrame on the next vsync to reduce latency. |
| 724 // This is good enough as long as the first touch event has Begin semantics | 725 // This is good enough as long as the first touch event has Begin semantics |
| 725 // and the actual scroll happens on the next vsync. | 726 // and the actual scroll happens on the next vsync. |
| 726 if (observing_root_window_) | 727 if (observing_root_window_ && |
| 728 event.GetAction() != ui::MotionEvent::ACTION_CANCEL) { |
| 727 RequestVSyncUpdate(BEGIN_FRAME); | 729 RequestVSyncUpdate(BEGIN_FRAME); |
| 730 } |
| 728 | 731 |
| 729 return true; | 732 return true; |
| 730 } | 733 } |
| 731 | 734 |
| 732 bool RenderWidgetHostViewAndroid::OnTouchHandleEvent( | 735 bool RenderWidgetHostViewAndroid::OnTouchHandleEvent( |
| 733 const ui::MotionEvent& event) { | 736 const ui::MotionEvent& event) { |
| 734 return selection_controller_ && | 737 return selection_controller_ && |
| 735 selection_controller_->WillHandleTouchEvent(event); | 738 selection_controller_->WillHandleTouchEvent(event); |
| 736 } | 739 } |
| 737 | 740 |
| 738 void RenderWidgetHostViewAndroid::ResetGestureDetection() { | 741 void RenderWidgetHostViewAndroid::ResetGestureDetection() { |
| 739 const ui::MotionEvent* current_down_event = | 742 const ui::MotionEvent* current_down_event = |
| 740 gesture_provider_.GetCurrentDownEvent(); | 743 gesture_provider_.GetCurrentDownEvent(); |
| 741 if (!current_down_event) | 744 // Prefer using the GestureProvider's active down event for cancellation. If |
| 742 return; | 745 // none such exists, insert a synthetic cancel to prevent timer-based gesture |
| 746 // detection, relying on touch filtering to drop the synthetic cancel as |
| 747 // appropriate for the current event stream. |
| 748 if (current_down_event) { |
| 749 scoped_ptr<ui::MotionEvent> actual_cancel = current_down_event->Cancel(); |
| 750 OnTouchEvent(*actual_cancel); |
| 751 } else { |
| 752 ui::MotionEventGeneric synthetic_cancel(ui::MotionEvent::ACTION_CANCEL, |
| 753 base::TimeTicks::Now(), |
| 754 ui::PointerProperties()); |
| 755 OnTouchEvent(synthetic_cancel); |
| 756 } |
| 743 | 757 |
| 744 scoped_ptr<ui::MotionEvent> cancel_event = current_down_event->Cancel(); | 758 if (host_) |
| 745 DCHECK(cancel_event); | 759 host_->input_router()->Recycle(); |
| 746 OnTouchEvent(*cancel_event); | |
| 747 } | 760 } |
| 748 | 761 |
| 749 void RenderWidgetHostViewAndroid::SetDoubleTapSupportEnabled(bool enabled) { | 762 void RenderWidgetHostViewAndroid::SetDoubleTapSupportEnabled(bool enabled) { |
| 750 gesture_provider_.SetDoubleTapSupportForPlatformEnabled(enabled); | 763 gesture_provider_.SetDoubleTapSupportForPlatformEnabled(enabled); |
| 751 } | 764 } |
| 752 | 765 |
| 753 void RenderWidgetHostViewAndroid::SetMultiTouchZoomSupportEnabled( | 766 void RenderWidgetHostViewAndroid::SetMultiTouchZoomSupportEnabled( |
| 754 bool enabled) { | 767 bool enabled) { |
| 755 gesture_provider_.SetMultiTouchZoomSupportEnabled(enabled); | 768 gesture_provider_.SetMultiTouchZoomSupportEnabled(enabled); |
| 756 } | 769 } |
| (...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1781 results->orientationAngle = display.RotationAsDegree(); | 1794 results->orientationAngle = display.RotationAsDegree(); |
| 1782 results->orientationType = | 1795 results->orientationType = |
| 1783 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 1796 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
| 1784 gfx::DeviceDisplayInfo info; | 1797 gfx::DeviceDisplayInfo info; |
| 1785 results->depth = info.GetBitsPerPixel(); | 1798 results->depth = info.GetBitsPerPixel(); |
| 1786 results->depthPerComponent = info.GetBitsPerComponent(); | 1799 results->depthPerComponent = info.GetBitsPerComponent(); |
| 1787 results->isMonochrome = (results->depthPerComponent == 0); | 1800 results->isMonochrome = (results->depthPerComponent == 0); |
| 1788 } | 1801 } |
| 1789 | 1802 |
| 1790 } // namespace content | 1803 } // namespace content |
| OLD | NEW |