| 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 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 } | 954 } |
| 955 | 955 |
| 956 ui::FilteredGestureProvider::TouchHandlingResult result = | 956 ui::FilteredGestureProvider::TouchHandlingResult result = |
| 957 gesture_provider_.OnTouchEvent(event); | 957 gesture_provider_.OnTouchEvent(event); |
| 958 if (!result.succeeded) | 958 if (!result.succeeded) |
| 959 return false; | 959 return false; |
| 960 | 960 |
| 961 blink::WebTouchEvent web_event = ui::CreateWebTouchEventFromMotionEvent( | 961 blink::WebTouchEvent web_event = ui::CreateWebTouchEventFromMotionEvent( |
| 962 event, result.moved_beyond_slop_region); | 962 event, result.moved_beyond_slop_region); |
| 963 ui::LatencyInfo latency_info(ui::SourceEventType::TOUCH); | 963 ui::LatencyInfo latency_info(ui::SourceEventType::TOUCH); |
| 964 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); | 964 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0); |
| 965 if (host_->delegate()->GetInputEventRouter() && | 965 if (host_->delegate()->GetInputEventRouter() && |
| 966 SiteIsolationPolicy::AreCrossProcessFramesPossible()) { | 966 SiteIsolationPolicy::AreCrossProcessFramesPossible()) { |
| 967 host_->delegate()->GetInputEventRouter()->RouteTouchEvent(this, &web_event, | 967 host_->delegate()->GetInputEventRouter()->RouteTouchEvent(this, &web_event, |
| 968 latency_info); | 968 latency_info); |
| 969 } else { | 969 } else { |
| 970 host_->ForwardTouchEventWithLatencyInfo(web_event, latency_info); | 970 host_->ForwardTouchEventWithLatencyInfo(web_event, latency_info); |
| 971 } | 971 } |
| 972 | 972 |
| 973 // Send a proactive BeginFrame for this vsync to reduce scroll latency for | 973 // Send a proactive BeginFrame for this vsync to reduce scroll latency for |
| 974 // scroll-inducing touch events. Note that Android's Choreographer ensures | 974 // scroll-inducing touch events. Note that Android's Choreographer ensures |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1000 // A hard reset ensures prevention of any timer-based events that might fire | 1000 // A hard reset ensures prevention of any timer-based events that might fire |
| 1001 // after a touch sequence has ended. | 1001 // after a touch sequence has ended. |
| 1002 gesture_provider_.ResetDetection(); | 1002 gesture_provider_.ResetDetection(); |
| 1003 return; | 1003 return; |
| 1004 } | 1004 } |
| 1005 | 1005 |
| 1006 std::unique_ptr<ui::MotionEvent> cancel_event = current_down_event->Cancel(); | 1006 std::unique_ptr<ui::MotionEvent> cancel_event = current_down_event->Cancel(); |
| 1007 if (gesture_provider_.OnTouchEvent(*cancel_event).succeeded) { | 1007 if (gesture_provider_.OnTouchEvent(*cancel_event).succeeded) { |
| 1008 bool causes_scrolling = false; | 1008 bool causes_scrolling = false; |
| 1009 ui::LatencyInfo latency_info(ui::SourceEventType::TOUCH); | 1009 ui::LatencyInfo latency_info(ui::SourceEventType::TOUCH); |
| 1010 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); | 1010 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0); |
| 1011 host_->ForwardTouchEventWithLatencyInfo( | 1011 host_->ForwardTouchEventWithLatencyInfo( |
| 1012 ui::CreateWebTouchEventFromMotionEvent(*cancel_event, causes_scrolling), | 1012 ui::CreateWebTouchEventFromMotionEvent(*cancel_event, causes_scrolling), |
| 1013 latency_info); | 1013 latency_info); |
| 1014 } | 1014 } |
| 1015 } | 1015 } |
| 1016 | 1016 |
| 1017 void RenderWidgetHostViewAndroid::OnDidNavigateMainFrameToNewPage() { | 1017 void RenderWidgetHostViewAndroid::OnDidNavigateMainFrameToNewPage() { |
| 1018 ResetGestureDetection(); | 1018 ResetGestureDetection(); |
| 1019 } | 1019 } |
| 1020 | 1020 |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1779 if (host_->delegate()) | 1779 if (host_->delegate()) |
| 1780 target_host = host_->delegate()->GetFocusedRenderWidgetHost(host_); | 1780 target_host = host_->delegate()->GetFocusedRenderWidgetHost(host_); |
| 1781 if (!target_host) | 1781 if (!target_host) |
| 1782 return; | 1782 return; |
| 1783 | 1783 |
| 1784 ui::LatencyInfo latency_info; | 1784 ui::LatencyInfo latency_info; |
| 1785 if (event.GetType() == blink::WebInputEvent::kRawKeyDown || | 1785 if (event.GetType() == blink::WebInputEvent::kRawKeyDown || |
| 1786 event.GetType() == blink::WebInputEvent::kChar) { | 1786 event.GetType() == blink::WebInputEvent::kChar) { |
| 1787 latency_info.set_source_event_type(ui::SourceEventType::KEY_PRESS); | 1787 latency_info.set_source_event_type(ui::SourceEventType::KEY_PRESS); |
| 1788 } | 1788 } |
| 1789 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); | 1789 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0); |
| 1790 target_host->ForwardKeyboardEventWithLatencyInfo(event, latency_info); | 1790 target_host->ForwardKeyboardEventWithLatencyInfo(event, latency_info); |
| 1791 } | 1791 } |
| 1792 | 1792 |
| 1793 void RenderWidgetHostViewAndroid::SendMouseEvent( | 1793 void RenderWidgetHostViewAndroid::SendMouseEvent( |
| 1794 const ui::MotionEventAndroid& motion_event, | 1794 const ui::MotionEventAndroid& motion_event, |
| 1795 int action_button) { | 1795 int action_button) { |
| 1796 blink::WebInputEvent::Type webMouseEventType = | 1796 blink::WebInputEvent::Type webMouseEventType = |
| 1797 ui::ToWebMouseEventType(motion_event.GetAction()); | 1797 ui::ToWebMouseEventType(motion_event.GetAction()); |
| 1798 | 1798 |
| 1799 blink::WebMouseEvent mouse_event = WebMouseEventBuilder::Build( | 1799 blink::WebMouseEvent mouse_event = WebMouseEventBuilder::Build( |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1816 host_->ForwardMouseEvent(mouse_event); | 1816 host_->ForwardMouseEvent(mouse_event); |
| 1817 } | 1817 } |
| 1818 } | 1818 } |
| 1819 | 1819 |
| 1820 void RenderWidgetHostViewAndroid::SendMouseWheelEvent( | 1820 void RenderWidgetHostViewAndroid::SendMouseWheelEvent( |
| 1821 const blink::WebMouseWheelEvent& event) { | 1821 const blink::WebMouseWheelEvent& event) { |
| 1822 if (!host_ || !host_->delegate()) | 1822 if (!host_ || !host_->delegate()) |
| 1823 return; | 1823 return; |
| 1824 | 1824 |
| 1825 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL); | 1825 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL); |
| 1826 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); | 1826 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0); |
| 1827 blink::WebMouseWheelEvent wheel_event(event); | 1827 blink::WebMouseWheelEvent wheel_event(event); |
| 1828 bool should_route_event = | 1828 bool should_route_event = |
| 1829 SiteIsolationPolicy::AreCrossProcessFramesPossible() && | 1829 SiteIsolationPolicy::AreCrossProcessFramesPossible() && |
| 1830 host_->delegate()->GetInputEventRouter(); | 1830 host_->delegate()->GetInputEventRouter(); |
| 1831 if (wheel_scroll_latching_enabled()) { | 1831 if (wheel_scroll_latching_enabled()) { |
| 1832 mouse_wheel_phase_handler_.AddPhaseIfNeededAndScheduleEndEvent( | 1832 mouse_wheel_phase_handler_.AddPhaseIfNeededAndScheduleEndEvent( |
| 1833 wheel_event, should_route_event); | 1833 wheel_event, should_route_event); |
| 1834 } | 1834 } |
| 1835 if (should_route_event) { | 1835 if (should_route_event) { |
| 1836 host_->delegate()->GetInputEventRouter()->RouteMouseWheelEvent( | 1836 host_->delegate()->GetInputEventRouter()->RouteMouseWheelEvent( |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2282 | 2282 |
| 2283 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); | 2283 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); |
| 2284 if (!compositor) | 2284 if (!compositor) |
| 2285 return; | 2285 return; |
| 2286 | 2286 |
| 2287 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( | 2287 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( |
| 2288 overscroll_refresh_handler, compositor, view_.GetDipScale()); | 2288 overscroll_refresh_handler, compositor, view_.GetDipScale()); |
| 2289 } | 2289 } |
| 2290 | 2290 |
| 2291 } // namespace content | 2291 } // namespace content |
| OLD | NEW |