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 // MSVC++ requires this to be set before any other includes to get M_PI. | 5 // MSVC++ requires this to be set before any other includes to get M_PI. |
6 #define _USE_MATH_DEFINES | 6 #define _USE_MATH_DEFINES |
7 | 7 |
8 #include "ui/events/gesture_detection/gesture_detector.h" | 8 #include "ui/events/gesture_detection/gesture_detector.h" |
9 | 9 |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 } | 96 } |
97 | 97 |
98 bool HasTimeout(TimeoutEvent event) const { | 98 bool HasTimeout(TimeoutEvent event) const { |
99 return timeout_timers_[event].IsRunning(); | 99 return timeout_timers_[event].IsRunning(); |
100 } | 100 } |
101 | 101 |
102 private: | 102 private: |
103 typedef void (GestureDetector::*ReceiverMethod)(); | 103 typedef void (GestureDetector::*ReceiverMethod)(); |
104 | 104 |
105 GestureDetector* const gesture_detector_; | 105 GestureDetector* const gesture_detector_; |
106 base::OneShotTimer<GestureDetector> timeout_timers_[TIMEOUT_EVENT_COUNT]; | 106 base::OneShotTimer timeout_timers_[TIMEOUT_EVENT_COUNT]; |
107 ReceiverMethod timeout_callbacks_[TIMEOUT_EVENT_COUNT]; | 107 ReceiverMethod timeout_callbacks_[TIMEOUT_EVENT_COUNT]; |
108 base::TimeDelta timeout_delays_[TIMEOUT_EVENT_COUNT]; | 108 base::TimeDelta timeout_delays_[TIMEOUT_EVENT_COUNT]; |
109 }; | 109 }; |
110 | 110 |
111 GestureDetector::GestureDetector( | 111 GestureDetector::GestureDetector( |
112 const Config& config, | 112 const Config& config, |
113 GestureListener* listener, | 113 GestureListener* listener, |
114 DoubleTapListener* optional_double_tap_listener) | 114 DoubleTapListener* optional_double_tap_listener) |
115 : timeout_handler_(new TimeoutGestureHandler(config, this)), | 115 : timeout_handler_(new TimeoutGestureHandler(config, this)), |
116 listener_(listener), | 116 listener_(listener), |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 return false; | 503 return false; |
504 | 504 |
505 if (vx_abs > vy_abs) | 505 if (vx_abs > vy_abs) |
506 vy = 0; | 506 vy = 0; |
507 else | 507 else |
508 vx = 0; | 508 vx = 0; |
509 return listener_->OnSwipe(*current_down_event_, up, vx, vy); | 509 return listener_->OnSwipe(*current_down_event_, up, vx, vy); |
510 } | 510 } |
511 | 511 |
512 } // namespace ui | 512 } // namespace ui |
OLD | NEW |