| 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_PROVIDER_H_ | 5 #ifndef UI_EVENTS_GESTURE_DETECTION_GESTURE_PROVIDER_H_ |
| 6 #define UI_EVENTS_GESTURE_DETECTION_GESTURE_PROVIDER_H_ | 6 #define UI_EVENTS_GESTURE_DETECTION_GESTURE_PROVIDER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ui/events/gesture_detection/gesture_detection_export.h" | 10 #include "ui/events/gesture_detection/gesture_detection_export.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 GestureDetector::Config gesture_detector_config; | 34 GestureDetector::Config gesture_detector_config; |
| 35 ScaleGestureDetector::Config scale_gesture_detector_config; | 35 ScaleGestureDetector::Config scale_gesture_detector_config; |
| 36 | 36 |
| 37 // If |disable_click_delay| is true and double-tap support is disabled, | 37 // If |disable_click_delay| is true and double-tap support is disabled, |
| 38 // there will be no delay before tap events. When double-tap support is | 38 // there will be no delay before tap events. When double-tap support is |
| 39 // enabled, there will always be a delay before a tap event is fired, in | 39 // enabled, there will always be a delay before a tap event is fired, in |
| 40 // order to allow the double tap gesture to occur without firing any tap | 40 // order to allow the double tap gesture to occur without firing any tap |
| 41 // events. | 41 // events. |
| 42 bool disable_click_delay; | 42 bool disable_click_delay; |
| 43 | 43 |
| 44 // Whether double-tap detection is supported by the platform. If disabled, |
| 45 // there will be no delay before tap events. Defaults to true. |
| 46 bool double_tap_support_for_platform_enabled; |
| 47 |
| 44 // If |gesture_begin_end_types_enabled| is true, fire an ET_GESTURE_BEGIN | 48 // If |gesture_begin_end_types_enabled| is true, fire an ET_GESTURE_BEGIN |
| 45 // event for every added touch point, and an ET_GESTURE_END event for every | 49 // event for every added touch point, and an ET_GESTURE_END event for every |
| 46 // removed touch point. This requires one ACTION_CANCEL event to be sent per | 50 // removed touch point. This requires one ACTION_CANCEL event to be sent per |
| 47 // touch point, which only occurs on Aura. Defaults to false. | 51 // touch point, which only occurs on Aura. Defaults to false. |
| 48 bool gesture_begin_end_types_enabled; | 52 bool gesture_begin_end_types_enabled; |
| 49 | 53 |
| 50 // The min and max size (both length and width, in dips) of the generated | 54 // The min and max size (both length and width, in dips) of the generated |
| 51 // bounding box for all gesture types. This is useful for touch streams | 55 // bounding box for all gesture types. This is useful for touch streams |
| 52 // that may report zero or unreasonably small or large touch sizes. | 56 // that may report zero or unreasonably small or large touch sizes. |
| 53 // Note that these bounds are only applied for touch or unknown tool types; | 57 // Note that these bounds are only applied for touch or unknown tool types; |
| 54 // mouse and stylus-derived gestures will not be affected. | 58 // mouse and stylus-derived gestures will not be affected. |
| 55 // Both values default to 0 (disabled). | 59 // Both values default to 0 (disabled). |
| 56 float min_gesture_bounds_length; | 60 float min_gesture_bounds_length; |
| 57 float max_gesture_bounds_length; | 61 float max_gesture_bounds_length; |
| 58 }; | 62 }; |
| 59 | 63 |
| 60 GestureProvider(const Config& config, GestureProviderClient* client); | 64 GestureProvider(const Config& config, GestureProviderClient* client); |
| 61 ~GestureProvider(); | 65 ~GestureProvider(); |
| 62 | 66 |
| 63 // Handle the incoming MotionEvent, returning false if the event could not | 67 // Handle the incoming MotionEvent, returning false if the event could not |
| 64 // be handled. | 68 // be handled. |
| 65 bool OnTouchEvent(const MotionEvent& event); | 69 bool OnTouchEvent(const MotionEvent& event); |
| 66 | 70 |
| 71 // Reset any active gesture detection, including detection of timeout-based |
| 72 // events (e.g., double-tap or delayed tap) for which the pointer has already |
| 73 // been released. |
| 74 void ResetDetection(); |
| 75 |
| 67 // Update whether multi-touch pinch zoom is supported by the platform. | 76 // Update whether multi-touch pinch zoom is supported by the platform. |
| 68 void SetMultiTouchZoomSupportEnabled(bool enabled); | 77 void SetMultiTouchZoomSupportEnabled(bool enabled); |
| 69 | 78 |
| 70 // Update whether double-tap gestures are supported by the platform. | 79 // Update whether double-tap gestures are supported by the platform. |
| 71 void SetDoubleTapSupportForPlatformEnabled(bool enabled); | 80 void SetDoubleTapSupportForPlatformEnabled(bool enabled); |
| 72 | 81 |
| 73 // Update whether double-tap gesture detection should be suppressed, e.g., | 82 // Update whether double-tap gesture detection should be suppressed, e.g., |
| 74 // if the page scale is fixed or the page has a mobile viewport. This disables | 83 // if the page scale is fixed or the page has a mobile viewport. This disables |
| 75 // the tap delay, allowing rapid and responsive single-tap gestures. | 84 // the tap delay, allowing rapid and responsive single-tap gestures. |
| 76 void SetDoubleTapSupportForPageEnabled(bool enabled); | 85 void SetDoubleTapSupportForPageEnabled(bool enabled); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // Whether double-tap gesture detection is currently supported. | 117 // Whether double-tap gesture detection is currently supported. |
| 109 bool double_tap_support_for_page_; | 118 bool double_tap_support_for_page_; |
| 110 bool double_tap_support_for_platform_; | 119 bool double_tap_support_for_platform_; |
| 111 | 120 |
| 112 const bool gesture_begin_end_types_enabled_; | 121 const bool gesture_begin_end_types_enabled_; |
| 113 }; | 122 }; |
| 114 | 123 |
| 115 } // namespace ui | 124 } // namespace ui |
| 116 | 125 |
| 117 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_PROVIDER_H_ | 126 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_PROVIDER_H_ |
| OLD | NEW |