OLD | NEW |
---|---|
(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 #include "ui/events/gesture_detection/gesture_detector.h" | |
12 #include "ui/events/gesture_detection/gesture_provider.h" | |
jdduke (slow)
2014/10/23 20:17:00
You an remove the gesture_detector/provider/scale_
lanwei
2014/10/23 20:50:48
Done.
| |
13 #include "ui/events/gesture_detection/scale_gesture_detector.h" | |
14 | |
15 namespace ui { | |
16 | |
17 class GESTURE_DETECTION_EXPORT GestureConfiguration { | |
18 public: | |
19 virtual ~GestureConfiguration(); | |
20 | |
21 static GestureConfiguration* GetInstance(); | |
22 | |
23 // Ordered alphabetically ignoring underscores. | |
24 float default_radius() { return default_radius_; } | |
25 void set_default_radius(float radius) { | |
26 default_radius_ = radius; | |
27 min_scaling_touch_major_ = default_radius_ * 2; | |
28 min_gesture_bounds_length_ = default_radius_; | |
29 } | |
30 int double_tap_timeout_in_ms() { return double_tap_timeout_in_ms_; } | |
31 int fling_max_cancel_to_down_time_in_ms() { | |
32 return fling_max_cancel_to_down_time_in_ms_; | |
33 } | |
34 void set_fling_max_cancel_to_down_time_in_ms(int val) { | |
35 fling_max_cancel_to_down_time_in_ms_ = val; | |
36 } | |
37 int fling_max_tap_gap_time_in_ms() { return fling_max_tap_gap_time_in_ms_; } | |
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() { | |
42 return gesture_begin_end_types_enabled_; | |
43 } | |
44 int long_press_time_in_ms() { 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() { | |
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() { | |
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() { return max_fling_velocity_; } | |
59 void set_max_fling_velocity(float val) { max_fling_velocity_ = val; } | |
60 float max_gesture_bounds_length() { return max_gesture_bounds_length_; } | |
61 float max_separation_for_gesture_touches_in_pixels() { | |
62 return max_separation_for_gesture_touches_in_pixels_; | |
63 } | |
64 void set_max_separation_for_gesture_touches_in_pixels(float val) { | |
65 max_separation_for_gesture_touches_in_pixels_ = val; | |
66 } | |
67 float max_swipe_deviation_angle() { return max_swipe_deviation_angle_; } | |
68 int max_time_between_double_click_in_ms() { | |
69 return max_time_between_double_click_in_ms_; | |
70 } | |
71 void set_max_time_between_double_click_in_ms(int val) { | |
72 max_time_between_double_click_in_ms_ = val; | |
73 } | |
74 int max_touch_down_duration_for_click_in_ms() { | |
75 return max_touch_down_duration_for_click_in_ms_; | |
76 } | |
77 void set_max_touch_down_duration_for_click_in_ms(int val) { | |
78 max_touch_down_duration_for_click_in_ms_ = val; | |
79 } | |
80 float max_touch_move_in_pixels_for_click() { | |
81 return max_touch_move_in_pixels_for_click_; | |
82 } | |
83 void set_max_touch_move_in_pixels_for_click(float val) { | |
84 max_touch_move_in_pixels_for_click_ = val; | |
85 span_slop_ = max_touch_move_in_pixels_for_click_ * 2; | |
86 } | |
87 float min_distance_for_pinch_scroll_in_pixels() { | |
88 return min_distance_for_pinch_scroll_in_pixels_; | |
89 } | |
90 void set_min_distance_for_pinch_scroll_in_pixels(float val) { | |
91 min_distance_for_pinch_scroll_in_pixels_ = val; | |
92 } | |
93 float min_fling_velocity() { return min_fling_velocity_; } | |
94 float min_gesture_bounds_length() { return min_gesture_bounds_length_; } | |
95 float min_pinch_update_span_delta() { return min_pinch_update_span_delta_; } | |
96 void set_min_pinch_update_span_delta(float val) { | |
97 min_pinch_update_span_delta_ = val; | |
98 } | |
99 float min_scaling_span_in_pixels() { return min_scaling_span_in_pixels_; } | |
100 float min_scaling_touch_major() { return min_scaling_touch_major_; } | |
101 float min_swipe_velocity() { return min_swipe_velocity_; } | |
102 void set_min_swipe_velocity(float val) { min_swipe_velocity_ = val; } | |
103 int scroll_debounce_interval_in_ms() { | |
104 return scroll_debounce_interval_in_ms_; | |
105 } | |
106 int set_scroll_debounce_interval_in_ms(int val) { | |
107 return scroll_debounce_interval_in_ms_ = val; | |
108 } | |
109 int semi_long_press_time_in_ms() { return semi_long_press_time_in_ms_; } | |
110 void set_semi_long_press_time_in_ms(int val) { | |
111 semi_long_press_time_in_ms_ = val; | |
112 double_tap_timeout_in_ms_ = val; | |
113 } | |
114 int show_press_delay_in_ms() { return show_press_delay_in_ms_; } | |
115 int set_show_press_delay_in_ms(int val) { | |
116 return show_press_delay_in_ms_ = val; | |
117 } | |
118 float span_slop() { return span_slop_; } | |
119 bool swipe_enabled() { return swipe_enabled_; } | |
120 | |
121 // TODO(davemoore): Move into chrome/browser/ui. | |
122 int tab_scrub_activation_delay_in_ms() { | |
123 return tab_scrub_activation_delay_in_ms_; | |
124 } | |
125 void set_tab_scrub_activation_delay_in_ms(int val) { | |
126 tab_scrub_activation_delay_in_ms_ = val; | |
127 } | |
128 bool two_finger_tap_enabled() { return two_finger_tap_enabled_; } | |
129 | |
130 protected: | |
131 GestureConfiguration(); | |
132 GestureDetector::Config DefaultGestureDetectorConfig(); | |
jdduke (slow)
2014/10/23 20:17:00
You can remove these declarations.
lanwei
2014/10/23 20:50:48
Done.
| |
133 ScaleGestureDetector::Config DefaultScaleGestureDetectorConfig(); | |
134 void set_double_tap_timeout_in_ms(int val) { | |
135 double_tap_timeout_in_ms_ = val; | |
136 } | |
137 void set_gesture_begin_end_types_enabled(bool val) { | |
138 gesture_begin_end_types_enabled_ = val; | |
139 } | |
140 void set_max_gesture_bounds_length(float val) { | |
141 max_gesture_bounds_length_ = val; | |
142 } | |
143 void set_max_swipe_deviation_angle(float val) { | |
144 max_swipe_deviation_angle_ = val; | |
145 } | |
146 void set_min_fling_velocity(float val) { min_fling_velocity_ = val; } | |
147 void set_min_gesture_bounds_length(float val) { | |
148 min_gesture_bounds_length_ = val; | |
149 } | |
150 void set_min_scaling_span_in_pixels(float val) { | |
151 min_scaling_span_in_pixels_ = val; | |
152 } | |
153 void set_min_scaling_touch_major(float val) { | |
154 min_scaling_touch_major_ = val; | |
155 } | |
156 void set_span_slop(float val) { span_slop_ = val; } | |
157 void set_swipe_enabled(bool val) { swipe_enabled_ = val; } | |
158 void set_two_finger_tap_enabled(bool val) { two_finger_tap_enabled_ = val; } | |
159 | |
160 private: | |
161 // These are listed in alphabetical order ignoring underscores. | |
162 | |
163 // The default touch radius length used when the only information given | |
164 // by the device is the touch center. | |
165 float default_radius_; | |
166 int double_tap_timeout_in_ms_; | |
167 // Maximum time between a GestureFlingCancel and a mousedown such that the | |
168 // mousedown is considered associated with the cancel event. | |
169 int fling_max_cancel_to_down_time_in_ms_; | |
170 | |
171 // Maxium time between a mousedown/mouseup pair that is considered to be a | |
172 // suppressable tap. | |
173 int fling_max_tap_gap_time_in_ms_; | |
174 bool gesture_begin_end_types_enabled_; | |
175 int long_press_time_in_ms_; | |
176 float max_distance_between_taps_for_double_tap_; | |
177 | |
178 // The maximum allowed distance between two fingers for a two finger tap. If | |
179 // the distance between two fingers is greater than this value, we will not | |
180 // recognize a two finger tap. | |
181 float max_distance_for_two_finger_tap_in_pixels_; | |
182 float max_fling_velocity_; | |
183 float max_gesture_bounds_length_; | |
184 float max_separation_for_gesture_touches_in_pixels_; | |
185 float max_swipe_deviation_angle_; | |
186 int max_time_between_double_click_in_ms_; | |
187 int max_touch_down_duration_for_click_in_ms_; | |
188 float max_touch_move_in_pixels_for_click_; | |
189 float min_distance_for_pinch_scroll_in_pixels_; | |
190 float min_fling_velocity_; | |
191 float min_gesture_bounds_length_; | |
192 // Only used with --compensate-for-unstable-pinch-zoom. | |
193 float min_pinch_update_span_delta_; | |
194 float min_scaling_span_in_pixels_; | |
195 float min_scaling_touch_major_; | |
196 float min_swipe_velocity_; | |
197 int scroll_debounce_interval_in_ms_; | |
198 int semi_long_press_time_in_ms_; | |
199 int show_press_delay_in_ms_; | |
200 float span_slop_; | |
201 bool swipe_enabled_; | |
202 | |
203 // TODO(davemoore): Move into chrome/browser/ui. | |
204 int tab_scrub_activation_delay_in_ms_; | |
205 bool two_finger_tap_enabled_; | |
206 | |
207 friend struct DefaultSingletonTraits<GestureConfiguration>; | |
208 DISALLOW_COPY_AND_ASSIGN(GestureConfiguration); | |
209 }; | |
210 | |
211 } // namespace ui | |
212 | |
213 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_CONFIGURATION_H_ | |
OLD | NEW |