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 int default_radius() {
22 return default_radius_;
24 static void set_default_radius(int radius) { default_radius_ = radius; }
25 static int fling_max_cancel_to_down_time_in_ms() {
26 return fling_max_cancel_to_down_time_in_ms_;
28 static void set_fling_max_cancel_to_down_time_in_ms(int val) {
29 fling_max_cancel_to_down_time_in_ms_ = val;
31 static int fling_max_tap_gap_time_in_ms() {
32 return fling_max_tap_gap_time_in_ms_;
34 static void set_fling_max_tap_gap_time_in_ms(int val) {
35 fling_max_tap_gap_time_in_ms_ = val;
37 static double long_press_time_in_seconds() {
38 return long_press_time_in_seconds_;
40 static double semi_long_press_time_in_seconds() {
41 return semi_long_press_time_in_seconds_;
43 static double max_distance_for_two_finger_tap_in_pixels() {
44 return max_distance_for_two_finger_tap_in_pixels_;
46 static void set_max_distance_for_two_finger_tap_in_pixels(double val) {
47 max_distance_for_two_finger_tap_in_pixels_ = val;
49 static void set_long_press_time_in_seconds(double val) {
50 long_press_time_in_seconds_ = val;
52 static void set_semi_long_press_time_in_seconds(double val) {
53 semi_long_press_time_in_seconds_ = val;
55 static double max_seconds_between_double_click() {
56 return max_seconds_between_double_click_;
58 static void set_max_seconds_between_double_click(double val) {
59 max_seconds_between_double_click_ = val;
61 static int max_separation_for_gesture_touches_in_pixels() {
62 return max_separation_for_gesture_touches_in_pixels_;
64 static void set_max_separation_for_gesture_touches_in_pixels(int val) {
65 max_separation_for_gesture_touches_in_pixels_ = val;
67 static float max_swipe_deviation_angle() {
68 return max_swipe_deviation_angle_;
70 static void set_max_swipe_deviation_angle(float val) {
71 max_swipe_deviation_angle_ = val;
73 static double max_touch_down_duration_in_seconds_for_click() {
74 return max_touch_down_duration_in_seconds_for_click_;
76 static void set_max_touch_down_duration_in_seconds_for_click(double val) {
77 max_touch_down_duration_in_seconds_for_click_ = val;
79 static double max_touch_move_in_pixels_for_click() {
80 return max_touch_move_in_pixels_for_click_;
82 static void set_max_touch_move_in_pixels_for_click(double val) {
83 max_touch_move_in_pixels_for_click_ = val;
85 static double max_distance_between_taps_for_double_tap() {
86 return max_distance_between_taps_for_double_tap_;
88 static void set_max_distance_between_taps_for_double_tap(double val) {
89 max_distance_between_taps_for_double_tap_ = val;
91 static double min_distance_for_pinch_scroll_in_pixels() {
92 return min_distance_for_pinch_scroll_in_pixels_;
94 static void set_min_distance_for_pinch_scroll_in_pixels(double val) {
95 min_distance_for_pinch_scroll_in_pixels_ = val;
97 static double min_pinch_update_distance_in_pixels() {
98 return min_pinch_update_distance_in_pixels_;
100 static void set_min_pinch_update_distance_in_pixels(double val) {
101 min_pinch_update_distance_in_pixels_ = val;
103 static float min_scroll_velocity() {
104 return min_scroll_velocity_;
106 static void set_min_scroll_velocity(float val) {
107 min_scroll_velocity_ = val;
109 static double min_swipe_speed() {
110 return min_swipe_speed_;
112 static void set_min_swipe_speed(double val) {
113 min_swipe_speed_ = val;
115 static int min_scaling_span_in_pixels() {
116 return min_scaling_span_in_pixels_;
118 static void set_min_scaling_span_in_pixels(int val) {
119 min_scaling_span_in_pixels_ = val;
121 static int show_press_delay_in_ms() {
122 return show_press_delay_in_ms_;
124 static int set_show_press_delay_in_ms(int val) {
125 return show_press_delay_in_ms_ = val;
127 static int scroll_debounce_interval_in_ms() {
128 return scroll_debounce_interval_in_ms_;
130 static int set_scroll_debounce_interval_in_ms(int val) {
131 return scroll_debounce_interval_in_ms_ = val;
133 static float fling_velocity_cap() {
134 return fling_velocity_cap_;
136 static void set_fling_velocity_cap(float val) {
137 fling_velocity_cap_ = val;
139 // TODO(davemoore): Move into chrome/browser/ui.
140 static int tab_scrub_activation_delay_in_ms() {
141 return tab_scrub_activation_delay_in_ms_;
143 static void set_tab_scrub_activation_delay_in_ms(int val) {
144 tab_scrub_activation_delay_in_ms_ = val;
148 // These are listed in alphabetical order ignoring underscores, to
149 // align with the associated list of preferences in
150 // gesture_prefs_aura.cc. These two lists should be kept in sync.
152 // The default touch radius length used when the only information given
153 // by the device is the touch center.
154 static int default_radius_;
156 // 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
158 // recognize a two finger tap.
159 static double max_distance_for_two_finger_tap_in_pixels_;
161 // Maximum time between a GestureFlingCancel and a mousedown such that the
162 // mousedown is considered associated with the cancel event.
163 static int fling_max_cancel_to_down_time_in_ms_;
165 // Maxium time between a mousedown/mouseup pair that is considered to be a
167 static int fling_max_tap_gap_time_in_ms_;
169 static double long_press_time_in_seconds_;
170 static double semi_long_press_time_in_seconds_;
171 static double max_seconds_between_double_click_;
172 static double max_separation_for_gesture_touches_in_pixels_;
173 static float max_swipe_deviation_angle_;
174 static double max_touch_down_duration_in_seconds_for_click_;
175 static double max_touch_move_in_pixels_for_click_;
176 static double max_distance_between_taps_for_double_tap_;
177 static double min_distance_for_pinch_scroll_in_pixels_;
178 // Only used with --compensate-for-unstable-pinch-zoom.
179 static double min_pinch_update_distance_in_pixels_;
180 static float min_scroll_velocity_;
181 static double min_swipe_speed_;
182 static int min_scaling_span_in_pixels_;
183 static int show_press_delay_in_ms_;
184 static int scroll_debounce_interval_in_ms_;
185 static float fling_velocity_cap_;
186 // TODO(davemoore): Move into chrome/browser/ui.
187 static int tab_scrub_activation_delay_in_ms_;
189 DISALLOW_COPY_AND_ASSIGN(GestureConfiguration);
194 #endif // UI_EVENTS_GESTURES_GESTURE_CONFIGURATION_H_