OLD | NEW |
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_generic.h" |
15 #include "ui/events/gesture_detection/scale_gesture_listeners.h" | 15 #include "ui/events/gesture_detection/scale_gesture_listeners.h" |
16 #include "ui/gfx/geometry/point_f.h" | 16 #include "ui/gfx/geometry/point_f.h" |
17 | 17 |
18 namespace ui { | 18 namespace ui { |
19 namespace { | 19 namespace { |
20 | 20 |
21 // Double-tap drag zoom sensitivity (speed). | 21 // Double-tap drag zoom sensitivity (speed). |
22 const float kDoubleTapDragZoomSpeed = 0.005f; | 22 const float kDoubleTapDragZoomSpeed = 0.005f; |
23 | 23 |
24 const char* GetMotionEventActionName(MotionEvent::Action action) { | 24 const char* GetMotionEventActionName(MotionEvent::Action action) { |
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 if (!CanHandle(event)) | 704 if (!CanHandle(event)) |
705 return false; | 705 return false; |
706 | 706 |
707 OnTouchEventHandlingBegin(event); | 707 OnTouchEventHandlingBegin(event); |
708 gesture_listener_->OnTouchEvent(event); | 708 gesture_listener_->OnTouchEvent(event); |
709 OnTouchEventHandlingEnd(event); | 709 OnTouchEventHandlingEnd(event); |
710 uma_histogram_.RecordTouchEvent(event); | 710 uma_histogram_.RecordTouchEvent(event); |
711 return true; | 711 return true; |
712 } | 712 } |
713 | 713 |
| 714 void GestureProvider::ResetDetection() { |
| 715 ui::MotionEventGeneric synthetic_cancel(ui::MotionEvent::ACTION_CANCEL, |
| 716 base::TimeTicks::Now(), |
| 717 ui::PointerProperties()); |
| 718 OnTouchEvent(synthetic_cancel); |
| 719 DCHECK(!current_down_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 Loading... |
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 |
OLD | NEW |