OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/base/gestures/gesture_sequence.h" | 5 #include "ui/base/gestures/gesture_sequence.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 | 639 |
640 GestureEvent* GestureSequence::CreateGestureEvent( | 640 GestureEvent* GestureSequence::CreateGestureEvent( |
641 const GestureEventDetails& details, | 641 const GestureEventDetails& details, |
642 const gfx::Point& location, | 642 const gfx::Point& location, |
643 int flags, | 643 int flags, |
644 base::Time timestamp, | 644 base::Time timestamp, |
645 unsigned int touch_id_bitmask) { | 645 unsigned int touch_id_bitmask) { |
646 GestureEventDetails gesture_details(details); | 646 GestureEventDetails gesture_details(details); |
647 gesture_details.set_touch_points(point_count_); | 647 gesture_details.set_touch_points(point_count_); |
648 gesture_details.set_bounding_box(bounding_box_); | 648 gesture_details.set_bounding_box(bounding_box_); |
| 649 base::TimeDelta time_stamp = |
| 650 base::TimeDelta::FromMicroseconds(timestamp.ToDoubleT() * 1000000); |
649 return new GestureEvent(gesture_details.type(), location.x(), location.y(), | 651 return new GestureEvent(gesture_details.type(), location.x(), location.y(), |
650 flags, base::TimeDelta::FromMilliseconds(timestamp.ToDoubleT() * 1000), | 652 flags, time_stamp, gesture_details, |
651 gesture_details, touch_id_bitmask); | 653 touch_id_bitmask); |
652 } | 654 } |
653 | 655 |
654 void GestureSequence::AppendTapDownGestureEvent(const GesturePoint& point, | 656 void GestureSequence::AppendTapDownGestureEvent(const GesturePoint& point, |
655 Gestures* gestures) { | 657 Gestures* gestures) { |
656 gestures->push_back(CreateGestureEvent( | 658 gestures->push_back(CreateGestureEvent( |
657 GestureEventDetails(ui::ET_GESTURE_TAP_DOWN, 0, 0), | 659 GestureEventDetails(ui::ET_GESTURE_TAP_DOWN, 0, 0), |
658 point.first_touch_position(), | 660 point.first_touch_position(), |
659 flags_, | 661 flags_, |
660 base::Time::FromDoubleT(point.last_touch_time()), | 662 base::Time::FromDoubleT(point.last_touch_time()), |
661 1 << point.touch_id())); | 663 1 << point.touch_id())); |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 return; | 1139 return; |
1138 | 1140 |
1139 // Since long press timer has been started, there should be a non-NULL point. | 1141 // Since long press timer has been started, there should be a non-NULL point. |
1140 const GesturePoint* point = GetPointByPointId(0); | 1142 const GesturePoint* point = GetPointByPointId(0); |
1141 if (!ui::gestures::IsInsideManhattanSquare(point->first_touch_position(), | 1143 if (!ui::gestures::IsInsideManhattanSquare(point->first_touch_position(), |
1142 event.location())) | 1144 event.location())) |
1143 GetLongPressTimer()->Stop(); | 1145 GetLongPressTimer()->Stop(); |
1144 } | 1146 } |
1145 | 1147 |
1146 } // namespace ui | 1148 } // namespace ui |
OLD | NEW |