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

Side by Side Diff: ui/events/gesture_detection/gesture_provider.cc

Issue 717573004: [Android] Thoroughly reset gesture detection upon page navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comment 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/events/gesture_detection/gesture_provider.h" 5 #include "ui/events/gesture_detection/gesture_provider.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
11 #include "ui/events/event_constants.h" 11 #include "ui/events/event_constants.h"
12 #include "ui/events/gesture_detection/gesture_event_data.h" 12 #include "ui/events/gesture_detection/gesture_event_data.h"
13 #include "ui/events/gesture_detection/gesture_listeners.h" 13 #include "ui/events/gesture_detection/gesture_listeners.h"
14 #include "ui/events/gesture_detection/motion_event.h" 14 #include "ui/events/gesture_detection/motion_event.h"
15 #include "ui/events/gesture_detection/motion_event_generic.h"
15 #include "ui/events/gesture_detection/scale_gesture_listeners.h" 16 #include "ui/events/gesture_detection/scale_gesture_listeners.h"
16 #include "ui/gfx/geometry/point_f.h" 17 #include "ui/gfx/geometry/point_f.h"
17 18
18 namespace ui { 19 namespace ui {
19 namespace { 20 namespace {
20 21
21 // Double-tap drag zoom sensitivity (speed). 22 // Double-tap drag zoom sensitivity (speed).
22 const float kDoubleTapDragZoomSpeed = 0.005f; 23 const float kDoubleTapDragZoomSpeed = 0.005f;
23 24
24 const char* GetMotionEventActionName(MotionEvent::Action action) { 25 const char* GetMotionEventActionName(MotionEvent::Action action) {
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 if (!CanHandle(event)) 705 if (!CanHandle(event))
705 return false; 706 return false;
706 707
707 OnTouchEventHandlingBegin(event); 708 OnTouchEventHandlingBegin(event);
708 gesture_listener_->OnTouchEvent(event); 709 gesture_listener_->OnTouchEvent(event);
709 OnTouchEventHandlingEnd(event); 710 OnTouchEventHandlingEnd(event);
710 uma_histogram_.RecordTouchEvent(event); 711 uma_histogram_.RecordTouchEvent(event);
711 return true; 712 return true;
712 } 713 }
713 714
715 void GestureProvider::ResetDetection() {
716 MotionEventGeneric generic_cancel_event(MotionEvent::ACTION_CANCEL,
717 base::TimeTicks::Now(),
718 PointerProperties());
719 OnTouchEvent(generic_cancel_event);
720 }
721
714 void GestureProvider::SetMultiTouchZoomSupportEnabled(bool enabled) { 722 void GestureProvider::SetMultiTouchZoomSupportEnabled(bool enabled) {
715 gesture_listener_->SetMultiTouchZoomEnabled(enabled); 723 gesture_listener_->SetMultiTouchZoomEnabled(enabled);
716 } 724 }
717 725
718 void GestureProvider::SetDoubleTapSupportForPlatformEnabled(bool enabled) { 726 void GestureProvider::SetDoubleTapSupportForPlatformEnabled(bool enabled) {
719 if (double_tap_support_for_platform_ == enabled) 727 if (double_tap_support_for_platform_ == enabled)
720 return; 728 return;
721 double_tap_support_for_platform_ = enabled; 729 double_tap_support_for_platform_ = enabled;
722 UpdateDoubleTapDetectionSupport(); 730 UpdateDoubleTapDetectionSupport();
723 } 731 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 // null'ing of the listener until the sequence has ended. 821 // null'ing of the listener until the sequence has ended.
814 if (current_down_event_) 822 if (current_down_event_)
815 return; 823 return;
816 824
817 const bool double_tap_enabled = 825 const bool double_tap_enabled =
818 double_tap_support_for_page_ && double_tap_support_for_platform_; 826 double_tap_support_for_page_ && double_tap_support_for_platform_;
819 gesture_listener_->SetDoubleTapEnabled(double_tap_enabled); 827 gesture_listener_->SetDoubleTapEnabled(double_tap_enabled);
820 } 828 }
821 829
822 } // namespace ui 830 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/gesture_detection/gesture_provider.h ('k') | ui/events/gesture_detection/gesture_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698