Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 660663002: Clear pending events upon main frame navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updates Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 host_->ForwardTouchEventWithLatencyInfo(web_event, 717 host_->ForwardTouchEventWithLatencyInfo(web_event,
718 CreateLatencyInfo(web_event)); 718 CreateLatencyInfo(web_event));
719 } else { 719 } else {
720 const bool event_consumed = false; 720 const bool event_consumed = false;
721 gesture_provider_.OnTouchEventAck(event_consumed); 721 gesture_provider_.OnTouchEventAck(event_consumed);
722 } 722 }
723 723
724 // Send a proactive BeginFrame on the next vsync to reduce latency. 724 // Send a proactive BeginFrame on the next vsync to reduce latency.
725 // 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
726 // and the actual scroll happens on the next vsync. 726 // and the actual scroll happens on the next vsync.
727 if (observing_root_window_) 727 if (observing_root_window_ &&
728 event.GetAction() != ui::MotionEvent::ACTION_CANCEL) {
728 RequestVSyncUpdate(BEGIN_FRAME); 729 RequestVSyncUpdate(BEGIN_FRAME);
730 }
729 731
730 return true; 732 return true;
731 } 733 }
732 734
733 bool RenderWidgetHostViewAndroid::OnTouchHandleEvent( 735 bool RenderWidgetHostViewAndroid::OnTouchHandleEvent(
734 const ui::MotionEvent& event) { 736 const ui::MotionEvent& event) {
735 return selection_controller_ && 737 return selection_controller_ &&
736 selection_controller_->WillHandleTouchEvent(event); 738 selection_controller_->WillHandleTouchEvent(event);
737 } 739 }
738 740
739 void RenderWidgetHostViewAndroid::ResetGestureDetection() { 741 void RenderWidgetHostViewAndroid::CancelActiveTouchSequence() {
740 const ui::MotionEvent* current_down_event = 742 const ui::MotionEvent* current_down_event =
741 gesture_provider_.GetCurrentDownEvent(); 743 gesture_provider_.GetCurrentDownEvent();
742 if (!current_down_event) 744 if (!current_down_event)
743 return; 745 return;
744 746
745 scoped_ptr<ui::MotionEvent> cancel_event = current_down_event->Cancel(); 747 scoped_ptr<ui::MotionEvent> cancel_event = current_down_event->Cancel();
746 DCHECK(cancel_event); 748 DCHECK(cancel_event);
747 OnTouchEvent(*cancel_event); 749 OnTouchEvent(*cancel_event);
748 } 750 }
749 751
752 void RenderWidgetHostViewAndroid::ResetPendingInput() {
753 CancelActiveTouchSequence();
754 gesture_provider_.ResetDetection();
755 if (host_)
756 host_->ResetPendingInput();
757 }
758
750 void RenderWidgetHostViewAndroid::SetDoubleTapSupportEnabled(bool enabled) { 759 void RenderWidgetHostViewAndroid::SetDoubleTapSupportEnabled(bool enabled) {
751 gesture_provider_.SetDoubleTapSupportForPlatformEnabled(enabled); 760 gesture_provider_.SetDoubleTapSupportForPlatformEnabled(enabled);
752 } 761 }
753 762
754 void RenderWidgetHostViewAndroid::SetMultiTouchZoomSupportEnabled( 763 void RenderWidgetHostViewAndroid::SetMultiTouchZoomSupportEnabled(
755 bool enabled) { 764 bool enabled) {
756 gesture_provider_.SetMultiTouchZoomSupportEnabled(enabled); 765 gesture_provider_.SetMultiTouchZoomSupportEnabled(enabled);
757 } 766 }
758 767
759 void RenderWidgetHostViewAndroid::ImeCancelComposition() { 768 void RenderWidgetHostViewAndroid::ImeCancelComposition() {
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
1811 results->orientationAngle = display.RotationAsDegree(); 1820 results->orientationAngle = display.RotationAsDegree();
1812 results->orientationType = 1821 results->orientationType =
1813 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); 1822 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display);
1814 gfx::DeviceDisplayInfo info; 1823 gfx::DeviceDisplayInfo info;
1815 results->depth = info.GetBitsPerPixel(); 1824 results->depth = info.GetBitsPerPixel();
1816 results->depthPerComponent = info.GetBitsPerComponent(); 1825 results->depthPerComponent = info.GetBitsPerComponent();
1817 results->isMonochrome = (results->depthPerComponent == 0); 1826 results->isMonochrome = (results->depthPerComponent == 0);
1818 } 1827 }
1819 1828
1820 } // namespace content 1829 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698