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 <utility> |
| 8 |
7 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
8 #include "base/logging.h" | 10 #include "base/logging.h" |
9 #include "ui/events/event.h" | 11 #include "ui/events/event.h" |
10 #include "ui/events/gesture_detection/gesture_configuration.h" | 12 #include "ui/events/gesture_detection/gesture_configuration.h" |
11 #include "ui/events/gesture_detection/gesture_event_data.h" | 13 #include "ui/events/gesture_detection/gesture_event_data.h" |
12 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" | 14 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" |
13 | 15 |
14 namespace ui { | 16 namespace ui { |
15 | 17 |
16 GestureProviderAura::GestureProviderAura(GestureProviderAuraClient* client) | 18 GestureProviderAura::GestureProviderAura(GestureProviderAuraClient* client) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 gesture.y, | 56 gesture.y, |
55 gesture.flags, | 57 gesture.flags, |
56 gesture.time - base::TimeTicks(), | 58 gesture.time - base::TimeTicks(), |
57 details)); | 59 details)); |
58 | 60 |
59 if (!handling_event_) { | 61 if (!handling_event_) { |
60 // Dispatching event caused by timer. | 62 // Dispatching event caused by timer. |
61 client_->OnGestureEvent(event.get()); | 63 client_->OnGestureEvent(event.get()); |
62 } else { | 64 } else { |
63 // Memory managed by ScopedVector pending_gestures_. | 65 // Memory managed by ScopedVector pending_gestures_. |
64 pending_gestures_.push_back(event.Pass()); | 66 pending_gestures_.push_back(std::move(event)); |
65 } | 67 } |
66 } | 68 } |
67 | 69 |
68 ScopedVector<GestureEvent>* GestureProviderAura::GetAndResetPendingGestures() { | 70 ScopedVector<GestureEvent>* GestureProviderAura::GetAndResetPendingGestures() { |
69 if (pending_gestures_.empty()) | 71 if (pending_gestures_.empty()) |
70 return NULL; | 72 return NULL; |
71 // Caller is responsible for deleting old_pending_gestures. | 73 // Caller is responsible for deleting old_pending_gestures. |
72 ScopedVector<GestureEvent>* old_pending_gestures = | 74 ScopedVector<GestureEvent>* old_pending_gestures = |
73 new ScopedVector<GestureEvent>(); | 75 new ScopedVector<GestureEvent>(); |
74 old_pending_gestures->swap(pending_gestures_); | 76 old_pending_gestures->swap(pending_gestures_); |
75 return old_pending_gestures; | 77 return old_pending_gestures; |
76 } | 78 } |
77 | 79 |
78 } // namespace content | 80 } // namespace content |
OLD | NEW |