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/gestures/gesture_provider_aura.h" | 5 #include "ui/events/gestures/gesture_provider_aura.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "ui/events/event.h" | 9 #include "ui/events/event.h" |
10 #include "ui/events/gesture_detection/gesture_configuration.h" | 10 #include "ui/events/gesture_detection/gesture_configuration.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 } | 53 } |
54 | 54 |
55 void GestureProviderAura::OnTouchEventAck(bool event_consumed) { | 55 void GestureProviderAura::OnTouchEventAck(bool event_consumed) { |
56 DCHECK(pending_gestures_.empty()); | 56 DCHECK(pending_gestures_.empty()); |
57 DCHECK(!handling_event_); | 57 DCHECK(!handling_event_); |
58 base::AutoReset<bool> handling_event(&handling_event_, true); | 58 base::AutoReset<bool> handling_event(&handling_event_, true); |
59 filtered_gesture_provider_.OnTouchEventAck(event_consumed); | 59 filtered_gesture_provider_.OnTouchEventAck(event_consumed); |
60 last_touch_event_latency_info_.Clear(); | 60 last_touch_event_latency_info_.Clear(); |
61 } | 61 } |
62 | 62 |
| 63 void GestureProviderAura::IgnoreLastTouchEvent() { |
| 64 filtered_gesture_provider_.IgnoreLastTouchEvent(); |
| 65 } |
| 66 |
63 void GestureProviderAura::OnGestureEvent( | 67 void GestureProviderAura::OnGestureEvent( |
64 const GestureEventData& gesture) { | 68 const GestureEventData& gesture) { |
65 GestureEventDetails details = gesture.details; | 69 GestureEventDetails details = gesture.details; |
66 details.set_oldest_touch_id(gesture.motion_event_id); | 70 details.set_oldest_touch_id(gesture.motion_event_id); |
67 | 71 |
68 if (gesture.type() == ET_GESTURE_TAP) { | 72 if (gesture.type() == ET_GESTURE_TAP) { |
69 int tap_count = 1; | 73 int tap_count = 1; |
70 if (previous_tap_ && IsConsideredDoubleTap(*previous_tap_, gesture)) | 74 if (previous_tap_ && IsConsideredDoubleTap(*previous_tap_, gesture)) |
71 tap_count = 1 + (previous_tap_->details.tap_count() % 3); | 75 tap_count = 1 + (previous_tap_->details.tap_count() % 3); |
72 details.set_tap_count(tap_count); | 76 details.set_tap_count(tap_count); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 float double_tap_slop_square = | 134 float double_tap_slop_square = |
131 GestureConfiguration::GetInstance() | 135 GestureConfiguration::GetInstance() |
132 ->max_distance_between_taps_for_double_tap(); | 136 ->max_distance_between_taps_for_double_tap(); |
133 double_tap_slop_square *= double_tap_slop_square; | 137 double_tap_slop_square *= double_tap_slop_square; |
134 const float delta_x = previous_tap.x - current_tap.x; | 138 const float delta_x = previous_tap.x - current_tap.x; |
135 const float delta_y = previous_tap.y - current_tap.y; | 139 const float delta_y = previous_tap.y - current_tap.y; |
136 return (delta_x * delta_x + delta_y * delta_y < double_tap_slop_square); | 140 return (delta_x * delta_x + delta_y * delta_y < double_tap_slop_square); |
137 } | 141 } |
138 | 142 |
139 } // namespace content | 143 } // namespace content |
OLD | NEW |