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

Side by Side Diff: ui/events/gesture_detection/gesture_configuration.h

Issue 613373004: Adopt ui::GestureConfiguration on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_EVENTS_GESTURE_DETECTION_GESTURE_CONFIGURATION_H_
6 #define UI_EVENTS_GESTURE_DETECTION_GESTURE_CONFIGURATION_H_
7
8 #include "base/basictypes.h"
9 #include "base/memory/singleton.h"
10 #include "ui/events/gesture_detection/gesture_detection_export.h"
11
12 namespace ui {
13
14 class GESTURE_DETECTION_EXPORT GestureConfiguration {
15 public:
16 virtual ~GestureConfiguration();
17
18 static GestureConfiguration* GetInstance();
19
20 // Ordered alphabetically ignoring underscores.
21 float default_radius() { return default_radius_; }
22 void set_default_radius(float radius) {
23 default_radius_ = radius;
24 min_scaling_touch_major_ = default_radius_ * 2;
25 min_gesture_bounds_length_ = default_radius_;
26 }
27 int double_tap_timeout_in_ms() { return double_tap_timeout_in_ms_; }
28 int fling_max_cancel_to_down_time_in_ms() {
29 return fling_max_cancel_to_down_time_in_ms_;
30 }
31 void set_fling_max_cancel_to_down_time_in_ms(int val) {
32 fling_max_cancel_to_down_time_in_ms_ = val;
33 }
34 int fling_max_tap_gap_time_in_ms() { return fling_max_tap_gap_time_in_ms_; }
35 void set_fling_max_tap_gap_time_in_ms(int val) {
36 fling_max_tap_gap_time_in_ms_ = val;
37 }
38 bool gesture_begin_end_types_enabled() {
39 return gesture_begin_end_types_enabled_;
40 }
41 int long_press_time_in_ms() { return long_press_time_in_ms_; }
42 void set_long_press_time_in_ms(int val) { long_press_time_in_ms_ = val; }
43 float max_distance_between_taps_for_double_tap() {
44 return max_distance_between_taps_for_double_tap_;
45 }
46 void set_max_distance_between_taps_for_double_tap(float val) {
47 max_distance_between_taps_for_double_tap_ = val;
48 }
49 float max_distance_for_two_finger_tap_in_pixels() {
jdduke (slow) 2014/10/24 15:50:00 Nit: All of the methods that return a value should
lanwei 2014/10/27 14:00:34 Done.
50 return max_distance_for_two_finger_tap_in_pixels_;
51 }
52 void set_max_distance_for_two_finger_tap_in_pixels(float val) {
53 max_distance_for_two_finger_tap_in_pixels_ = val;
54 }
55 float max_fling_velocity() { return max_fling_velocity_; }
56 void set_max_fling_velocity(float val) { max_fling_velocity_ = val; }
57 float max_gesture_bounds_length() { return max_gesture_bounds_length_; }
58 float max_separation_for_gesture_touches_in_pixels() {
59 return max_separation_for_gesture_touches_in_pixels_;
60 }
61 void set_max_separation_for_gesture_touches_in_pixels(float val) {
62 max_separation_for_gesture_touches_in_pixels_ = val;
63 }
64 float max_swipe_deviation_angle() { return max_swipe_deviation_angle_; }
65 int max_time_between_double_click_in_ms() {
66 return max_time_between_double_click_in_ms_;
67 }
68 void set_max_time_between_double_click_in_ms(int val) {
69 max_time_between_double_click_in_ms_ = val;
70 }
71 int max_touch_down_duration_for_click_in_ms() {
72 return max_touch_down_duration_for_click_in_ms_;
73 }
74 void set_max_touch_down_duration_for_click_in_ms(int val) {
75 max_touch_down_duration_for_click_in_ms_ = val;
76 }
77 float max_touch_move_in_pixels_for_click() {
78 return max_touch_move_in_pixels_for_click_;
79 }
80 void set_max_touch_move_in_pixels_for_click(float val) {
81 max_touch_move_in_pixels_for_click_ = val;
82 span_slop_ = max_touch_move_in_pixels_for_click_ * 2;
83 }
84 float min_distance_for_pinch_scroll_in_pixels() {
85 return min_distance_for_pinch_scroll_in_pixels_;
86 }
87 void set_min_distance_for_pinch_scroll_in_pixels(float val) {
88 min_distance_for_pinch_scroll_in_pixels_ = val;
89 }
90 float min_fling_velocity() { return min_fling_velocity_; }
91 float min_gesture_bounds_length() { return min_gesture_bounds_length_; }
92 float min_pinch_update_span_delta() { return min_pinch_update_span_delta_; }
93 void set_min_pinch_update_span_delta(float val) {
94 min_pinch_update_span_delta_ = val;
95 }
96 float min_scaling_span_in_pixels() { return min_scaling_span_in_pixels_; }
97 float min_scaling_touch_major() { return min_scaling_touch_major_; }
98 float min_swipe_velocity() { return min_swipe_velocity_; }
99 void set_min_swipe_velocity(float val) { min_swipe_velocity_ = val; }
100 int scroll_debounce_interval_in_ms() {
101 return scroll_debounce_interval_in_ms_;
102 }
103 int set_scroll_debounce_interval_in_ms(int val) {
104 return scroll_debounce_interval_in_ms_ = val;
105 }
106 int semi_long_press_time_in_ms() { return semi_long_press_time_in_ms_; }
107 void set_semi_long_press_time_in_ms(int val) {
108 semi_long_press_time_in_ms_ = val;
109 double_tap_timeout_in_ms_ = val;
110 }
111 int show_press_delay_in_ms() { return show_press_delay_in_ms_; }
112 int set_show_press_delay_in_ms(int val) {
113 return show_press_delay_in_ms_ = val;
114 }
115 float span_slop() { return span_slop_; }
116 bool swipe_enabled() { return swipe_enabled_; }
117
118 // TODO(davemoore): Move into chrome/browser/ui.
119 int tab_scrub_activation_delay_in_ms() {
120 return tab_scrub_activation_delay_in_ms_;
121 }
122 void set_tab_scrub_activation_delay_in_ms(int val) {
123 tab_scrub_activation_delay_in_ms_ = val;
124 }
125 bool two_finger_tap_enabled() { return two_finger_tap_enabled_; }
126
127 protected:
128 GestureConfiguration();
129 void set_double_tap_timeout_in_ms(int val) {
130 double_tap_timeout_in_ms_ = val;
131 }
132 void set_gesture_begin_end_types_enabled(bool val) {
133 gesture_begin_end_types_enabled_ = val;
134 }
135 void set_max_gesture_bounds_length(float val) {
136 max_gesture_bounds_length_ = val;
137 }
138 void set_max_swipe_deviation_angle(float val) {
139 max_swipe_deviation_angle_ = val;
140 }
141 void set_min_fling_velocity(float val) { min_fling_velocity_ = val; }
142 void set_min_gesture_bounds_length(float val) {
143 min_gesture_bounds_length_ = val;
144 }
145 void set_min_scaling_span_in_pixels(float val) {
146 min_scaling_span_in_pixels_ = val;
147 }
148 void set_min_scaling_touch_major(float val) {
149 min_scaling_touch_major_ = val;
150 }
151 void set_span_slop(float val) { span_slop_ = val; }
152 void set_swipe_enabled(bool val) { swipe_enabled_ = val; }
153 void set_two_finger_tap_enabled(bool val) { two_finger_tap_enabled_ = val; }
154
155 private:
156 // These are listed in alphabetical order ignoring underscores.
157
158 // The default touch radius length used when the only information given
159 // by the device is the touch center.
160 float default_radius_;
161 int double_tap_timeout_in_ms_;
162 // Maximum time between a GestureFlingCancel and a mousedown such that the
163 // mousedown is considered associated with the cancel event.
164 int fling_max_cancel_to_down_time_in_ms_;
165
166 // Maxium time between a mousedown/mouseup pair that is considered to be a
167 // suppressable tap.
168 int fling_max_tap_gap_time_in_ms_;
169 bool gesture_begin_end_types_enabled_;
170 int long_press_time_in_ms_;
171 float max_distance_between_taps_for_double_tap_;
172
173 // The maximum allowed distance between two fingers for a two finger tap. If
174 // the distance between two fingers is greater than this value, we will not
175 // recognize a two finger tap.
176 float max_distance_for_two_finger_tap_in_pixels_;
177 float max_fling_velocity_;
178 float max_gesture_bounds_length_;
179 float max_separation_for_gesture_touches_in_pixels_;
180 float max_swipe_deviation_angle_;
181 int max_time_between_double_click_in_ms_;
182 int max_touch_down_duration_for_click_in_ms_;
183 float max_touch_move_in_pixels_for_click_;
184 float min_distance_for_pinch_scroll_in_pixels_;
185 float min_fling_velocity_;
186 float min_gesture_bounds_length_;
187 // Only used with --compensate-for-unstable-pinch-zoom.
188 float min_pinch_update_span_delta_;
189 float min_scaling_span_in_pixels_;
190 float min_scaling_touch_major_;
191 float min_swipe_velocity_;
192 int scroll_debounce_interval_in_ms_;
193 int semi_long_press_time_in_ms_;
194 int show_press_delay_in_ms_;
195 float span_slop_;
196 bool swipe_enabled_;
197
198 // TODO(davemoore): Move into chrome/browser/ui.
199 int tab_scrub_activation_delay_in_ms_;
200 bool two_finger_tap_enabled_;
201
202 friend struct DefaultSingletonTraits<GestureConfiguration>;
203 DISALLOW_COPY_AND_ASSIGN(GestureConfiguration);
204 };
205
206 } // namespace ui
207
208 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_CONFIGURATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698