| 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 #ifndef UI_EVENTS_GESTURE_DETECTION_GESTURE_DETECTOR_H_ | 5 #ifndef UI_EVENTS_GESTURE_DETECTION_GESTURE_DETECTOR_H_ |
| 6 #define UI_EVENTS_GESTURE_DETECTION_GESTURE_DETECTOR_H_ | 6 #define UI_EVENTS_GESTURE_DETECTION_GESTURE_DETECTOR_H_ |
| 7 | 7 |
| 8 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 9 #include "ui/events/gesture_detection/gesture_detection_export.h" | 10 #include "ui/events/gesture_detection/gesture_detection_export.h" |
| 10 #include "ui/events/gesture_detection/velocity_tracker_state.h" | 11 #include "ui/events/gesture_detection/velocity_tracker_state.h" |
| 11 | 12 |
| 12 namespace ui { | 13 namespace ui { |
| 13 | 14 |
| 14 class MotionEvent; | 15 class MotionEvent; |
| 15 | 16 |
| 16 // Port of GestureDetector.java from Android | 17 // Port of GestureDetector.java from Android |
| 17 // * platform/frameworks/base/core/java/android/view/GestureDetector.java | 18 // * platform/frameworks/base/core/java/android/view/GestureDetector.java |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 }; | 77 }; |
| 77 | 78 |
| 78 GestureDetector(const Config& config, | 79 GestureDetector(const Config& config, |
| 79 GestureListener* listener, | 80 GestureListener* listener, |
| 80 DoubleTapListener* optional_double_tap_listener); | 81 DoubleTapListener* optional_double_tap_listener); |
| 81 ~GestureDetector(); | 82 ~GestureDetector(); |
| 82 | 83 |
| 83 bool OnTouchEvent(const MotionEvent& ev); | 84 bool OnTouchEvent(const MotionEvent& ev); |
| 84 | 85 |
| 85 void set_doubletap_listener(DoubleTapListener* double_tap_listener) { | 86 void set_doubletap_listener(DoubleTapListener* double_tap_listener) { |
| 87 DCHECK(!is_double_tapping_ || double_tap_listener_); |
| 86 double_tap_listener_ = double_tap_listener; | 88 double_tap_listener_ = double_tap_listener; |
| 87 } | 89 } |
| 88 | 90 |
| 89 void set_is_longpress_enabled(bool is_longpress_enabled) { | 91 void set_is_longpress_enabled(bool is_longpress_enabled) { |
| 90 is_longpress_enabled_ = is_longpress_enabled; | 92 is_longpress_enabled_ = is_longpress_enabled; |
| 91 } | 93 } |
| 92 | 94 |
| 93 bool is_longpress_enabled() const { return is_longpress_enabled_; } | 95 bool is_longpress_enabled() const { return is_longpress_enabled_; } |
| 94 | 96 |
| 95 private: | 97 private: |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 139 |
| 138 // Determines speed during touch scrolling. | 140 // Determines speed during touch scrolling. |
| 139 VelocityTrackerState velocity_tracker_; | 141 VelocityTrackerState velocity_tracker_; |
| 140 | 142 |
| 141 DISALLOW_COPY_AND_ASSIGN(GestureDetector); | 143 DISALLOW_COPY_AND_ASSIGN(GestureDetector); |
| 142 }; | 144 }; |
| 143 | 145 |
| 144 } // namespace ui | 146 } // namespace ui |
| 145 | 147 |
| 146 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_DETECTOR_H_ | 148 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_DETECTOR_H_ |
| OLD | NEW |