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 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 | 555 |
556 GestureEvent* GestureSequence::CreateGestureEvent( | 556 GestureEvent* GestureSequence::CreateGestureEvent( |
557 const GestureEventDetails& details, | 557 const GestureEventDetails& details, |
558 const gfx::Point& location, | 558 const gfx::Point& location, |
559 int flags, | 559 int flags, |
560 base::Time timestamp, | 560 base::Time timestamp, |
561 unsigned int touch_id_bitmask) { | 561 unsigned int touch_id_bitmask) { |
562 GestureEventDetails gesture_details(details); | 562 GestureEventDetails gesture_details(details); |
563 gesture_details.set_touch_points(point_count_); | 563 gesture_details.set_touch_points(point_count_); |
564 gesture_details.set_bounding_box(bounding_box_); | 564 gesture_details.set_bounding_box(bounding_box_); |
565 return helper_->CreateGestureEvent(gesture_details, location, flags, | 565 return new GestureEvent(gesture_details.type(), location.x(), location.y(), |
566 timestamp, touch_id_bitmask); | 566 flags, base::TimeDelta::FromMilliseconds(timestamp.ToDoubleT() * 1000), |
| 567 gesture_details, touch_id_bitmask); |
567 } | 568 } |
568 | 569 |
569 void GestureSequence::AppendTapDownGestureEvent(const GesturePoint& point, | 570 void GestureSequence::AppendTapDownGestureEvent(const GesturePoint& point, |
570 Gestures* gestures) { | 571 Gestures* gestures) { |
571 gestures->push_back(CreateGestureEvent( | 572 gestures->push_back(CreateGestureEvent( |
572 GestureEventDetails(ui::ET_GESTURE_TAP_DOWN, 0, 0), | 573 GestureEventDetails(ui::ET_GESTURE_TAP_DOWN, 0, 0), |
573 point.first_touch_position(), | 574 point.first_touch_position(), |
574 flags_, | 575 flags_, |
575 base::Time::FromDoubleT(point.last_touch_time()), | 576 base::Time::FromDoubleT(point.last_touch_time()), |
576 1 << point.touch_id())); | 577 1 << point.touch_id())); |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 return; | 1028 return; |
1028 | 1029 |
1029 // Since long press timer has been started, there should be a non-NULL point. | 1030 // Since long press timer has been started, there should be a non-NULL point. |
1030 const GesturePoint* point = GetPointByPointId(0); | 1031 const GesturePoint* point = GetPointByPointId(0); |
1031 if (!ui::gestures::IsInsideManhattanSquare(point->first_touch_position(), | 1032 if (!ui::gestures::IsInsideManhattanSquare(point->first_touch_position(), |
1032 event.location())) | 1033 event.location())) |
1033 long_press_timer_->Stop(); | 1034 long_press_timer_->Stop(); |
1034 } | 1035 } |
1035 | 1036 |
1036 } // namespace ui | 1037 } // namespace ui |
OLD | NEW |