Status is added to pinch zoom gesture

Pinch zoom gesture must indicates if it is GESTURES_ZOOM_START,
GESTURES_ZOOM_UPDATE, or GESTURES_ZOOM_END. The status is added to
the struct, but still it does not have a full support in gesture
library. Right now, the status is always GESTURES_ZOOM_UPDATE.
This CL is submitted to unblock chromium:410580.

BUG=chromium:569939
TEST=Manually tested

Change-Id: Ia3ec68acfac80302fdb0db693842f11652174c40
Reviewed-on: https://chromium-review.googlesource.com/322471
Commit-Ready: Amirhossein Simjour <asimjour@chromium.org>
Tested-by: Amirhossein Simjour <asimjour@chromium.org>
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
diff --git a/include/gestures.h b/include/gestures.h
index 854cf8c..d79b6da 100644
--- a/include/gestures.h
+++ b/include/gestures.h
@@ -181,6 +181,10 @@
 #define GESTURES_FLING_START 0  // Scroll end/fling begin
 #define GESTURES_FLING_TAP_DOWN 1  // Finger touched down/fling end
 
+#define GESTURES_ZOOM_START 0  // Pinch zoom begin
+#define GESTURES_ZOOM_UPDATE 1  // Zoom-in/Zoom-out update
+#define GESTURES_ZOOM_END 2  // Pinch zoom end
+
 // Gesture sub-structs
 
 // Note about ordinal_* values: Sometimes, UI will want to use unaccelerated
@@ -232,6 +236,8 @@
   // >1.0 for inwards pinch
   float dz;
   float ordinal_dz;
+  // GESTURES_ZOOM_START, GESTURES_ZOOM_UPDATE, or GESTURES_ZOOM_END
+  unsigned zoom_state;
 } GesturePinch;
 
 // Metrics types that we care about
@@ -319,11 +325,12 @@
     details.swipe.ordinal_dy = details.swipe.dy = dy;
   }
   Gesture(const GesturePinch&,
-          stime_t start, stime_t end, float dz)
+          stime_t start, stime_t end, float dz, unsigned state)
       : start_time(start),
         end_time(end),
         type(kGestureTypePinch) {
     details.pinch.ordinal_dz = details.pinch.dz = dz;
+    details.pinch.zoom_state = state;
   }
   Gesture(const GestureSwipeLift&, stime_t start, stime_t end)
       : start_time(start),
diff --git a/src/gestures.cc b/src/gestures.cc
index 8006bde..7d2f638 100644
--- a/src/gestures.cc
+++ b/src/gestures.cc
@@ -625,5 +625,5 @@
 const GestureButtonsChange kGestureButtonsChange = { 0, 0 };
 const GestureFling kGestureFling = { 0, 0, 0, 0, 0 };
 const GestureSwipe kGestureSwipe = { 0, 0, 0, 0 };
-const GesturePinch kGesturePinch = { 0, 0 };
+const GesturePinch kGesturePinch = { 0, 0, 0 };
 const GestureMetrics kGestureMetrics = { kGestureMetricsTypeUnknown, {0, 0} };
diff --git a/src/immediate_interpreter.cc b/src/immediate_interpreter.cc
index fb9573f..2e27b82 100644
--- a/src/immediate_interpreter.cc
+++ b/src/immediate_interpreter.cc
@@ -2792,7 +2792,8 @@
     case kGestureTypePinch: {
       float current_dist = sqrtf(TwoFingerDistanceSq(hwstate));
       result_ = Gesture(kGesturePinch, changed_time_, hwstate.timestamp,
-                        current_dist / two_finger_start_distance_);
+                        current_dist / two_finger_start_distance_,
+                        GESTURES_ZOOM_UPDATE);
       break;
     }
     default: