Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Side by Side Diff: ui/events/gesture_detection/gesture_event_data_packet.cc

Issue 680413006: Re-enable Eager Gesture Recognition on Aura (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address jdduke's comment. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/events/gesture_detection/gesture_event_data_packet.h" 5 #include "ui/events/gesture_detection/gesture_event_data_packet.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/events/gesture_detection/motion_event.h" 8 #include "ui/events/gesture_detection/motion_event.h"
9 9
10 namespace ui { 10 namespace ui {
(...skipping 14 matching lines...) Expand all
25 return GestureEventDataPacket::TOUCH_START; 25 return GestureEventDataPacket::TOUCH_START;
26 case ui::MotionEvent::ACTION_POINTER_UP: 26 case ui::MotionEvent::ACTION_POINTER_UP:
27 return GestureEventDataPacket::TOUCH_END; 27 return GestureEventDataPacket::TOUCH_END;
28 }; 28 };
29 NOTREACHED() << "Invalid ui::MotionEvent action: " << event.GetAction(); 29 NOTREACHED() << "Invalid ui::MotionEvent action: " << event.GetAction();
30 return GestureEventDataPacket::INVALID; 30 return GestureEventDataPacket::INVALID;
31 } 31 }
32 32
33 } // namespace 33 } // namespace
34 34
35 GestureEventDataPacket::GestureEventDataPacket()
36 : gesture_source_(UNDEFINED) {
37 }
38
39 GestureEventDataPacket::GestureEventDataPacket( 35 GestureEventDataPacket::GestureEventDataPacket(
40 base::TimeTicks timestamp, 36 base::TimeTicks timestamp,
41 GestureSource source, 37 GestureSource source,
42 const gfx::PointF& touch_location, 38 const gfx::PointF& touch_location,
43 const gfx::PointF& raw_touch_location) 39 const gfx::PointF& raw_touch_location)
44 : timestamp_(timestamp), 40 : timestamp_(timestamp),
45 touch_location_(touch_location), 41 touch_location_(touch_location),
46 raw_touch_location_(raw_touch_location), 42 raw_touch_location_(raw_touch_location),
47 gesture_source_(source) { 43 gesture_source_(source),
48 DCHECK_NE(gesture_source_, UNDEFINED); 44 ack_state_(AckState::PENDING) {
45 }
46
47 GestureEventDataPacket::GestureEventDataPacket()
jdduke (slow) 2014/11/25 20:26:36 I'm not sure this delegated constructor is any sim
tdresser 2014/11/26 15:17:18 I'm not either. Done.
48 : GestureEventDataPacket(base::TimeTicks(),
49 UNDEFINED,
50 gfx::PointF(),
51 gfx::PointF()) {
49 } 52 }
50 53
51 GestureEventDataPacket::GestureEventDataPacket( 54 GestureEventDataPacket::GestureEventDataPacket(
52 const GestureEventDataPacket& other) 55 const GestureEventDataPacket& other)
53 : timestamp_(other.timestamp_), 56 : GestureEventDataPacket(other.timestamp_,
54 gestures_(other.gestures_), 57 other.gesture_source_,
55 touch_location_(other.touch_location_), 58 other.touch_location_,
56 raw_touch_location_(other.raw_touch_location_), 59 other.raw_touch_location_) {
57 gesture_source_(other.gesture_source_) { 60 gestures_ = other.gestures_;
61 ack_state_ = other.ack_state_;
58 } 62 }
59 63
60 GestureEventDataPacket::~GestureEventDataPacket() { 64 GestureEventDataPacket::~GestureEventDataPacket() {
61 } 65 }
62 66
63 GestureEventDataPacket& GestureEventDataPacket::operator=( 67 GestureEventDataPacket& GestureEventDataPacket::operator=(
64 const GestureEventDataPacket& other) { 68 const GestureEventDataPacket& other) {
65 timestamp_ = other.timestamp_; 69 timestamp_ = other.timestamp_;
66 gesture_source_ = other.gesture_source_; 70 gesture_source_ = other.gesture_source_;
67 touch_location_ = other.touch_location_; 71 touch_location_ = other.touch_location_;
68 raw_touch_location_ = other.raw_touch_location_; 72 raw_touch_location_ = other.raw_touch_location_;
69 gestures_ = other.gestures_; 73 gestures_ = other.gestures_;
jdduke (slow) 2014/11/25 20:26:37 ack_state_ = other.ack_state_;
tdresser 2014/11/26 15:17:18 Done.
70 return *this; 74 return *this;
71 } 75 }
72 76
73 void GestureEventDataPacket::Push(const GestureEventData& gesture) { 77 void GestureEventDataPacket::Push(const GestureEventData& gesture) {
74 DCHECK_NE(ET_UNKNOWN, gesture.type()); 78 DCHECK_NE(ET_UNKNOWN, gesture.type());
75 gestures_->push_back(gesture); 79 gestures_->push_back(gesture);
76 } 80 }
77 81
78 GestureEventDataPacket GestureEventDataPacket::FromTouch( 82 GestureEventDataPacket GestureEventDataPacket::FromTouch(
79 const ui::MotionEvent& touch) { 83 const ui::MotionEvent& touch) {
80 return GestureEventDataPacket(touch.GetEventTime(), 84 return GestureEventDataPacket(touch.GetEventTime(),
81 ToGestureSource(touch), 85 ToGestureSource(touch),
82 gfx::PointF(touch.GetX(), touch.GetY()), 86 gfx::PointF(touch.GetX(), touch.GetY()),
83 gfx::PointF(touch.GetRawX(), touch.GetRawY())); 87 gfx::PointF(touch.GetRawX(), touch.GetRawY()));
84 } 88 }
85 89
86 GestureEventDataPacket GestureEventDataPacket::FromTouchTimeout( 90 GestureEventDataPacket GestureEventDataPacket::FromTouchTimeout(
87 const GestureEventData& gesture) { 91 const GestureEventData& gesture) {
88 GestureEventDataPacket packet(gesture.time, 92 GestureEventDataPacket packet(gesture.time,
89 TOUCH_TIMEOUT, 93 TOUCH_TIMEOUT,
90 gfx::PointF(gesture.x, gesture.y), 94 gfx::PointF(gesture.x, gesture.y),
91 gfx::PointF(gesture.raw_x, gesture.raw_y)); 95 gfx::PointF(gesture.raw_x, gesture.raw_y));
92 packet.Push(gesture); 96 packet.Push(gesture);
93 return packet; 97 return packet;
94 } 98 }
95 99
96 } // namespace ui 100 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698