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

Side by Side Diff: ui/events/gesture_event_details.h

Issue 572593002: Revert of Clean up GestureEventDetails constructors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months 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 #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 "base/logging.h" 8 #include "base/logging.h"
9 #include "ui/events/event_constants.h" 9 #include "ui/events/event_constants.h"
10 #include "ui/events/events_base_export.h" 10 #include "ui/events/events_base_export.h"
11 #include "ui/gfx/rect.h" 11 #include "ui/gfx/rect.h"
12 #include "ui/gfx/rect_conversions.h" 12 #include "ui/gfx/rect_conversions.h"
13 13
14 namespace ui { 14 namespace ui {
15 15
16 struct EVENTS_BASE_EXPORT GestureEventDetails { 16 struct EVENTS_BASE_EXPORT GestureEventDetails {
17 public: 17 public:
18 GestureEventDetails(); 18 GestureEventDetails();
19 explicit GestureEventDetails(EventType type);
20 GestureEventDetails(EventType type, float delta_x, float delta_y); 19 GestureEventDetails(EventType type, float delta_x, float delta_y);
21 20
22 EventType type() const { return type_; } 21 EventType type() const { return type_; }
23 22
24 int touch_points() const { return touch_points_; } 23 int touch_points() const { return touch_points_; }
25 void set_touch_points(int touch_points) { 24 void set_touch_points(int touch_points) {
26 DCHECK_GT(touch_points, 0); 25 DCHECK_GT(touch_points, 0);
27 touch_points_ = touch_points; 26 touch_points_ = touch_points;
28 } 27 }
29 28
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 } 116 }
118 117
119 void set_tap_count(int tap_count) { 118 void set_tap_count(int tap_count) {
120 DCHECK_GE(tap_count, 0); 119 DCHECK_GE(tap_count, 0);
121 DCHECK(type_ == ET_GESTURE_TAP || 120 DCHECK(type_ == ET_GESTURE_TAP ||
122 type_ == ET_GESTURE_TAP_UNCONFIRMED || 121 type_ == ET_GESTURE_TAP_UNCONFIRMED ||
123 type_ == ET_GESTURE_DOUBLE_TAP); 122 type_ == ET_GESTURE_DOUBLE_TAP);
124 data.tap_count = tap_count; 123 data.tap_count = tap_count;
125 } 124 }
126 125
127 void set_scale(float scale) {
128 DCHECK_GE(scale, 0.0f);
129 DCHECK_EQ(type_, ET_GESTURE_PINCH_UPDATE);
130 data.scale = scale;
131 }
132
133 private: 126 private:
134 EventType type_; 127 EventType type_;
135 union Details { 128 union Details {
136 Details(); 129 Details();
137 struct { // SCROLL start details. 130 struct { // SCROLL start details.
138 // Distance that caused the scroll to start. Generally redundant with 131 // Distance that caused the scroll to start. Generally redundant with
139 // the x/y values from the first scroll_update. 132 // the x/y values from the first scroll_update.
140 float x_hint; 133 float x_hint;
141 float y_hint; 134 float y_hint;
142 } scroll_begin; 135 } scroll_begin;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // enclosing rectangles of the touch-points in the gesture. 171 // enclosing rectangles of the touch-points in the gesture.
179 gfx::RectF bounding_box_; 172 gfx::RectF bounding_box_;
180 173
181 // The touch id of the oldest touch contributing to the gesture. 174 // The touch id of the oldest touch contributing to the gesture.
182 int oldest_touch_id_; 175 int oldest_touch_id_;
183 }; 176 };
184 177
185 } // namespace ui 178 } // namespace ui
186 179
187 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DETAILS_H_ 180 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DETAILS_H_
OLDNEW
« no previous file with comments | « ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc ('k') | ui/events/gesture_event_details.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698