Index: ui/aura/window_event_dispatcher.cc |
diff --git a/ui/aura/window_event_dispatcher.cc b/ui/aura/window_event_dispatcher.cc |
index eadda03f6794645960382900eb4dcc4970ebb0a6..cf1c439c308062d6650c98e90abbd8542dcad082 100644 |
--- a/ui/aura/window_event_dispatcher.cc |
+++ b/ui/aura/window_event_dispatcher.cc |
@@ -159,18 +159,11 @@ DispatchDetails WindowEventDispatcher::DispatchMouseExitAtPoint( |
void WindowEventDispatcher::ProcessedTouchEvent(ui::TouchEvent* event, |
Window* window, |
ui::EventResult result) { |
- // TODO(tdresser): Move this to PreDispatchTouchEvent, to enable eager |
- // gesture detection. See crbug.com/410280. |
- if (!ui::GestureRecognizer::Get() |
- ->ProcessTouchEventPreDispatch(*event, window)) { |
- return; |
- } |
- |
// Once we've fully migrated to the eager gesture detector, we won't need to |
// pass an event here. |
scoped_ptr<ui::GestureRecognizer::Gestures> gestures( |
- ui::GestureRecognizer::Get()->ProcessTouchEventOnAsyncAck( |
- *event, result, window)); |
+ ui::GestureRecognizer::Get() |
+ ->ProcessTouchEventAck(*event, result, window)); |
DispatchDetails details = ProcessGestures(gestures.get()); |
if (details.dispatcher_destroyed) |
return; |
@@ -498,6 +491,10 @@ ui::EventDispatchDetails WindowEventDispatcher::PostDispatchEvent( |
// being dispatched. |
if (dispatching_held_event_ || !held_move_event_ || |
!held_move_event_->IsTouchEvent()) { |
+ // If the event is being handled asynchronously, ignore it. |
+ if (event.result() & ui::ER_CONSUMED) |
+ return details; |
+ scoped_ptr<ui::GestureRecognizer::Gestures> gestures; |
// Once we've fully migrated to the eager gesture detector, we won't |
// need to pass an event here. |
@@ -505,30 +502,31 @@ ui::EventDispatchDetails WindowEventDispatcher::PostDispatchEvent( |
static_cast<Window*>(event.target()), |
window()); |
- if (event.result() & ui::ER_CONSUMED) |
- orig_event.StopPropagation(); |
- |
- // TODO(tdresser): Move this to PreDispatchTouchEvent, to enable eager |
- // gesture detection. See crbug.com/410280. |
- if (!ui::GestureRecognizer::Get() |
- ->ProcessTouchEventPreDispatch(orig_event, |
- static_cast<Window*>(target))) { |
- return details; |
+ if (ui::GestureRecognizer::Get()->ProcessTouchEvent( |
+ orig_event, static_cast<Window*>(target))) { |
+ gestures.reset(ui::GestureRecognizer::Get()->ProcessTouchEventAck( |
+ orig_event, event.result(), static_cast<Window*>(target))); |
+ return ProcessGestures(gestures.get()); |
} |
- |
- scoped_ptr<ui::GestureRecognizer::Gestures> gestures; |
- |
- gestures.reset( |
- ui::GestureRecognizer::Get()->ProcessTouchEventPostDispatch( |
- orig_event, event.result(), static_cast<Window*>(target))); |
- |
- return ProcessGestures(gestures.get()); |
} |
} |
return details; |
} |
+bool WindowEventDispatcher::OnProcessingTouchEventAsync(ui::TouchEvent* event) { |
+ ui::TouchEvent orig_event( |
+ *event, static_cast<aura::Window*>(event->target()), window()); |
+ |
+ bool should_forward = ui::GestureRecognizer::Get()->ProcessTouchEvent( |
+ orig_event, static_cast<aura::Window*>(event->target())); |
+ |
+ // Make sure that |PostDispatch| doesn't give |event| to the GestureRecognizer |
+ // again. |
+ event->StopPropagation(); |
+ return should_forward; |
+} |
+ |
//////////////////////////////////////////////////////////////////////////////// |
// WindowEventDispatcher, ui::GestureEventHelper implementation: |