| 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> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 void GestureProviderAura::OnTouchEventAck(uint32_t unique_event_id, | 44 void GestureProviderAura::OnTouchEventAck(uint32_t unique_event_id, |
| 45 bool event_consumed) { | 45 bool event_consumed) { |
| 46 DCHECK(pending_gestures_.empty()); | 46 DCHECK(pending_gestures_.empty()); |
| 47 DCHECK(!handling_event_); | 47 DCHECK(!handling_event_); |
| 48 base::AutoReset<bool> handling_event(&handling_event_, true); | 48 base::AutoReset<bool> handling_event(&handling_event_, true); |
| 49 filtered_gesture_provider_.OnTouchEventAck(unique_event_id, event_consumed); | 49 filtered_gesture_provider_.OnTouchEventAck(unique_event_id, event_consumed); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void GestureProviderAura::OnGestureEvent( | 52 void GestureProviderAura::OnGestureEvent( |
| 53 const GestureEventData& gesture) { | 53 const GestureEventData& gesture) { |
| 54 scoped_ptr<ui::GestureEvent> event( | 54 std::unique_ptr<ui::GestureEvent> event( |
| 55 new ui::GestureEvent(gesture.x, gesture.y, gesture.flags, | 55 new ui::GestureEvent(gesture.x, gesture.y, gesture.flags, |
| 56 gesture.time - base::TimeTicks(), gesture.details)); | 56 gesture.time - base::TimeTicks(), gesture.details)); |
| 57 | 57 |
| 58 if (!handling_event_) { | 58 if (!handling_event_) { |
| 59 // Dispatching event caused by timer. | 59 // Dispatching event caused by timer. |
| 60 client_->OnGestureEvent(gesture_consumer_, event.get()); | 60 client_->OnGestureEvent(gesture_consumer_, event.get()); |
| 61 } else { | 61 } else { |
| 62 // Memory managed by ScopedVector pending_gestures_. | 62 // Memory managed by ScopedVector pending_gestures_. |
| 63 pending_gestures_.push_back(std::move(event)); | 63 pending_gestures_.push_back(std::move(event)); |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 | 66 |
| 67 ScopedVector<GestureEvent>* GestureProviderAura::GetAndResetPendingGestures() { | 67 ScopedVector<GestureEvent>* GestureProviderAura::GetAndResetPendingGestures() { |
| 68 if (pending_gestures_.empty()) | 68 if (pending_gestures_.empty()) |
| 69 return NULL; | 69 return NULL; |
| 70 // Caller is responsible for deleting old_pending_gestures. | 70 // Caller is responsible for deleting old_pending_gestures. |
| 71 ScopedVector<GestureEvent>* old_pending_gestures = | 71 ScopedVector<GestureEvent>* old_pending_gestures = |
| 72 new ScopedVector<GestureEvent>(); | 72 new ScopedVector<GestureEvent>(); |
| 73 old_pending_gestures->swap(pending_gestures_); | 73 old_pending_gestures->swap(pending_gestures_); |
| 74 return old_pending_gestures; | 74 return old_pending_gestures; |
| 75 } | 75 } |
| 76 | 76 |
| 77 } // namespace content | 77 } // namespace content |
| OLD | NEW |