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_config_helper.h" | 10 #include "ui/events/gesture_detection/gesture_config_helper.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 gesture_latency->CopyLatencyFrom( | 95 gesture_latency->CopyLatencyFrom( |
96 last_touch_event_latency_info_, | 96 last_touch_event_latency_info_, |
97 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT); | 97 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT); |
98 gesture_latency->CopyLatencyFrom( | 98 gesture_latency->CopyLatencyFrom( |
99 last_touch_event_latency_info_, | 99 last_touch_event_latency_info_, |
100 ui::INPUT_EVENT_LATENCY_UI_COMPONENT); | 100 ui::INPUT_EVENT_LATENCY_UI_COMPONENT); |
101 gesture_latency->CopyLatencyFrom( | 101 gesture_latency->CopyLatencyFrom( |
102 last_touch_event_latency_info_, | 102 last_touch_event_latency_info_, |
103 ui::INPUT_EVENT_LATENCY_ACKED_TOUCH_COMPONENT); | 103 ui::INPUT_EVENT_LATENCY_ACKED_TOUCH_COMPONENT); |
104 | 104 |
105 if (!handling_event_) { | 105 // if (!handling_event_) { |
106 // Dispatching event caused by timer. | 106 // Dispatching event caused by timer. |
107 client_->OnGestureEvent(event.get()); | 107 client_->OnGestureEvent(event.get()); |
108 } else { | 108 // } else { |
109 // Memory managed by ScopedVector pending_gestures_. | 109 // Memory managed by ScopedVector pending_gestures_. |
110 pending_gestures_.push_back(event.release()); | 110 // pending_gestures_.push_back(event.release()); |
111 } | 111 // } |
112 } | 112 } |
113 | 113 |
114 ScopedVector<GestureEvent>* GestureProviderAura::GetAndResetPendingGestures() { | 114 ScopedVector<GestureEvent>* GestureProviderAura::GetAndResetPendingGestures() { |
115 if (pending_gestures_.empty()) | 115 if (pending_gestures_.empty()) |
116 return NULL; | 116 return NULL; |
117 // Caller is responsible for deleting old_pending_gestures. | 117 // Caller is responsible for deleting old_pending_gestures. |
118 ScopedVector<GestureEvent>* old_pending_gestures = | 118 ScopedVector<GestureEvent>* old_pending_gestures = |
119 new ScopedVector<GestureEvent>(); | 119 new ScopedVector<GestureEvent>(); |
120 old_pending_gestures->swap(pending_gestures_); | 120 old_pending_gestures->swap(pending_gestures_); |
121 return old_pending_gestures; | 121 return old_pending_gestures; |
(...skipping 11 matching lines...) Expand all Loading... |
133 | 133 |
134 double double_tap_slop_square = | 134 double double_tap_slop_square = |
135 GestureConfiguration::max_distance_between_taps_for_double_tap(); | 135 GestureConfiguration::max_distance_between_taps_for_double_tap(); |
136 double_tap_slop_square *= double_tap_slop_square; | 136 double_tap_slop_square *= double_tap_slop_square; |
137 const float delta_x = previous_tap.x - current_tap.x; | 137 const float delta_x = previous_tap.x - current_tap.x; |
138 const float delta_y = previous_tap.y - current_tap.y; | 138 const float delta_y = previous_tap.y - current_tap.y; |
139 return (delta_x * delta_x + delta_y * delta_y < double_tap_slop_square); | 139 return (delta_x * delta_x + delta_y * delta_y < double_tap_slop_square); |
140 } | 140 } |
141 | 141 |
142 } // namespace content | 142 } // namespace content |
OLD | NEW |