Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Unified Diff: ui/events/gestures/gesture_provider_aura.cc

Issue 306483003: Prepare for Unified Gesture Recognizer landing in Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix whitespace, disable UGR. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/events/gestures/gesture_provider_aura.h ('k') | ui/events/gestures/gesture_recognizer_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/gestures/gesture_provider_aura.cc
diff --git a/ui/events/gestures/gesture_provider_aura.cc b/ui/events/gestures/gesture_provider_aura.cc
index 0db2e04f882d52dd017c8e31a33d5a6638eabea7..edff9e38979939fe567cc06862a1b6b34cde1901 100644
--- a/ui/events/gestures/gesture_provider_aura.cc
+++ b/ui/events/gestures/gesture_provider_aura.cc
@@ -4,6 +4,7 @@
#include "ui/events/gestures/gesture_provider_aura.h"
+#include "base/auto_reset.h"
#include "base/logging.h"
#include "ui/events/event.h"
#include "ui/events/gesture_detection/gesture_config_helper.h"
@@ -14,7 +15,8 @@ namespace ui {
GestureProviderAura::GestureProviderAura(GestureProviderAuraClient* client)
: client_(client),
- filtered_gesture_provider_(ui::DefaultGestureProviderConfig(), this) {
+ filtered_gesture_provider_(ui::DefaultGestureProviderConfig(), this),
+ handling_event_(false) {
filtered_gesture_provider_.SetDoubleTapSupportForPlatformEnabled(false);
}
@@ -48,6 +50,9 @@ bool GestureProviderAura::OnTouchEvent(const TouchEvent& event) {
}
void GestureProviderAura::OnTouchEventAck(bool event_consumed) {
+ DCHECK(pending_gestures_.empty());
+ DCHECK(!handling_event_);
+ base::AutoReset<bool> handling_event(&handling_event_, true);
filtered_gesture_provider_.OnTouchEventAck(event_consumed);
}
@@ -69,18 +74,36 @@ void GestureProviderAura::OnGestureEvent(
previous_tap_.reset();
}
- ui::GestureEvent event(gesture.type,
- gesture.x,
- gesture.y,
- last_touch_event_flags_,
- gesture.time - base::TimeTicks(),
- details,
- // ui::GestureEvent stores a bitfield indicating the
- // ids of active touch points. This is currently only
- // used when one finger is down, and will eventually
- // be cleaned up. See crbug.com/366707.
- 1 << gesture.motion_event_id);
- client_->OnGestureEvent(&event);
+ scoped_ptr<ui::GestureEvent> event(
+ new ui::GestureEvent(gesture.type,
+ gesture.x,
+ gesture.y,
+ last_touch_event_flags_,
+ gesture.time - base::TimeTicks(),
+ details,
+ // ui::GestureEvent stores a bitfield indicating the
+ // ids of active touch points. This is currently only
+ // used when one finger is down, and will eventually
+ // be cleaned up. See crbug.com/366707.
+ 1 << gesture.motion_event_id));
+
+ if (!handling_event_) {
+ // Dispatching event caused by timer.
+ client_->OnGestureEvent(event.get());
+ } else {
+ // Memory managed by ScopedVector pending_gestures_.
+ pending_gestures_.push_back(event.release());
+ }
+}
+
+ScopedVector<GestureEvent>* GestureProviderAura::GetAndResetPendingGestures() {
+ if (pending_gestures_.empty())
+ return NULL;
+ // Caller is responsible for deleting old_pending_gestures.
+ ScopedVector<GestureEvent>* old_pending_gestures =
+ new ScopedVector<GestureEvent>();
+ old_pending_gestures->swap(pending_gestures_);
+ return old_pending_gestures;
}
bool GestureProviderAura::IsConsideredDoubleTap(
« no previous file with comments | « ui/events/gestures/gesture_provider_aura.h ('k') | ui/events/gestures/gesture_recognizer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698