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.
5 #ifndef UI_EVENTS_GESTURES_GESTURE_CONFIGURATION_H_
6 #define UI_EVENTS_GESTURES_GESTURE_CONFIGURATION_H_
8 #include "base/basictypes.h"
9 #include "ui/events/events_base_export.h"
13 // TODO: Expand this design to support multiple OS configuration
14 // approaches (windows, chrome, others). This would turn into an
15 // abstract base class.
17 class EVENTS_BASE_EXPORT GestureConfiguration
{
19 // Ordered alphabetically ignoring underscores, to align with the
20 // associated list of prefs in gesture_prefs_aura.cc.
21 static float default_radius() {
22 return default_radius_
;
24 static void set_default_radius(float radius
) {
25 default_radius_
= radius
;
27 static int fling_max_cancel_to_down_time_in_ms() {
28 return fling_max_cancel_to_down_time_in_ms_
;
30 static void set_fling_max_cancel_to_down_time_in_ms(int val
) {
31 fling_max_cancel_to_down_time_in_ms_
= val
;
33 static int fling_max_tap_gap_time_in_ms() {
34 return fling_max_tap_gap_time_in_ms_
;
36 static void set_fling_max_tap_gap_time_in_ms(int val
) {
37 fling_max_tap_gap_time_in_ms_
= val
;
39 static int long_press_time_in_ms() {
40 return long_press_time_in_ms_
;
42 static int semi_long_press_time_in_ms() {
43 return semi_long_press_time_in_ms_
;
45 static float max_distance_for_two_finger_tap_in_pixels() {
46 return max_distance_for_two_finger_tap_in_pixels_
;
48 static void set_max_distance_for_two_finger_tap_in_pixels(float val
) {
49 max_distance_for_two_finger_tap_in_pixels_
= val
;
51 static void set_long_press_time_in_ms(int val
) {
52 long_press_time_in_ms_
= val
;
54 static void set_semi_long_press_time_in_ms(int val
) {
55 semi_long_press_time_in_ms_
= val
;
57 static int max_time_between_double_click_in_ms() {
58 return max_time_between_double_click_in_ms_
;
60 static void set_max_time_between_double_click_in_ms(int val
) {
61 max_time_between_double_click_in_ms_
= val
;
63 static float max_separation_for_gesture_touches_in_pixels() {
64 return max_separation_for_gesture_touches_in_pixels_
;
66 static void set_max_separation_for_gesture_touches_in_pixels(float val
) {
67 max_separation_for_gesture_touches_in_pixels_
= val
;
69 static float max_swipe_deviation_angle() {
70 return max_swipe_deviation_angle_
;
72 static void set_max_swipe_deviation_angle(float val
) {
73 max_swipe_deviation_angle_
= val
;
75 static int max_touch_down_duration_for_click_in_ms() {
76 return max_touch_down_duration_for_click_in_ms_
;
78 static void set_max_touch_down_duration_for_click_in_ms(int val
) {
79 max_touch_down_duration_for_click_in_ms_
= val
;
81 static float max_touch_move_in_pixels_for_click() {
82 return max_touch_move_in_pixels_for_click_
;
84 static void set_max_touch_move_in_pixels_for_click(float val
) {
85 max_touch_move_in_pixels_for_click_
= val
;
87 static float max_distance_between_taps_for_double_tap() {
88 return max_distance_between_taps_for_double_tap_
;
90 static void set_max_distance_between_taps_for_double_tap(float val
) {
91 max_distance_between_taps_for_double_tap_
= val
;
93 static float min_distance_for_pinch_scroll_in_pixels() {
94 return min_distance_for_pinch_scroll_in_pixels_
;
96 static void set_min_distance_for_pinch_scroll_in_pixels(float val
) {
97 min_distance_for_pinch_scroll_in_pixels_
= val
;
99 static float min_pinch_update_distance_in_pixels() {
100 return min_pinch_update_distance_in_pixels_
;
102 static void set_min_pinch_update_distance_in_pixels(float val
) {
103 min_pinch_update_distance_in_pixels_
= val
;
105 static float min_scroll_velocity() {
106 return min_scroll_velocity_
;
108 static void set_min_scroll_velocity(float val
) {
109 min_scroll_velocity_
= val
;
111 static float min_swipe_speed() {
112 return min_swipe_speed_
;
114 static void set_min_swipe_speed(float val
) {
115 min_swipe_speed_
= val
;
117 static float min_scaling_span_in_pixels() {
118 return min_scaling_span_in_pixels_
;
120 static void set_min_scaling_span_in_pixels(float val
) {
121 min_scaling_span_in_pixels_
= val
;
123 static int show_press_delay_in_ms() {
124 return show_press_delay_in_ms_
;
126 static int set_show_press_delay_in_ms(int val
) {
127 return show_press_delay_in_ms_
= val
;
129 static int scroll_debounce_interval_in_ms() {
130 return scroll_debounce_interval_in_ms_
;
132 static int set_scroll_debounce_interval_in_ms(int val
) {
133 return scroll_debounce_interval_in_ms_
= val
;
135 static float fling_velocity_cap() {
136 return fling_velocity_cap_
;
138 static void set_fling_velocity_cap(float val
) {
139 fling_velocity_cap_
= val
;
141 // TODO(davemoore): Move into chrome/browser/ui.
142 static int tab_scrub_activation_delay_in_ms() {
143 return tab_scrub_activation_delay_in_ms_
;
145 static void set_tab_scrub_activation_delay_in_ms(int val
) {
146 tab_scrub_activation_delay_in_ms_
= val
;
150 // These are listed in alphabetical order ignoring underscores, to
151 // align with the associated list of preferences in
152 // gesture_prefs_aura.cc. These two lists should be kept in sync.
154 // The default touch radius length used when the only information given
155 // by the device is the touch center.
156 static float default_radius_
;
158 // The maximum allowed distance between two fingers for a two finger tap. If
159 // the distance between two fingers is greater than this value, we will not
160 // recognize a two finger tap.
161 static float max_distance_for_two_finger_tap_in_pixels_
;
163 // Maximum time between a GestureFlingCancel and a mousedown such that the
164 // mousedown is considered associated with the cancel event.
165 static int fling_max_cancel_to_down_time_in_ms_
;
167 // Maxium time between a mousedown/mouseup pair that is considered to be a
169 static int fling_max_tap_gap_time_in_ms_
;
171 static int long_press_time_in_ms_
;
172 static int semi_long_press_time_in_ms_
;
173 static int max_time_between_double_click_in_ms_
;
174 static float max_separation_for_gesture_touches_in_pixels_
;
175 static float max_swipe_deviation_angle_
;
176 static int max_touch_down_duration_for_click_in_ms_
;
177 static float max_touch_move_in_pixels_for_click_
;
178 static float max_distance_between_taps_for_double_tap_
;
179 static float min_distance_for_pinch_scroll_in_pixels_
;
180 // Only used with --compensate-for-unstable-pinch-zoom.
181 static float min_pinch_update_distance_in_pixels_
;
182 static float min_scroll_velocity_
;
183 static float min_swipe_speed_
;
184 static float min_scaling_span_in_pixels_
;
185 static int show_press_delay_in_ms_
;
186 static int scroll_debounce_interval_in_ms_
;
187 static float fling_velocity_cap_
;
188 // TODO(davemoore): Move into chrome/browser/ui.
189 static int tab_scrub_activation_delay_in_ms_
;
191 DISALLOW_COPY_AND_ASSIGN(GestureConfiguration
);
196 #endif // UI_EVENTS_GESTURES_GESTURE_CONFIGURATION_H_