Index: ui/events/gesture_detection/gesture_provider.cc |
diff --git a/ui/events/gesture_detection/gesture_provider.cc b/ui/events/gesture_detection/gesture_provider.cc |
index 4deeba2580f3a7a72928cd3cec30f4a401aa2f18..4e0516a3cf04d44dccb676d83808e63bb3e43bb1 100644 |
--- a/ui/events/gesture_detection/gesture_provider.cc |
+++ b/ui/events/gesture_detection/gesture_provider.cc |
@@ -76,7 +76,8 @@ GestureEventDetails CreateTapGestureDetails(EventType type, |
// GestureProvider:::Config |
-GestureProvider::Config::Config() : disable_click_delay(false) {} |
+GestureProvider::Config::Config() |
+ : disable_click_delay(false), send_aura_specific_gestures(false) {} |
GestureProvider::Config::~Config() {} |
@@ -604,7 +605,8 @@ GestureProvider::GestureProvider(const Config& config, |
needs_show_press_event_(false), |
needs_tap_ending_event_(false), |
touch_scroll_in_progress_(false), |
- pinch_in_progress_(false) { |
+ pinch_in_progress_(false), |
+ send_aura_specific_gestures_(false) { |
DCHECK(client); |
InitGestureDetectors(config); |
} |
@@ -617,6 +619,9 @@ bool GestureProvider::OnTouchEvent(const MotionEvent& event) { |
if (!CanHandle(event)) |
return false; |
+ if (send_aura_specific_gestures_) |
+ SendGestureBeginOrEndIfNecessary(event); |
jdduke (slow)
2014/04/03 20:17:16
But don't we want the GestureEnd to come after eve
tdresser
2014/04/03 21:14:41
Done.
|
+ |
const bool was_touch_scrolling_ = touch_scroll_in_progress_; |
const bool in_scale_gesture = |
scale_gesture_listener_->IsScaleGestureDetectionInProgress(); |
@@ -696,6 +701,7 @@ void GestureProvider::InitGestureDetectors(const Config& config) { |
scale_gesture_listener_.reset( |
new ScaleGestureListenerImpl(config.scale_gesture_detector_config, this)); |
+ send_aura_specific_gestures_ = config.send_aura_specific_gestures; |
} |
bool GestureProvider::CanHandle(const MotionEvent& event) const { |
@@ -734,7 +740,8 @@ void GestureProvider::Send(const GestureEventData& gesture) { |
// are SHOW_PRESS and TAP, potentially triggered by the double-tap |
// delay timing out. |
DCHECK(current_down_event_ || gesture.type == ET_GESTURE_TAP || |
- gesture.type == ET_GESTURE_SHOW_PRESS); |
+ gesture.type == ET_GESTURE_SHOW_PRESS || |
+ gesture.type == ET_GESTURE_BEGIN); |
switch (gesture.type) { |
case ET_GESTURE_TAP_DOWN: |
@@ -818,4 +825,21 @@ void GestureProvider::EndTouchScrollIfNecessary(base::TimeTicks time, |
Send(CreateGesture(ET_GESTURE_SCROLL_END, time, 0, 0)); |
} |
+void GestureProvider::SendGestureBeginOrEndIfNecessary( |
+ const MotionEvent& event) { |
+ switch(event.GetAction()) { |
jdduke (slow)
2014/04/03 20:17:16
Might as well move the check for the condition her
tdresser
2014/04/03 21:14:41
Done.
|
+ case MotionEvent::ACTION_DOWN: |
+ case MotionEvent::ACTION_POINTER_DOWN: |
+ Send(CreateGesture(ET_GESTURE_BEGIN, event)); |
+ break; |
+ case MotionEvent::ACTION_UP: |
+ case MotionEvent::ACTION_POINTER_UP: |
+ case MotionEvent::ACTION_CANCEL: |
+ Send(CreateGesture(ET_GESTURE_END, event)); |
+ break; |
+ case MotionEvent::ACTION_MOVE: |
+ break; |
+ } |
+} |
+ |
} // namespace ui |