OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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_GESTURES_GESTURE_CONFIGURATION_H_ | 5 #ifndef UI_EVENTS_GESTURES_GESTURE_CONFIGURATION_H_ |
6 #define UI_EVENTS_GESTURES_GESTURE_CONFIGURATION_H_ | 6 #define UI_EVENTS_GESTURES_GESTURE_CONFIGURATION_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "ui/events/events_base_export.h" | 9 #include "ui/events/events_base_export.h" |
10 | 10 |
11 namespace ui { | 11 namespace ui { |
12 | 12 |
13 // TODO: Expand this design to support multiple OS configuration | 13 // TODO: Expand this design to support multiple OS configuration |
14 // approaches (windows, chrome, others). This would turn into an | 14 // approaches (windows, chrome, others). This would turn into an |
15 // abstract base class. | 15 // abstract base class. |
16 | 16 |
17 class EVENTS_BASE_EXPORT GestureConfiguration { | 17 class EVENTS_BASE_EXPORT GestureConfiguration { |
18 public: | 18 public: |
19 // Ordered alphabetically ignoring underscores, to align with the | 19 // Ordered alphabetically ignoring underscores, to align with the |
20 // associated list of prefs in gesture_prefs_aura.cc. | 20 // associated list of prefs in gesture_prefs_aura.cc. |
21 static int default_radius() { | 21 static float default_radius() { |
22 return default_radius_; | 22 return default_radius_; |
23 } | 23 } |
24 static void set_default_radius(int radius) { default_radius_ = radius; } | 24 static void set_default_radius(float radius) { |
| 25 default_radius_ = radius; |
| 26 } |
25 static int fling_max_cancel_to_down_time_in_ms() { | 27 static int fling_max_cancel_to_down_time_in_ms() { |
26 return fling_max_cancel_to_down_time_in_ms_; | 28 return fling_max_cancel_to_down_time_in_ms_; |
27 } | 29 } |
28 static void set_fling_max_cancel_to_down_time_in_ms(int val) { | 30 static void set_fling_max_cancel_to_down_time_in_ms(int val) { |
29 fling_max_cancel_to_down_time_in_ms_ = val; | 31 fling_max_cancel_to_down_time_in_ms_ = val; |
30 } | 32 } |
31 static int fling_max_tap_gap_time_in_ms() { | 33 static int fling_max_tap_gap_time_in_ms() { |
32 return fling_max_tap_gap_time_in_ms_; | 34 return fling_max_tap_gap_time_in_ms_; |
33 } | 35 } |
34 static void set_fling_max_tap_gap_time_in_ms(int val) { | 36 static void set_fling_max_tap_gap_time_in_ms(int val) { |
35 fling_max_tap_gap_time_in_ms_ = val; | 37 fling_max_tap_gap_time_in_ms_ = val; |
36 } | 38 } |
37 static double long_press_time_in_seconds() { | 39 static int long_press_time_in_ms() { |
38 return long_press_time_in_seconds_; | 40 return long_press_time_in_ms_; |
39 } | 41 } |
40 static double semi_long_press_time_in_seconds() { | 42 static int semi_long_press_time_in_ms() { |
41 return semi_long_press_time_in_seconds_; | 43 return semi_long_press_time_in_ms_; |
42 } | 44 } |
43 static double max_distance_for_two_finger_tap_in_pixels() { | 45 static float max_distance_for_two_finger_tap_in_pixels() { |
44 return max_distance_for_two_finger_tap_in_pixels_; | 46 return max_distance_for_two_finger_tap_in_pixels_; |
45 } | 47 } |
46 static void set_max_distance_for_two_finger_tap_in_pixels(double val) { | 48 static void set_max_distance_for_two_finger_tap_in_pixels(float val) { |
47 max_distance_for_two_finger_tap_in_pixels_ = val; | 49 max_distance_for_two_finger_tap_in_pixels_ = val; |
48 } | 50 } |
49 static void set_long_press_time_in_seconds(double val) { | 51 static void set_long_press_time_in_ms(int val) { |
50 long_press_time_in_seconds_ = val; | 52 long_press_time_in_ms_ = val; |
51 } | 53 } |
52 static void set_semi_long_press_time_in_seconds(double val) { | 54 static void set_semi_long_press_time_in_ms(int val) { |
53 semi_long_press_time_in_seconds_ = val; | 55 semi_long_press_time_in_ms_ = val; |
54 } | 56 } |
55 static double max_seconds_between_double_click() { | 57 static int max_time_between_double_click_in_ms() { |
56 return max_seconds_between_double_click_; | 58 return max_time_between_double_click_in_ms_; |
57 } | 59 } |
58 static void set_max_seconds_between_double_click(double val) { | 60 static void set_max_time_between_double_click_in_ms(int val) { |
59 max_seconds_between_double_click_ = val; | 61 max_time_between_double_click_in_ms_ = val; |
60 } | 62 } |
61 static int max_separation_for_gesture_touches_in_pixels() { | 63 static float max_separation_for_gesture_touches_in_pixels() { |
62 return max_separation_for_gesture_touches_in_pixels_; | 64 return max_separation_for_gesture_touches_in_pixels_; |
63 } | 65 } |
64 static void set_max_separation_for_gesture_touches_in_pixels(int val) { | 66 static void set_max_separation_for_gesture_touches_in_pixels(float val) { |
65 max_separation_for_gesture_touches_in_pixels_ = val; | 67 max_separation_for_gesture_touches_in_pixels_ = val; |
66 } | 68 } |
67 static float max_swipe_deviation_angle() { | 69 static float max_swipe_deviation_angle() { |
68 return max_swipe_deviation_angle_; | 70 return max_swipe_deviation_angle_; |
69 } | 71 } |
70 static void set_max_swipe_deviation_angle(float val) { | 72 static void set_max_swipe_deviation_angle(float val) { |
71 max_swipe_deviation_angle_ = val; | 73 max_swipe_deviation_angle_ = val; |
72 } | 74 } |
73 static double max_touch_down_duration_in_seconds_for_click() { | 75 static int max_touch_down_duration_for_click_in_ms() { |
74 return max_touch_down_duration_in_seconds_for_click_; | 76 return max_touch_down_duration_for_click_in_ms_; |
75 } | 77 } |
76 static void set_max_touch_down_duration_in_seconds_for_click(double val) { | 78 static void set_max_touch_down_duration_for_click_in_ms(int val) { |
77 max_touch_down_duration_in_seconds_for_click_ = val; | 79 max_touch_down_duration_for_click_in_ms_ = val; |
78 } | 80 } |
79 static double max_touch_move_in_pixels_for_click() { | 81 static float max_touch_move_in_pixels_for_click() { |
80 return max_touch_move_in_pixels_for_click_; | 82 return max_touch_move_in_pixels_for_click_; |
81 } | 83 } |
82 static void set_max_touch_move_in_pixels_for_click(double val) { | 84 static void set_max_touch_move_in_pixels_for_click(float val) { |
83 max_touch_move_in_pixels_for_click_ = val; | 85 max_touch_move_in_pixels_for_click_ = val; |
84 } | 86 } |
85 static double max_distance_between_taps_for_double_tap() { | 87 static float max_distance_between_taps_for_double_tap() { |
86 return max_distance_between_taps_for_double_tap_; | 88 return max_distance_between_taps_for_double_tap_; |
87 } | 89 } |
88 static void set_max_distance_between_taps_for_double_tap(double val) { | 90 static void set_max_distance_between_taps_for_double_tap(float val) { |
89 max_distance_between_taps_for_double_tap_ = val; | 91 max_distance_between_taps_for_double_tap_ = val; |
90 } | 92 } |
91 static double min_distance_for_pinch_scroll_in_pixels() { | 93 static float min_distance_for_pinch_scroll_in_pixels() { |
92 return min_distance_for_pinch_scroll_in_pixels_; | 94 return min_distance_for_pinch_scroll_in_pixels_; |
93 } | 95 } |
94 static void set_min_distance_for_pinch_scroll_in_pixels(double val) { | 96 static void set_min_distance_for_pinch_scroll_in_pixels(float val) { |
95 min_distance_for_pinch_scroll_in_pixels_ = val; | 97 min_distance_for_pinch_scroll_in_pixels_ = val; |
96 } | 98 } |
97 static double min_pinch_update_distance_in_pixels() { | 99 static float min_pinch_update_distance_in_pixels() { |
98 return min_pinch_update_distance_in_pixels_; | 100 return min_pinch_update_distance_in_pixels_; |
99 } | 101 } |
100 static void set_min_pinch_update_distance_in_pixels(double val) { | 102 static void set_min_pinch_update_distance_in_pixels(float val) { |
101 min_pinch_update_distance_in_pixels_ = val; | 103 min_pinch_update_distance_in_pixels_ = val; |
102 } | 104 } |
103 static float min_scroll_velocity() { | 105 static float min_scroll_velocity() { |
104 return min_scroll_velocity_; | 106 return min_scroll_velocity_; |
105 } | 107 } |
106 static void set_min_scroll_velocity(float val) { | 108 static void set_min_scroll_velocity(float val) { |
107 min_scroll_velocity_ = val; | 109 min_scroll_velocity_ = val; |
108 } | 110 } |
109 static double min_swipe_speed() { | 111 static float min_swipe_speed() { |
110 return min_swipe_speed_; | 112 return min_swipe_speed_; |
111 } | 113 } |
112 static void set_min_swipe_speed(double val) { | 114 static void set_min_swipe_speed(float val) { |
113 min_swipe_speed_ = val; | 115 min_swipe_speed_ = val; |
114 } | 116 } |
115 static int min_scaling_span_in_pixels() { | 117 static float min_scaling_span_in_pixels() { |
116 return min_scaling_span_in_pixels_; | 118 return min_scaling_span_in_pixels_; |
117 }; | 119 }; |
118 static void set_min_scaling_span_in_pixels(int val) { | 120 static void set_min_scaling_span_in_pixels(float val) { |
119 min_scaling_span_in_pixels_ = val; | 121 min_scaling_span_in_pixels_ = val; |
120 } | 122 } |
121 static int show_press_delay_in_ms() { | 123 static int show_press_delay_in_ms() { |
122 return show_press_delay_in_ms_; | 124 return show_press_delay_in_ms_; |
123 } | 125 } |
124 static int set_show_press_delay_in_ms(int val) { | 126 static int set_show_press_delay_in_ms(int val) { |
125 return show_press_delay_in_ms_ = val; | 127 return show_press_delay_in_ms_ = val; |
126 } | 128 } |
127 static int scroll_debounce_interval_in_ms() { | 129 static int scroll_debounce_interval_in_ms() { |
128 return scroll_debounce_interval_in_ms_; | 130 return scroll_debounce_interval_in_ms_; |
(...skipping 15 matching lines...) Expand all Loading... |
144 tab_scrub_activation_delay_in_ms_ = val; | 146 tab_scrub_activation_delay_in_ms_ = val; |
145 } | 147 } |
146 | 148 |
147 private: | 149 private: |
148 // These are listed in alphabetical order ignoring underscores, to | 150 // These are listed in alphabetical order ignoring underscores, to |
149 // align with the associated list of preferences in | 151 // align with the associated list of preferences in |
150 // gesture_prefs_aura.cc. These two lists should be kept in sync. | 152 // gesture_prefs_aura.cc. These two lists should be kept in sync. |
151 | 153 |
152 // The default touch radius length used when the only information given | 154 // The default touch radius length used when the only information given |
153 // by the device is the touch center. | 155 // by the device is the touch center. |
154 static int default_radius_; | 156 static float default_radius_; |
155 | 157 |
156 // The maximum allowed distance between two fingers for a two finger tap. If | 158 // The maximum allowed distance between two fingers for a two finger tap. If |
157 // the distance between two fingers is greater than this value, we will not | 159 // the distance between two fingers is greater than this value, we will not |
158 // recognize a two finger tap. | 160 // recognize a two finger tap. |
159 static double max_distance_for_two_finger_tap_in_pixels_; | 161 static float max_distance_for_two_finger_tap_in_pixels_; |
160 | 162 |
161 // Maximum time between a GestureFlingCancel and a mousedown such that the | 163 // Maximum time between a GestureFlingCancel and a mousedown such that the |
162 // mousedown is considered associated with the cancel event. | 164 // mousedown is considered associated with the cancel event. |
163 static int fling_max_cancel_to_down_time_in_ms_; | 165 static int fling_max_cancel_to_down_time_in_ms_; |
164 | 166 |
165 // Maxium time between a mousedown/mouseup pair that is considered to be a | 167 // Maxium time between a mousedown/mouseup pair that is considered to be a |
166 // suppressable tap. | 168 // suppressable tap. |
167 static int fling_max_tap_gap_time_in_ms_; | 169 static int fling_max_tap_gap_time_in_ms_; |
168 | 170 |
169 static double long_press_time_in_seconds_; | 171 static int long_press_time_in_ms_; |
170 static double semi_long_press_time_in_seconds_; | 172 static int semi_long_press_time_in_ms_; |
171 static double max_seconds_between_double_click_; | 173 static int max_time_between_double_click_in_ms_; |
172 static double max_separation_for_gesture_touches_in_pixels_; | 174 static float max_separation_for_gesture_touches_in_pixels_; |
173 static float max_swipe_deviation_angle_; | 175 static float max_swipe_deviation_angle_; |
174 static double max_touch_down_duration_in_seconds_for_click_; | 176 static int max_touch_down_duration_for_click_in_ms_; |
175 static double max_touch_move_in_pixels_for_click_; | 177 static float max_touch_move_in_pixels_for_click_; |
176 static double max_distance_between_taps_for_double_tap_; | 178 static float max_distance_between_taps_for_double_tap_; |
177 static double min_distance_for_pinch_scroll_in_pixels_; | 179 static float min_distance_for_pinch_scroll_in_pixels_; |
178 // Only used with --compensate-for-unstable-pinch-zoom. | 180 // Only used with --compensate-for-unstable-pinch-zoom. |
179 static double min_pinch_update_distance_in_pixels_; | 181 static float min_pinch_update_distance_in_pixels_; |
180 static float min_scroll_velocity_; | 182 static float min_scroll_velocity_; |
181 static double min_swipe_speed_; | 183 static float min_swipe_speed_; |
182 static int min_scaling_span_in_pixels_; | 184 static float min_scaling_span_in_pixels_; |
183 static int show_press_delay_in_ms_; | 185 static int show_press_delay_in_ms_; |
184 static int scroll_debounce_interval_in_ms_; | 186 static int scroll_debounce_interval_in_ms_; |
185 static float fling_velocity_cap_; | 187 static float fling_velocity_cap_; |
186 // TODO(davemoore): Move into chrome/browser/ui. | 188 // TODO(davemoore): Move into chrome/browser/ui. |
187 static int tab_scrub_activation_delay_in_ms_; | 189 static int tab_scrub_activation_delay_in_ms_; |
188 | 190 |
189 DISALLOW_COPY_AND_ASSIGN(GestureConfiguration); | 191 DISALLOW_COPY_AND_ASSIGN(GestureConfiguration); |
190 }; | 192 }; |
191 | 193 |
192 } // namespace ui | 194 } // namespace ui |
193 | 195 |
194 #endif // UI_EVENTS_GESTURES_GESTURE_CONFIGURATION_H_ | 196 #endif // UI_EVENTS_GESTURES_GESTURE_CONFIGURATION_H_ |
OLD | NEW |