summaryrefslogtreecommitdiffstats
path: root/ash/drag_drop
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-04 05:08:30 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-04 05:08:30 +0000
commite93b70ccbb53c6fec20427019b421a05a371114e (patch)
tree5e836b9d26f56a633f2ad0316cdf0ea1dd9fe98d /ash/drag_drop
parent1940c4ee397232a4948b0328e728024ea19e3f5f (diff)
downloadchromium_src-e93b70ccbb53c6fec20427019b421a05a371114e.zip
chromium_src-e93b70ccbb53c6fec20427019b421a05a371114e.tar.gz
chromium_src-e93b70ccbb53c6fec20427019b421a05a371114e.tar.bz2
events: Change gesture-event handler in EventHandler to not return any values.
The EventHandler overriddes should mark the event as having been processed (Event::SetHandled) when the event triggered an action, or stop the propagation of the event (Event::StopPropagation) as appropriate (when the handler destroyed the event-target, for example). BUG=163618 Review URL: https://codereview.chromium.org/11280290 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170890 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/drag_drop')
-rw-r--r--ash/drag_drop/drag_drop_controller.cc16
-rw-r--r--ash/drag_drop/drag_drop_controller.h2
-rw-r--r--ash/drag_drop/drag_drop_controller_unittest.cc4
3 files changed, 13 insertions, 9 deletions
diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc
index db0e213..cf6135e 100644
--- a/ash/drag_drop/drag_drop_controller.cc
+++ b/ash/drag_drop/drag_drop_controller.cc
@@ -332,14 +332,17 @@ ui::EventResult DragDropController::OnTouchEvent(ui::TouchEvent* event) {
return ui::ER_UNHANDLED;
}
-ui::EventResult DragDropController::OnGestureEvent(ui::GestureEvent* event) {
+void DragDropController::OnGestureEvent(ui::GestureEvent* event) {
if (!IsDragDropInProgress())
- return ui::ER_UNHANDLED;
+ return;
// If current drag session was not started by touch, dont process this touch
// event, but consume it so it does not interfere with current drag session.
- if (current_drag_event_source_ != ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH)
- return ui::ER_CONSUMED;
+ if (current_drag_event_source_ !=
+ ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) {
+ event->StopPropagation();
+ return;
+ }
// Apply kTouchDragImageVerticalOffset to the location.
ui::GestureEvent touch_offset_event(*event,
@@ -356,7 +359,8 @@ ui::EventResult DragDropController::OnGestureEvent(ui::GestureEvent* event) {
drag_drop_tracker_->GetTarget(touch_offset_event);
if (!translated_target) {
DragCancel();
- return ui::ER_HANDLED;
+ event->SetHandled();
+ return;
}
scoped_ptr<ui::LocatedEvent> translated_event(
drag_drop_tracker_->ConvertEvent(translated_target, touch_offset_event));
@@ -384,7 +388,7 @@ ui::EventResult DragDropController::OnGestureEvent(ui::GestureEvent* event) {
default:
break;
}
- return ui::ER_HANDLED;
+ event->SetHandled();
}
void DragDropController::OnWindowDestroyed(aura::Window* window) {
diff --git a/ash/drag_drop/drag_drop_controller.h b/ash/drag_drop/drag_drop_controller.h
index f38b522..6fe58a1 100644
--- a/ash/drag_drop/drag_drop_controller.h
+++ b/ash/drag_drop/drag_drop_controller.h
@@ -68,7 +68,7 @@ class ASH_EXPORT DragDropController
virtual ui::EventResult OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
- virtual ui::EventResult OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
+ virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
// Overridden from aura::WindowObserver.
virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE;
diff --git a/ash/drag_drop/drag_drop_controller_unittest.cc b/ash/drag_drop/drag_drop_controller_unittest.cc
index 5847fdc..14a25c6 100644
--- a/ash/drag_drop/drag_drop_controller_unittest.cc
+++ b/ash/drag_drop/drag_drop_controller_unittest.cc
@@ -85,10 +85,10 @@ class DragTestView : public views::View {
return true;
}
- ui::EventResult OnGestureEvent(ui::GestureEvent* event) OVERRIDE {
+ void OnGestureEvent(ui::GestureEvent* event) OVERRIDE {
if (event->type() == ui::ET_GESTURE_LONG_TAP)
long_tap_received_ = true;
- return ui::ER_UNHANDLED;
+ return;
}
bool GetDropFormats(int* formats,