Chromium Code Reviews| 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 b7cdb24bdd5fb685af84f3b4a29538ccdfb21286..9cb183b1aa4e4b36969062a0203b526f2cf8d40e 100644 |
| --- a/ui/events/gesture_detection/gesture_provider.cc |
| +++ b/ui/events/gesture_detection/gesture_provider.cc |
| @@ -27,23 +27,28 @@ namespace { |
| const float kDoubleTapDragZoomSpeed = 0.005f; |
| const char* GetMotionEventActionName(MotionEvent::Action action) { |
| + |
| +#define CASE_ACTION_TO_STRING(action) \ |
|
aelias_OOO_until_Jul13
2016/11/09 02:43:14
I'm not a big fan of clever macro magic unless the
mustaq
2016/11/09 17:04:33
Done.
|
| + case MotionEvent::action: \ |
| + return #action; |
| + |
| switch (action) { |
| - case MotionEvent::ACTION_NONE: |
| - return "ACTION_NONE"; |
| - case MotionEvent::ACTION_POINTER_DOWN: |
| - return "ACTION_POINTER_DOWN"; |
| - case MotionEvent::ACTION_POINTER_UP: |
| - return "ACTION_POINTER_UP"; |
| - case MotionEvent::ACTION_DOWN: |
| - return "ACTION_DOWN"; |
| - case MotionEvent::ACTION_UP: |
| - return "ACTION_UP"; |
| - case MotionEvent::ACTION_CANCEL: |
| - return "ACTION_CANCEL"; |
| - case MotionEvent::ACTION_MOVE: |
| - return "ACTION_MOVE"; |
| + CASE_ACTION_TO_STRING(ACTION_NONE); |
| + CASE_ACTION_TO_STRING(ACTION_POINTER_DOWN); |
| + CASE_ACTION_TO_STRING(ACTION_POINTER_UP); |
| + CASE_ACTION_TO_STRING(ACTION_DOWN); |
| + CASE_ACTION_TO_STRING(ACTION_UP); |
| + CASE_ACTION_TO_STRING(ACTION_CANCEL); |
| + CASE_ACTION_TO_STRING(ACTION_MOVE); |
| + CASE_ACTION_TO_STRING(ACTION_HOVER_ENTER); |
| + CASE_ACTION_TO_STRING(ACTION_HOVER_EXIT); |
| + CASE_ACTION_TO_STRING(ACTION_HOVER_MOVE); |
| + CASE_ACTION_TO_STRING(ACTION_BUTTON_PRESS); |
| + CASE_ACTION_TO_STRING(ACTION_BUTTON_RELEASE); |
| } |
| return ""; |
| + |
| +#undef CASE_ACTION_TO_STRING |
| } |
| gfx::RectF ClampBoundingBox(const gfx::RectF& bounds, |
| @@ -853,6 +858,11 @@ void GestureProvider::OnTouchEventHandlingBegin(const MotionEvent& event) { |
| case MotionEvent::ACTION_MOVE: |
| break; |
| case MotionEvent::ACTION_NONE: |
| + case MotionEvent::ACTION_HOVER_ENTER: |
| + case MotionEvent::ACTION_HOVER_EXIT: |
| + case MotionEvent::ACTION_HOVER_MOVE: |
| + case MotionEvent::ACTION_BUTTON_PRESS: |
| + case MotionEvent::ACTION_BUTTON_RELEASE: |
| NOTREACHED(); |
| break; |
| } |
| @@ -881,6 +891,11 @@ void GestureProvider::OnTouchEventHandlingEnd(const MotionEvent& event) { |
| case MotionEvent::ACTION_MOVE: |
| break; |
| case MotionEvent::ACTION_NONE: |
| + case MotionEvent::ACTION_HOVER_ENTER: |
| + case MotionEvent::ACTION_HOVER_EXIT: |
| + case MotionEvent::ACTION_HOVER_MOVE: |
| + case MotionEvent::ACTION_BUTTON_PRESS: |
| + case MotionEvent::ACTION_BUTTON_RELEASE: |
| NOTREACHED(); |
| break; |
| } |