OLD | NEW |
---|---|
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 #ifndef UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DETAILS_H_ | 5 #ifndef UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DETAILS_H_ |
6 #define UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DETAILS_H_ | 6 #define UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DETAILS_H_ |
7 | 7 |
8 #include <string.h> | |
9 | |
8 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "ipc/ipc_message_utils.h" | |
9 #include "ui/events/event_constants.h" | 12 #include "ui/events/event_constants.h" |
10 #include "ui/events/events_base_export.h" | 13 #include "ui/events/events_base_export.h" |
11 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
12 #include "ui/gfx/geometry/rect_conversions.h" | 15 #include "ui/gfx/geometry/rect_conversions.h" |
13 | 16 |
14 namespace ui { | 17 namespace ui { |
15 | 18 |
16 struct EVENTS_BASE_EXPORT GestureEventDetails { | 19 struct EVENTS_BASE_EXPORT GestureEventDetails { |
17 public: | 20 public: |
18 GestureEventDetails(); | 21 GestureEventDetails(); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 bool right; | 178 bool right; |
176 bool up; | 179 bool up; |
177 bool down; | 180 bool down; |
178 } swipe; | 181 } swipe; |
179 | 182 |
180 // Tap information must be set for ET_GESTURE_TAP, | 183 // Tap information must be set for ET_GESTURE_TAP, |
181 // ET_GESTURE_TAP_UNCONFIRMED, and ET_GESTURE_DOUBLE_TAP events. | 184 // ET_GESTURE_TAP_UNCONFIRMED, and ET_GESTURE_DOUBLE_TAP events. |
182 int tap_count; // TAP repeat count. | 185 int tap_count; // TAP repeat count. |
183 } data_; | 186 } data_; |
184 | 187 |
188 // For mojo native implementation of (de)serialization. | |
189 friend struct IPC::ParamTraits<ui::GestureEventDetails>; | |
190 friend struct IPC::ParamTraits<ui::GestureEventDetails::Details>; | |
191 | |
185 int touch_points_; // Number of active touch points in the gesture. | 192 int touch_points_; // Number of active touch points in the gesture. |
186 | 193 |
187 // Bounding box is an axis-aligned rectangle that contains all the | 194 // Bounding box is an axis-aligned rectangle that contains all the |
188 // enclosing rectangles of the touch-points in the gesture. | 195 // enclosing rectangles of the touch-points in the gesture. |
189 gfx::RectF bounding_box_; | 196 gfx::RectF bounding_box_; |
197 | |
198 public: | |
199 // Supports comparison over internal structures for testing. | |
200 bool operator==(const GestureEventDetails& other) const { | |
Ken Rockot(use gerrit already)
2016/02/17 22:05:21
Maybe it would be better to expose something like
Mark Dittmer
2016/02/18 14:51:05
Could do. There are two reasons I prefer implement
| |
201 return type_ == other.type_ && | |
202 !memcmp(&data_, &other.data_, sizeof(Details)) && | |
203 touch_points_ == other.touch_points_ && | |
204 bounding_box_ == other.bounding_box_; | |
205 } | |
190 }; | 206 }; |
191 | 207 |
192 } // namespace ui | 208 } // namespace ui |
193 | 209 |
194 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DETAILS_H_ | 210 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DETAILS_H_ |
OLD | NEW |