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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 gesture.y, | 69 gesture.y, |
70 gesture.flags, | 70 gesture.flags, |
71 gesture.time - base::TimeTicks(), | 71 gesture.time - base::TimeTicks(), |
72 details)); | 72 details)); |
73 | 73 |
74 if (!handling_event_) { | 74 if (!handling_event_) { |
75 // Dispatching event caused by timer. | 75 // Dispatching event caused by timer. |
76 client_->OnGestureEvent(event.get()); | 76 client_->OnGestureEvent(event.get()); |
77 } else { | 77 } else { |
78 // Memory managed by ScopedVector pending_gestures_. | 78 // Memory managed by ScopedVector pending_gestures_. |
79 pending_gestures_.push_back(event.release()); | 79 pending_gestures_.push_back(event.Pass()); |
80 } | 80 } |
81 } | 81 } |
82 | 82 |
83 ScopedVector<GestureEvent>* GestureProviderAura::GetAndResetPendingGestures() { | 83 ScopedVector<GestureEvent>* GestureProviderAura::GetAndResetPendingGestures() { |
84 if (pending_gestures_.empty()) | 84 if (pending_gestures_.empty()) |
85 return NULL; | 85 return NULL; |
86 // Caller is responsible for deleting old_pending_gestures. | 86 // Caller is responsible for deleting old_pending_gestures. |
87 ScopedVector<GestureEvent>* old_pending_gestures = | 87 ScopedVector<GestureEvent>* old_pending_gestures = |
88 new ScopedVector<GestureEvent>(); | 88 new ScopedVector<GestureEvent>(); |
89 old_pending_gestures->swap(pending_gestures_); | 89 old_pending_gestures->swap(pending_gestures_); |
(...skipping 13 matching lines...) Expand all Loading... |
103 float double_tap_slop_square = | 103 float double_tap_slop_square = |
104 GestureConfiguration::GetInstance() | 104 GestureConfiguration::GetInstance() |
105 ->max_distance_between_taps_for_double_tap(); | 105 ->max_distance_between_taps_for_double_tap(); |
106 double_tap_slop_square *= double_tap_slop_square; | 106 double_tap_slop_square *= double_tap_slop_square; |
107 const float delta_x = previous_tap.x - current_tap.x; | 107 const float delta_x = previous_tap.x - current_tap.x; |
108 const float delta_y = previous_tap.y - current_tap.y; | 108 const float delta_y = previous_tap.y - current_tap.y; |
109 return (delta_x * delta_x + delta_y * delta_y < double_tap_slop_square); | 109 return (delta_x * delta_x + delta_y * delta_y < double_tap_slop_square); |
110 } | 110 } |
111 | 111 |
112 } // namespace content | 112 } // namespace content |
OLD | NEW |