| 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 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 } | 961 } |
| 962 | 962 |
| 963 ui::FilteredGestureProvider::TouchHandlingResult result = | 963 ui::FilteredGestureProvider::TouchHandlingResult result = |
| 964 gesture_provider_.OnTouchEvent(event); | 964 gesture_provider_.OnTouchEvent(event); |
| 965 if (!result.succeeded) | 965 if (!result.succeeded) |
| 966 return false; | 966 return false; |
| 967 | 967 |
| 968 blink::WebTouchEvent web_event = ui::CreateWebTouchEventFromMotionEvent( | 968 blink::WebTouchEvent web_event = ui::CreateWebTouchEventFromMotionEvent( |
| 969 event, result.moved_beyond_slop_region); | 969 event, result.moved_beyond_slop_region); |
| 970 ui::LatencyInfo latency_info(ui::SourceEventType::TOUCH); | 970 ui::LatencyInfo latency_info(ui::SourceEventType::TOUCH); |
| 971 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); | 971 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0); |
| 972 if (host_->delegate()->GetInputEventRouter() && | 972 if (host_->delegate()->GetInputEventRouter() && |
| 973 SiteIsolationPolicy::AreCrossProcessFramesPossible()) { | 973 SiteIsolationPolicy::AreCrossProcessFramesPossible()) { |
| 974 host_->delegate()->GetInputEventRouter()->RouteTouchEvent(this, &web_event, | 974 host_->delegate()->GetInputEventRouter()->RouteTouchEvent(this, &web_event, |
| 975 latency_info); | 975 latency_info); |
| 976 } else { | 976 } else { |
| 977 host_->ForwardTouchEventWithLatencyInfo(web_event, latency_info); | 977 host_->ForwardTouchEventWithLatencyInfo(web_event, latency_info); |
| 978 } | 978 } |
| 979 | 979 |
| 980 // Send a proactive BeginFrame for this vsync to reduce scroll latency for | 980 // Send a proactive BeginFrame for this vsync to reduce scroll latency for |
| 981 // scroll-inducing touch events. Note that Android's Choreographer ensures | 981 // scroll-inducing touch events. Note that Android's Choreographer ensures |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1007 // A hard reset ensures prevention of any timer-based events that might fire | 1007 // A hard reset ensures prevention of any timer-based events that might fire |
| 1008 // after a touch sequence has ended. | 1008 // after a touch sequence has ended. |
| 1009 gesture_provider_.ResetDetection(); | 1009 gesture_provider_.ResetDetection(); |
| 1010 return; | 1010 return; |
| 1011 } | 1011 } |
| 1012 | 1012 |
| 1013 std::unique_ptr<ui::MotionEvent> cancel_event = current_down_event->Cancel(); | 1013 std::unique_ptr<ui::MotionEvent> cancel_event = current_down_event->Cancel(); |
| 1014 if (gesture_provider_.OnTouchEvent(*cancel_event).succeeded) { | 1014 if (gesture_provider_.OnTouchEvent(*cancel_event).succeeded) { |
| 1015 bool causes_scrolling = false; | 1015 bool causes_scrolling = false; |
| 1016 ui::LatencyInfo latency_info(ui::SourceEventType::TOUCH); | 1016 ui::LatencyInfo latency_info(ui::SourceEventType::TOUCH); |
| 1017 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); | 1017 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0); |
| 1018 blink::WebTouchEvent web_event = | 1018 blink::WebTouchEvent web_event = |
| 1019 ui::CreateWebTouchEventFromMotionEvent(*cancel_event, causes_scrolling); | 1019 ui::CreateWebTouchEventFromMotionEvent(*cancel_event, causes_scrolling); |
| 1020 if (SiteIsolationPolicy::AreCrossProcessFramesPossible() && | 1020 if (SiteIsolationPolicy::AreCrossProcessFramesPossible() && |
| 1021 host_->delegate()->GetInputEventRouter()) { | 1021 host_->delegate()->GetInputEventRouter()) { |
| 1022 host_->delegate()->GetInputEventRouter()->RouteTouchEvent( | 1022 host_->delegate()->GetInputEventRouter()->RouteTouchEvent( |
| 1023 this, &web_event, latency_info); | 1023 this, &web_event, latency_info); |
| 1024 } else { | 1024 } else { |
| 1025 host_->ForwardTouchEventWithLatencyInfo(web_event, latency_info); | 1025 host_->ForwardTouchEventWithLatencyInfo(web_event, latency_info); |
| 1026 } | 1026 } |
| 1027 } | 1027 } |
| (...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1793 if (host_->delegate()) | 1793 if (host_->delegate()) |
| 1794 target_host = host_->delegate()->GetFocusedRenderWidgetHost(host_); | 1794 target_host = host_->delegate()->GetFocusedRenderWidgetHost(host_); |
| 1795 if (!target_host) | 1795 if (!target_host) |
| 1796 return; | 1796 return; |
| 1797 | 1797 |
| 1798 ui::LatencyInfo latency_info; | 1798 ui::LatencyInfo latency_info; |
| 1799 if (event.GetType() == blink::WebInputEvent::kRawKeyDown || | 1799 if (event.GetType() == blink::WebInputEvent::kRawKeyDown || |
| 1800 event.GetType() == blink::WebInputEvent::kChar) { | 1800 event.GetType() == blink::WebInputEvent::kChar) { |
| 1801 latency_info.set_source_event_type(ui::SourceEventType::KEY_PRESS); | 1801 latency_info.set_source_event_type(ui::SourceEventType::KEY_PRESS); |
| 1802 } | 1802 } |
| 1803 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); | 1803 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0); |
| 1804 target_host->ForwardKeyboardEventWithLatencyInfo(event, latency_info); | 1804 target_host->ForwardKeyboardEventWithLatencyInfo(event, latency_info); |
| 1805 } | 1805 } |
| 1806 | 1806 |
| 1807 void RenderWidgetHostViewAndroid::SendMouseEvent( | 1807 void RenderWidgetHostViewAndroid::SendMouseEvent( |
| 1808 const ui::MotionEventAndroid& motion_event, | 1808 const ui::MotionEventAndroid& motion_event, |
| 1809 int action_button) { | 1809 int action_button) { |
| 1810 blink::WebInputEvent::Type webMouseEventType = | 1810 blink::WebInputEvent::Type webMouseEventType = |
| 1811 ui::ToWebMouseEventType(motion_event.GetAction()); | 1811 ui::ToWebMouseEventType(motion_event.GetAction()); |
| 1812 | 1812 |
| 1813 if (webMouseEventType == blink::WebInputEvent::kMouseDown) | 1813 if (webMouseEventType == blink::WebInputEvent::kMouseDown) |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1865 prev_mousedown_timestamp_ = current_time; | 1865 prev_mousedown_timestamp_ = current_time; |
| 1866 prev_mousedown_point_ = mousedown_point; | 1866 prev_mousedown_point_ = mousedown_point; |
| 1867 } | 1867 } |
| 1868 | 1868 |
| 1869 void RenderWidgetHostViewAndroid::SendMouseWheelEvent( | 1869 void RenderWidgetHostViewAndroid::SendMouseWheelEvent( |
| 1870 const blink::WebMouseWheelEvent& event) { | 1870 const blink::WebMouseWheelEvent& event) { |
| 1871 if (!host_ || !host_->delegate()) | 1871 if (!host_ || !host_->delegate()) |
| 1872 return; | 1872 return; |
| 1873 | 1873 |
| 1874 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL); | 1874 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL); |
| 1875 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); | 1875 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0); |
| 1876 blink::WebMouseWheelEvent wheel_event(event); | 1876 blink::WebMouseWheelEvent wheel_event(event); |
| 1877 bool should_route_event = | 1877 bool should_route_event = |
| 1878 SiteIsolationPolicy::AreCrossProcessFramesPossible() && | 1878 SiteIsolationPolicy::AreCrossProcessFramesPossible() && |
| 1879 host_->delegate()->GetInputEventRouter(); | 1879 host_->delegate()->GetInputEventRouter(); |
| 1880 if (wheel_scroll_latching_enabled()) { | 1880 if (wheel_scroll_latching_enabled()) { |
| 1881 mouse_wheel_phase_handler_.AddPhaseIfNeededAndScheduleEndEvent( | 1881 mouse_wheel_phase_handler_.AddPhaseIfNeededAndScheduleEndEvent( |
| 1882 wheel_event, should_route_event); | 1882 wheel_event, should_route_event); |
| 1883 } | 1883 } |
| 1884 if (should_route_event) { | 1884 if (should_route_event) { |
| 1885 host_->delegate()->GetInputEventRouter()->RouteMouseWheelEvent( | 1885 host_->delegate()->GetInputEventRouter()->RouteMouseWheelEvent( |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2320 | 2320 |
| 2321 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); | 2321 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); |
| 2322 if (!compositor) | 2322 if (!compositor) |
| 2323 return; | 2323 return; |
| 2324 | 2324 |
| 2325 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( | 2325 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( |
| 2326 overscroll_refresh_handler, compositor, view_.GetDipScale()); | 2326 overscroll_refresh_handler, compositor, view_.GetDipScale()); |
| 2327 } | 2327 } |
| 2328 | 2328 |
| 2329 } // namespace content | 2329 } // namespace content |
| OLD | NEW |