Index: ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cros.cc |
diff --git a/ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cros.cc b/ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cros.cc |
index 073514dd0a3a76e30f0208a7c421684cc89c4c2a..a1ac5cc2233e18f8fa5e0867177078a7a4d418d8 100644 |
--- a/ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cros.cc |
+++ b/ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cros.cc |
@@ -220,12 +220,11 @@ void GestureInterpreterLibevdevCros::OnGestureMove(const Gesture* gesture, |
cursor_->MoveCursor(gfx::Vector2dF(move->dx, move->dy)); |
// TODO(spang): Use move->ordinal_dx, move->ordinal_dy |
// TODO(spang): Use move->start_time, move->end_time |
- MouseEvent event(ET_MOUSE_MOVED, |
- cursor_->location(), |
- cursor_->location(), |
- modifiers_->GetModifierFlags(), |
- /* changed_button_flags */ 0); |
- Dispatch(&event); |
+ Dispatch(make_scoped_ptr(new MouseEvent(ET_MOUSE_MOVED, |
+ cursor_->location(), |
+ cursor_->location(), |
+ modifiers_->GetModifierFlags(), |
+ /* changed_button_flags */ 0))); |
} |
void GestureInterpreterLibevdevCros::OnGestureScroll( |
@@ -241,16 +240,15 @@ void GestureInterpreterLibevdevCros::OnGestureScroll( |
// TODO(spang): Support SetNaturalScroll |
// TODO(spang): Use scroll->start_time |
- ScrollEvent event(ET_SCROLL, |
- cursor_->location(), |
- StimeToTimedelta(gesture->end_time), |
- modifiers_->GetModifierFlags(), |
- scroll->dx, |
- scroll->dy, |
- scroll->ordinal_dx, |
- scroll->ordinal_dy, |
- kGestureScrollFingerCount); |
- Dispatch(&event); |
+ Dispatch(make_scoped_ptr(new ScrollEvent(ET_SCROLL, |
+ cursor_->location(), |
+ StimeToTimedelta(gesture->end_time), |
+ modifiers_->GetModifierFlags(), |
+ scroll->dx, |
+ scroll->dy, |
+ scroll->ordinal_dx, |
+ scroll->ordinal_dy, |
+ kGestureScrollFingerCount))); |
} |
void GestureInterpreterLibevdevCros::OnGestureButtonsChange( |
@@ -309,16 +307,15 @@ void GestureInterpreterLibevdevCros::OnGestureFling(const Gesture* gesture, |
: ET_SCROLL_FLING_CANCEL); |
// Fling is like 2-finger scrolling but with velocity instead of displacement. |
- ScrollEvent event(type, |
- cursor_->location(), |
- StimeToTimedelta(gesture->end_time), |
- modifiers_->GetModifierFlags(), |
- fling->vx, |
- fling->vy, |
- fling->ordinal_vx, |
- fling->ordinal_vy, |
- kGestureScrollFingerCount); |
- Dispatch(&event); |
+ Dispatch(make_scoped_ptr(new ScrollEvent(type, |
+ cursor_->location(), |
+ StimeToTimedelta(gesture->end_time), |
+ modifiers_->GetModifierFlags(), |
+ fling->vx, |
+ fling->vy, |
+ fling->ordinal_vx, |
+ fling->ordinal_vy, |
+ kGestureScrollFingerCount))); |
} |
void GestureInterpreterLibevdevCros::OnGestureSwipe(const Gesture* gesture, |
@@ -333,16 +330,15 @@ void GestureInterpreterLibevdevCros::OnGestureSwipe(const Gesture* gesture, |
return; // No cursor! |
// Swipe is 3-finger scrolling. |
- ScrollEvent event(ET_SCROLL, |
- cursor_->location(), |
- StimeToTimedelta(gesture->end_time), |
- modifiers_->GetModifierFlags(), |
- swipe->dx, |
- swipe->dy, |
- swipe->ordinal_dx, |
- swipe->ordinal_dy, |
- kGestureSwipeFingerCount); |
- Dispatch(&event); |
+ Dispatch(make_scoped_ptr(new ScrollEvent(ET_SCROLL, |
+ cursor_->location(), |
+ StimeToTimedelta(gesture->end_time), |
+ modifiers_->GetModifierFlags(), |
+ swipe->dx, |
+ swipe->dy, |
+ swipe->ordinal_dx, |
+ swipe->ordinal_dy, |
+ kGestureSwipeFingerCount))); |
} |
void GestureInterpreterLibevdevCros::OnGestureSwipeLift( |
@@ -356,17 +352,15 @@ void GestureInterpreterLibevdevCros::OnGestureSwipeLift( |
// Turn a swipe lift into a fling start. |
// TODO(spang): Figure out why and put it in this comment. |
- ScrollEvent event(ET_SCROLL_FLING_START, |
- cursor_->location(), |
- StimeToTimedelta(gesture->end_time), |
- modifiers_->GetModifierFlags(), |
- /* x_offset */ 0, |
- /* y_offset */ 0, |
- /* x_offset_ordinal */ 0, |
- /* y_offset_ordinal */ 0, |
- kGestureScrollFingerCount); |
- Dispatch(&event); |
- |
+ Dispatch(make_scoped_ptr(new ScrollEvent(ET_SCROLL_FLING_START, |
+ cursor_->location(), |
+ StimeToTimedelta(gesture->end_time), |
+ modifiers_->GetModifierFlags(), |
+ /* x_offset */ 0, |
+ /* y_offset */ 0, |
+ /* x_offset_ordinal */ 0, |
+ /* y_offset_ordinal */ 0, |
+ kGestureScrollFingerCount))); |
} |
void GestureInterpreterLibevdevCros::OnGesturePinch(const Gesture* gesture, |
@@ -390,8 +384,8 @@ void GestureInterpreterLibevdevCros::OnGestureMetrics( |
NOTIMPLEMENTED(); |
} |
-void GestureInterpreterLibevdevCros::Dispatch(Event* event) { |
- dispatch_callback_.Run(event); |
+void GestureInterpreterLibevdevCros::Dispatch(scoped_ptr<Event> event) { |
+ dispatch_callback_.Run(event.Pass()); |
} |
void GestureInterpreterLibevdevCros::DispatchMouseButton(unsigned int modifier, |
@@ -400,8 +394,8 @@ void GestureInterpreterLibevdevCros::DispatchMouseButton(unsigned int modifier, |
int flag = modifiers_->GetEventFlagFromModifier(modifier); |
EventType type = (down ? ET_MOUSE_PRESSED : ET_MOUSE_RELEASED); |
modifiers_->UpdateModifier(modifier, down); |
- MouseEvent event(type, loc, loc, modifiers_->GetModifierFlags() | flag, flag); |
- Dispatch(&event); |
+ Dispatch(make_scoped_ptr(new MouseEvent( |
+ type, loc, loc, modifiers_->GetModifierFlags() | flag, flag))); |
} |
void GestureInterpreterLibevdevCros::DispatchChangedKeys(Evdev* evdev, |