OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
sky
2014/10/27 14:47:43
2014 and no (c).
lanwei
2014/10/27 16:20:17
Done.
| |
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 // Create an instance of GestureConfiguration's subclass, depending on | |
sky
2014/10/27 14:47:43
Your comment here is confusing. This doesn't alway
lanwei
2014/10/27 16:20:17
Done.
| |
17 // which gesture_configuration_?.cc file is used. For one platform there | |
18 // is only one subclass file is included in the source code. | |
19 static GestureConfiguration* GetInstance(); | |
20 | |
21 // Ordered alphabetically ignoring underscores. | |
22 float default_radius() const { return default_radius_; } | |
23 void set_default_radius(float radius) { | |
24 default_radius_ = radius; | |
25 min_scaling_touch_major_ = default_radius_ * 2; | |
26 min_gesture_bounds_length_ = default_radius_; | |
27 } | |
28 int double_tap_timeout_in_ms() const { return double_tap_timeout_in_ms_; } | |
29 int fling_max_cancel_to_down_time_in_ms() const { | |
30 return fling_max_cancel_to_down_time_in_ms_; | |
31 } | |
32 void set_fling_max_cancel_to_down_time_in_ms(int val) { | |
33 fling_max_cancel_to_down_time_in_ms_ = val; | |
34 } | |
35 int fling_max_tap_gap_time_in_ms() const { | |
36 return fling_max_tap_gap_time_in_ms_; | |
37 } | |
38 void set_fling_max_tap_gap_time_in_ms(int val) { | |
39 fling_max_tap_gap_time_in_ms_ = val; | |
40 } | |
41 bool gesture_begin_end_types_enabled() const { | |
42 return gesture_begin_end_types_enabled_; | |
43 } | |
44 int long_press_time_in_ms() const { return long_press_time_in_ms_; } | |
45 void set_long_press_time_in_ms(int val) { long_press_time_in_ms_ = val; } | |
46 float max_distance_between_taps_for_double_tap() const { | |
47 return max_distance_between_taps_for_double_tap_; | |
48 } | |
49 void set_max_distance_between_taps_for_double_tap(float val) { | |
50 max_distance_between_taps_for_double_tap_ = val; | |
51 } | |
52 float max_distance_for_two_finger_tap_in_pixels() const { | |
53 return max_distance_for_two_finger_tap_in_pixels_; | |
54 } | |
55 void set_max_distance_for_two_finger_tap_in_pixels(float val) { | |
56 max_distance_for_two_finger_tap_in_pixels_ = val; | |
57 } | |
58 float max_fling_velocity() const { return max_fling_velocity_; } | |
59 void set_max_fling_velocity(float val) { max_fling_velocity_ = val; } | |
60 float max_gesture_bounds_length() const { | |
61 return max_gesture_bounds_length_; | |
62 } | |
63 float max_separation_for_gesture_touches_in_pixels() const { | |
64 return max_separation_for_gesture_touches_in_pixels_; | |
65 } | |
66 void set_max_separation_for_gesture_touches_in_pixels(float val) { | |
67 max_separation_for_gesture_touches_in_pixels_ = val; | |
68 } | |
69 float max_swipe_deviation_angle() const { | |
70 return max_swipe_deviation_angle_; | |
71 } | |
72 int max_time_between_double_click_in_ms() const { | |
73 return max_time_between_double_click_in_ms_; | |
74 } | |
75 void set_max_time_between_double_click_in_ms(int val) { | |
76 max_time_between_double_click_in_ms_ = val; | |
77 } | |
78 int max_touch_down_duration_for_click_in_ms() const { | |
79 return max_touch_down_duration_for_click_in_ms_; | |
80 } | |
81 void set_max_touch_down_duration_for_click_in_ms(int val) { | |
82 max_touch_down_duration_for_click_in_ms_ = val; | |
83 } | |
84 float max_touch_move_in_pixels_for_click() const { | |
85 return max_touch_move_in_pixels_for_click_; | |
86 } | |
87 void set_max_touch_move_in_pixels_for_click(float val) { | |
88 max_touch_move_in_pixels_for_click_ = val; | |
89 span_slop_ = max_touch_move_in_pixels_for_click_ * 2; | |
90 } | |
91 float min_distance_for_pinch_scroll_in_pixels() const { | |
92 return min_distance_for_pinch_scroll_in_pixels_; | |
93 } | |
94 void set_min_distance_for_pinch_scroll_in_pixels(float val) { | |
95 min_distance_for_pinch_scroll_in_pixels_ = val; | |
96 } | |
97 float min_fling_velocity() const { return min_fling_velocity_; } | |
98 float min_gesture_bounds_length() const { | |
99 return min_gesture_bounds_length_; | |
100 } | |
101 float min_pinch_update_span_delta() const { | |
102 return min_pinch_update_span_delta_; | |
103 } | |
104 void set_min_pinch_update_span_delta(float val) { | |
105 min_pinch_update_span_delta_ = val; | |
106 } | |
107 float min_scaling_span_in_pixels() const { | |
108 return min_scaling_span_in_pixels_; | |
109 } | |
110 float min_scaling_touch_major() const { return min_scaling_touch_major_; } | |
111 float min_swipe_velocity() const { return min_swipe_velocity_; } | |
112 void set_min_swipe_velocity(float val) { min_swipe_velocity_ = val; } | |
113 int scroll_debounce_interval_in_ms() const { | |
114 return scroll_debounce_interval_in_ms_; | |
115 } | |
116 int set_scroll_debounce_interval_in_ms(int val) { | |
117 return scroll_debounce_interval_in_ms_ = val; | |
118 } | |
119 int semi_long_press_time_in_ms() const { | |
120 return semi_long_press_time_in_ms_; | |
121 } | |
122 void set_semi_long_press_time_in_ms(int val) { | |
123 semi_long_press_time_in_ms_ = val; | |
124 double_tap_timeout_in_ms_ = val; | |
125 } | |
126 int show_press_delay_in_ms() const { return show_press_delay_in_ms_; } | |
127 int set_show_press_delay_in_ms(int val) { | |
128 return show_press_delay_in_ms_ = val; | |
129 } | |
130 float span_slop() const { return span_slop_; } | |
131 bool swipe_enabled() const { return swipe_enabled_; } | |
132 | |
133 // TODO(davemoore): Move into chrome/browser/ui. | |
134 int tab_scrub_activation_delay_in_ms() const { | |
135 return tab_scrub_activation_delay_in_ms_; | |
136 } | |
137 void set_tab_scrub_activation_delay_in_ms(int val) { | |
138 tab_scrub_activation_delay_in_ms_ = val; | |
139 } | |
140 bool two_finger_tap_enabled() const { return two_finger_tap_enabled_; } | |
141 | |
142 protected: | |
143 GestureConfiguration(); | |
144 virtual ~GestureConfiguration(); | |
145 | |
146 void set_double_tap_timeout_in_ms(int val) { | |
147 double_tap_timeout_in_ms_ = val; | |
148 } | |
149 void set_gesture_begin_end_types_enabled(bool val) { | |
150 gesture_begin_end_types_enabled_ = val; | |
151 } | |
152 void set_max_gesture_bounds_length(float val) { | |
153 max_gesture_bounds_length_ = val; | |
154 } | |
155 void set_max_swipe_deviation_angle(float val) { | |
156 max_swipe_deviation_angle_ = val; | |
157 } | |
158 void set_min_fling_velocity(float val) { min_fling_velocity_ = val; } | |
159 void set_min_gesture_bounds_length(float val) { | |
160 min_gesture_bounds_length_ = val; | |
161 } | |
162 void set_min_scaling_span_in_pixels(float val) { | |
163 min_scaling_span_in_pixels_ = val; | |
164 } | |
165 void set_min_scaling_touch_major(float val) { | |
166 min_scaling_touch_major_ = val; | |
167 } | |
168 void set_span_slop(float val) { span_slop_ = val; } | |
169 void set_swipe_enabled(bool val) { swipe_enabled_ = val; } | |
170 void set_two_finger_tap_enabled(bool val) { two_finger_tap_enabled_ = val; } | |
171 | |
172 private: | |
173 // These are listed in alphabetical order ignoring underscores. | |
174 | |
175 // The default touch radius length used when the only information given | |
176 // by the device is the touch center. | |
177 float default_radius_; | |
178 int double_tap_timeout_in_ms_; | |
179 // Maximum time between a GestureFlingCancel and a mousedown such that the | |
180 // mousedown is considered associated with the cancel event. | |
181 int fling_max_cancel_to_down_time_in_ms_; | |
182 | |
183 // Maxium time between a mousedown/mouseup pair that is considered to be a | |
184 // suppressable tap. | |
185 int fling_max_tap_gap_time_in_ms_; | |
186 bool gesture_begin_end_types_enabled_; | |
187 int long_press_time_in_ms_; | |
188 float max_distance_between_taps_for_double_tap_; | |
189 | |
190 // The maximum allowed distance between two fingers for a two finger tap. If | |
191 // the distance between two fingers is greater than this value, we will not | |
192 // recognize a two finger tap. | |
193 float max_distance_for_two_finger_tap_in_pixels_; | |
194 float max_fling_velocity_; | |
195 float max_gesture_bounds_length_; | |
196 float max_separation_for_gesture_touches_in_pixels_; | |
197 float max_swipe_deviation_angle_; | |
198 int max_time_between_double_click_in_ms_; | |
199 int max_touch_down_duration_for_click_in_ms_; | |
200 float max_touch_move_in_pixels_for_click_; | |
201 float min_distance_for_pinch_scroll_in_pixels_; | |
202 float min_fling_velocity_; | |
203 float min_gesture_bounds_length_; | |
204 // Only used with --compensate-for-unstable-pinch-zoom. | |
205 float min_pinch_update_span_delta_; | |
206 float min_scaling_span_in_pixels_; | |
207 float min_scaling_touch_major_; | |
208 float min_swipe_velocity_; | |
209 int scroll_debounce_interval_in_ms_; | |
210 int semi_long_press_time_in_ms_; | |
211 int show_press_delay_in_ms_; | |
212 float span_slop_; | |
213 bool swipe_enabled_; | |
214 | |
215 // TODO(davemoore): Move into chrome/browser/ui. | |
216 int tab_scrub_activation_delay_in_ms_; | |
217 bool two_finger_tap_enabled_; | |
218 | |
219 friend struct DefaultSingletonTraits<GestureConfiguration>; | |
220 DISALLOW_COPY_AND_ASSIGN(GestureConfiguration); | |
221 }; | |
222 | |
223 } // namespace ui | |
224 | |
225 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_CONFIGURATION_H_ | |
OLD | NEW |