summaryrefslogtreecommitdiff
path: root/src/activity_replay.cc
diff options
context:
space:
mode:
authorAndrew de los Reyes <adlr@chromium.org>2012-11-21 14:23:34 -0800
committerGerrit <chrome-bot@google.com>2012-11-27 16:56:29 -0800
commitff56e1aa378e2b1221a19feb0b9d2dd185e9b719 (patch)
tree3648483a870c343778ea854f3724999f805e9f4d /src/activity_replay.cc
parent5194a2d7ace5d4cf16a7b887a289b4f3cecbc3f1 (diff)
downloadlibchrome-gestures-ff56e1aa378e2b1221a19feb0b9d2dd185e9b719.tar.gz
Swipe: Add dy for vertical 3f swipe
This CL adds a dy parameter to the swipe gesture representing 3f movement up or down. It also updates activity log/replay to store/load swipe's dy to/from log files. BUG=chromium-os:31745 TEST=Dave Moore tested 3f swipe and is happy with it. Regression test link/simple_3f_swipe Change-Id: I2aab3f5af96f59195201d6ad1ae383f5013ed6a9 Reviewed-on: https://gerrit.chromium.org/gerrit/38504 Commit-Ready: Andrew de los Reyes <adlr@chromium.org> Reviewed-by: Andrew de los Reyes <adlr@chromium.org> Tested-by: Andrew de los Reyes <adlr@chromium.org>
Diffstat (limited to 'src/activity_replay.cc')
-rw-r--r--src/activity_replay.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/activity_replay.cc b/src/activity_replay.cc
index f897054..322a097 100644
--- a/src/activity_replay.cc
+++ b/src/activity_replay.cc
@@ -340,6 +340,9 @@ bool ActivityReplay::ParseGesture(DictionaryValue* entry) {
} else if (gesture_type == ActivityLog::kValueGestureTypeScroll) {
if (!ParseGestureScroll(entry, &gs))
return false;
+ } else if (gesture_type == ActivityLog::kValueGestureTypeSwipe) {
+ if (!ParseGestureSwipe(entry, &gs))
+ return false;
} else if (gesture_type == ActivityLog::kValueGestureTypePinch) {
if (!ParseGesturePinch(entry, &gs))
return false;
@@ -389,6 +392,23 @@ bool ActivityReplay::ParseGestureScroll(DictionaryValue* entry,
return true;
}
+bool ActivityReplay::ParseGestureSwipe(DictionaryValue* entry,
+ Gesture* out_gs) {
+ out_gs->type = kGestureTypeSwipe;
+ double dbl;
+ if (!entry->GetDouble(ActivityLog::kKeyGestureSwipeDX, &dbl)) {
+ Err("can't parse swipe dx");
+ return false;
+ }
+ out_gs->details.swipe.dx = dbl;
+ if (!entry->GetDouble(ActivityLog::kKeyGestureSwipeDY, &dbl)) {
+ Err("can't parse swipe dy");
+ return false;
+ }
+ out_gs->details.swipe.dy = dbl;
+ return true;
+}
+
bool ActivityReplay::ParseGesturePinch(DictionaryValue* entry,
Gesture* out_gs) {
out_gs->type = kGestureTypePinch;