Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2257)

Side by Side Diff: ui/events/gesture_detection/gesture_configuration.h

Issue 1287103004: Sync ui/events to chromium @ https://codereview.chromium.org/1210203002 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 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 "ui/events/gesture_detection/gesture_detection_export.h"
10 #include "ui/events/gesture_detection/velocity_tracker.h"
11
12 namespace ui {
13
14 class GESTURE_DETECTION_EXPORT GestureConfiguration {
15 public:
16 // Sets the shared instance. This does not take ownership of |config|.
17 static void SetInstance(GestureConfiguration* config);
18 // Returns the singleton GestureConfiguration.
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 bool double_tap_enabled() const { return double_tap_enabled_; }
29 void set_double_tap_enabled(bool enabled) { double_tap_enabled_ = enabled; }
30 int double_tap_timeout_in_ms() const { return double_tap_timeout_in_ms_; }
31 int fling_max_cancel_to_down_time_in_ms() const {
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() const {
38 return fling_max_tap_gap_time_in_ms_;
39 }
40 void set_fling_max_tap_gap_time_in_ms(int val) {
41 fling_max_tap_gap_time_in_ms_ = val;
42 }
43 bool gesture_begin_end_types_enabled() const {
44 return gesture_begin_end_types_enabled_;
45 }
46 void set_gesture_begin_end_types_enabled(bool val) {
47 gesture_begin_end_types_enabled_ = val;
48 }
49 int long_press_time_in_ms() const { return long_press_time_in_ms_; }
50 void set_long_press_time_in_ms(int val) { long_press_time_in_ms_ = val; }
51 float max_distance_between_taps_for_double_tap() const {
52 return max_distance_between_taps_for_double_tap_;
53 }
54 void set_max_distance_between_taps_for_double_tap(float val) {
55 max_distance_between_taps_for_double_tap_ = val;
56 }
57 float max_distance_for_two_finger_tap_in_pixels() const {
58 return max_distance_for_two_finger_tap_in_pixels_;
59 }
60 void set_max_distance_for_two_finger_tap_in_pixels(float val) {
61 max_distance_for_two_finger_tap_in_pixels_ = val;
62 }
63 float max_fling_velocity() const { return max_fling_velocity_; }
64 void set_max_fling_velocity(float val) { max_fling_velocity_ = val; }
65 float max_gesture_bounds_length() const {
66 return max_gesture_bounds_length_;
67 }
68 void set_max_gesture_bounds_length(float val) {
69 max_gesture_bounds_length_ = val;
70 }
71 float max_separation_for_gesture_touches_in_pixels() const {
72 return max_separation_for_gesture_touches_in_pixels_;
73 }
74 void set_max_separation_for_gesture_touches_in_pixels(float val) {
75 max_separation_for_gesture_touches_in_pixels_ = val;
76 }
77 float max_swipe_deviation_angle() const {
78 return max_swipe_deviation_angle_;
79 }
80 void set_max_swipe_deviation_angle(float val) {
81 max_swipe_deviation_angle_ = val;
82 }
83 int max_time_between_double_click_in_ms() const {
84 return max_time_between_double_click_in_ms_;
85 }
86 void set_max_time_between_double_click_in_ms(int val) {
87 max_time_between_double_click_in_ms_ = val;
88 }
89 int max_touch_down_duration_for_click_in_ms() const {
90 return max_touch_down_duration_for_click_in_ms_;
91 }
92 void set_max_touch_down_duration_for_click_in_ms(int val) {
93 max_touch_down_duration_for_click_in_ms_ = val;
94 }
95 float max_touch_move_in_pixels_for_click() const {
96 return max_touch_move_in_pixels_for_click_;
97 }
98 void set_max_touch_move_in_pixels_for_click(float val) {
99 max_touch_move_in_pixels_for_click_ = val;
100 span_slop_ = max_touch_move_in_pixels_for_click_ * 2;
101 }
102 float min_distance_for_pinch_scroll_in_pixels() const {
103 return min_distance_for_pinch_scroll_in_pixels_;
104 }
105 void set_min_distance_for_pinch_scroll_in_pixels(float val) {
106 min_distance_for_pinch_scroll_in_pixels_ = val;
107 }
108 float min_fling_velocity() const { return min_fling_velocity_; }
109 void set_min_fling_velocity(float val) { min_fling_velocity_ = val; }
110 float min_gesture_bounds_length() const {
111 return min_gesture_bounds_length_;
112 }
113 float min_pinch_update_span_delta() const {
114 return min_pinch_update_span_delta_;
115 }
116 void set_min_pinch_update_span_delta(float val) {
117 min_pinch_update_span_delta_ = val;
118 }
119 float min_scaling_span_in_pixels() const {
120 return min_scaling_span_in_pixels_;
121 }
122 void set_min_scaling_span_in_pixels(float val) {
123 min_scaling_span_in_pixels_ = val;
124 }
125 float min_scaling_touch_major() const { return min_scaling_touch_major_; }
126 float min_swipe_velocity() const { return min_swipe_velocity_; }
127 void set_min_swipe_velocity(float val) { min_swipe_velocity_ = val; }
128 int scroll_debounce_interval_in_ms() const {
129 return scroll_debounce_interval_in_ms_;
130 }
131 int set_scroll_debounce_interval_in_ms(int val) {
132 return scroll_debounce_interval_in_ms_ = val;
133 }
134 int semi_long_press_time_in_ms() const {
135 return semi_long_press_time_in_ms_;
136 }
137 void set_semi_long_press_time_in_ms(int val) {
138 semi_long_press_time_in_ms_ = val;
139 double_tap_timeout_in_ms_ = val;
140 }
141 int show_press_delay_in_ms() const { return show_press_delay_in_ms_; }
142 int set_show_press_delay_in_ms(int val) {
143 return show_press_delay_in_ms_ = val;
144 }
145 float span_slop() const { return span_slop_; }
146 bool swipe_enabled() const { return swipe_enabled_; }
147 void set_swipe_enabled(bool val) { swipe_enabled_ = val; }
148
149 // TODO(davemoore): Move into chrome/browser/ui.
150 int tab_scrub_activation_delay_in_ms() const {
151 return tab_scrub_activation_delay_in_ms_;
152 }
153 void set_tab_scrub_activation_delay_in_ms(int val) {
154 tab_scrub_activation_delay_in_ms_ = val;
155 }
156 bool two_finger_tap_enabled() const { return two_finger_tap_enabled_; }
157 void set_two_finger_tap_enabled(bool val) { two_finger_tap_enabled_ = val; }
158 VelocityTracker::Strategy velocity_tracker_strategy() const {
159 return velocity_tracker_strategy_;
160 }
161 void set_velocity_tracker_strategy(VelocityTracker::Strategy val) {
162 velocity_tracker_strategy_ = val;
163 }
164
165 protected:
166 GestureConfiguration();
167 virtual ~GestureConfiguration();
168
169 // The below configuration parameters are dependent on other parameters,
170 // whose setter functions will setup these values as well, so we will not
171 // provide public setter functions for them.
172 void set_double_tap_timeout_in_ms(int val) {
173 double_tap_timeout_in_ms_ = val;
174 }
175 void set_min_gesture_bounds_length(float val) {
176 min_gesture_bounds_length_ = val;
177 }
178 void set_min_scaling_touch_major(float val) {
179 min_scaling_touch_major_ = val;
180 }
181 void set_span_slop(float val) { span_slop_ = val; }
182
183 private:
184 // Returns the platform specific instance. This is invoked if a specific
185 // instance has not been set.
186 static GestureConfiguration* GetPlatformSpecificInstance();
187
188 // These are listed in alphabetical order ignoring underscores.
189 // NOTE: Adding new configuration parameters requires initializing
190 // corresponding entries in aura_test_base.cc's SetUp().
191
192 // The default touch radius length used when the only information given
193 // by the device is the touch center.
194 float default_radius_;
195
196 bool double_tap_enabled_;
197 int double_tap_timeout_in_ms_;
198
199 // Maximum time between a GestureFlingCancel and a mousedown such that the
200 // mousedown is considered associated with the cancel event.
201 int fling_max_cancel_to_down_time_in_ms_;
202
203 // Maxium time between a mousedown/mouseup pair that is considered to be a
204 // suppressable tap.
205 int fling_max_tap_gap_time_in_ms_;
206 bool gesture_begin_end_types_enabled_;
207 int long_press_time_in_ms_;
208 float max_distance_between_taps_for_double_tap_;
209
210 // The maximum allowed distance between two fingers for a two finger tap. If
211 // the distance between two fingers is greater than this value, we will not
212 // recognize a two finger tap.
213 float max_distance_for_two_finger_tap_in_pixels_;
214 float max_fling_velocity_;
215 float max_gesture_bounds_length_;
216 float max_separation_for_gesture_touches_in_pixels_;
217 float max_swipe_deviation_angle_;
218 int max_time_between_double_click_in_ms_;
219 int max_touch_down_duration_for_click_in_ms_;
220 float max_touch_move_in_pixels_for_click_;
221 float min_distance_for_pinch_scroll_in_pixels_;
222 float min_fling_velocity_;
223 float min_gesture_bounds_length_;
224 // Only used with --compensate-for-unstable-pinch-zoom.
225 float min_pinch_update_span_delta_;
226 float min_scaling_span_in_pixels_;
227 float min_scaling_touch_major_;
228 float min_swipe_velocity_;
229 int scroll_debounce_interval_in_ms_;
230 int semi_long_press_time_in_ms_;
231 int show_press_delay_in_ms_;
232 float span_slop_;
233 bool swipe_enabled_;
234
235 // TODO(davemoore): Move into chrome/browser/ui.
236 int tab_scrub_activation_delay_in_ms_;
237 bool two_finger_tap_enabled_;
238 VelocityTracker::Strategy velocity_tracker_strategy_;
239
240 DISALLOW_COPY_AND_ASSIGN(GestureConfiguration);
241 };
242
243 } // namespace ui
244
245 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_CONFIGURATION_H_
OLDNEW
« no previous file with comments | « ui/events/gesture_detection/gesture_config_helper_aura.cc ('k') | ui/events/gesture_detection/gesture_configuration.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698