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

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

Issue 613373004: Adopt ui::GestureConfiguration on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Copyright Created 6 years, 1 month 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 "base/memory/singleton.h"
10 #include "ui/events/gesture_detection/gesture_detection_export.h"
11
12 namespace ui {
13
14 class GESTURE_DETECTION_EXPORT GestureConfiguration {
15 public:
16 // Returns the singleton GestureConfiguration.
17 static GestureConfiguration* GetInstance();
18
19 // Ordered alphabetically ignoring underscores.
20 float default_radius() const { return default_radius_; }
21 void set_default_radius(float radius) {
22 default_radius_ = radius;
23 min_scaling_touch_major_ = default_radius_ * 2;
24 min_gesture_bounds_length_ = default_radius_;
25 }
26 int double_tap_timeout_in_ms() const { return double_tap_timeout_in_ms_; }
27 int fling_max_cancel_to_down_time_in_ms() const {
28 return fling_max_cancel_to_down_time_in_ms_;
29 }
30 void set_fling_max_cancel_to_down_time_in_ms(int val) {
31 fling_max_cancel_to_down_time_in_ms_ = val;
32 }
33 int fling_max_tap_gap_time_in_ms() const {
34 return fling_max_tap_gap_time_in_ms_;
35 }
36 void set_fling_max_tap_gap_time_in_ms(int val) {
37 fling_max_tap_gap_time_in_ms_ = val;
38 }
39 bool gesture_begin_end_types_enabled() const {
40 return gesture_begin_end_types_enabled_;
41 }
42 int long_press_time_in_ms() const { return long_press_time_in_ms_; }
43 void set_long_press_time_in_ms(int val) { long_press_time_in_ms_ = val; }
44 float max_distance_between_taps_for_double_tap() const {
45 return max_distance_between_taps_for_double_tap_;
46 }
47 void set_max_distance_between_taps_for_double_tap(float val) {
48 max_distance_between_taps_for_double_tap_ = val;
49 }
50 float max_distance_for_two_finger_tap_in_pixels() const {
51 return max_distance_for_two_finger_tap_in_pixels_;
52 }
53 void set_max_distance_for_two_finger_tap_in_pixels(float val) {
54 max_distance_for_two_finger_tap_in_pixels_ = val;
55 }
56 float max_fling_velocity() const { return max_fling_velocity_; }
57 void set_max_fling_velocity(float val) { max_fling_velocity_ = val; }
58 float max_gesture_bounds_length() const {
59 return max_gesture_bounds_length_;
60 }
61 float max_separation_for_gesture_touches_in_pixels() const {
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() const {
68 return max_swipe_deviation_angle_;
69 }
70 int max_time_between_double_click_in_ms() const {
71 return max_time_between_double_click_in_ms_;
72 }
73 void set_max_time_between_double_click_in_ms(int val) {
74 max_time_between_double_click_in_ms_ = val;
75 }
76 int max_touch_down_duration_for_click_in_ms() const {
77 return max_touch_down_duration_for_click_in_ms_;
78 }
79 void set_max_touch_down_duration_for_click_in_ms(int val) {
80 max_touch_down_duration_for_click_in_ms_ = val;
81 }
82 float max_touch_move_in_pixels_for_click() const {
83 return max_touch_move_in_pixels_for_click_;
84 }
85 void set_max_touch_move_in_pixels_for_click(float val) {
86 max_touch_move_in_pixels_for_click_ = val;
87 span_slop_ = max_touch_move_in_pixels_for_click_ * 2;
88 }
89 float min_distance_for_pinch_scroll_in_pixels() const {
90 return min_distance_for_pinch_scroll_in_pixels_;
91 }
92 void set_min_distance_for_pinch_scroll_in_pixels(float val) {
93 min_distance_for_pinch_scroll_in_pixels_ = val;
94 }
95 float min_fling_velocity() const { return min_fling_velocity_; }
96 float min_gesture_bounds_length() const {
97 return min_gesture_bounds_length_;
98 }
99 float min_pinch_update_span_delta() const {
100 return min_pinch_update_span_delta_;
101 }
102 void set_min_pinch_update_span_delta(float val) {
103 min_pinch_update_span_delta_ = val;
104 }
105 float min_scaling_span_in_pixels() const {
106 return min_scaling_span_in_pixels_;
107 }
108 float min_scaling_touch_major() const { return min_scaling_touch_major_; }
109 float min_swipe_velocity() const { return min_swipe_velocity_; }
110 void set_min_swipe_velocity(float val) { min_swipe_velocity_ = val; }
111 int scroll_debounce_interval_in_ms() const {
112 return scroll_debounce_interval_in_ms_;
113 }
114 int set_scroll_debounce_interval_in_ms(int val) {
115 return scroll_debounce_interval_in_ms_ = val;
116 }
117 int semi_long_press_time_in_ms() const {
118 return semi_long_press_time_in_ms_;
119 }
120 void set_semi_long_press_time_in_ms(int val) {
121 semi_long_press_time_in_ms_ = val;
122 double_tap_timeout_in_ms_ = val;
123 }
124 int show_press_delay_in_ms() const { return show_press_delay_in_ms_; }
125 int set_show_press_delay_in_ms(int val) {
126 return show_press_delay_in_ms_ = val;
127 }
128 float span_slop() const { return span_slop_; }
129 bool swipe_enabled() const { return swipe_enabled_; }
130
131 // TODO(davemoore): Move into chrome/browser/ui.
132 int tab_scrub_activation_delay_in_ms() const {
133 return tab_scrub_activation_delay_in_ms_;
134 }
135 void set_tab_scrub_activation_delay_in_ms(int val) {
136 tab_scrub_activation_delay_in_ms_ = val;
137 }
138 bool two_finger_tap_enabled() const { return two_finger_tap_enabled_; }
139
140 protected:
141 GestureConfiguration();
142 virtual ~GestureConfiguration();
143
144 void set_double_tap_timeout_in_ms(int val) {
145 double_tap_timeout_in_ms_ = val;
146 }
147 void set_gesture_begin_end_types_enabled(bool val) {
148 gesture_begin_end_types_enabled_ = val;
149 }
150 void set_max_gesture_bounds_length(float val) {
151 max_gesture_bounds_length_ = val;
152 }
153 void set_max_swipe_deviation_angle(float val) {
154 max_swipe_deviation_angle_ = val;
155 }
156 void set_min_fling_velocity(float val) { min_fling_velocity_ = val; }
157 void set_min_gesture_bounds_length(float val) {
158 min_gesture_bounds_length_ = val;
159 }
160 void set_min_scaling_span_in_pixels(float val) {
161 min_scaling_span_in_pixels_ = val;
162 }
163 void set_min_scaling_touch_major(float val) {
164 min_scaling_touch_major_ = val;
165 }
166 void set_span_slop(float val) { span_slop_ = val; }
167 void set_swipe_enabled(bool val) { swipe_enabled_ = val; }
168 void set_two_finger_tap_enabled(bool val) { two_finger_tap_enabled_ = val; }
169
170 private:
171 // These are listed in alphabetical order ignoring underscores.
172
173 // The default touch radius length used when the only information given
174 // by the device is the touch center.
175 float default_radius_;
176 int double_tap_timeout_in_ms_;
177 // Maximum time between a GestureFlingCancel and a mousedown such that the
178 // mousedown is considered associated with the cancel event.
179 int fling_max_cancel_to_down_time_in_ms_;
180
181 // Maxium time between a mousedown/mouseup pair that is considered to be a
182 // suppressable tap.
183 int fling_max_tap_gap_time_in_ms_;
184 bool gesture_begin_end_types_enabled_;
185 int long_press_time_in_ms_;
186 float max_distance_between_taps_for_double_tap_;
187
188 // The maximum allowed distance between two fingers for a two finger tap. If
189 // the distance between two fingers is greater than this value, we will not
190 // recognize a two finger tap.
191 float max_distance_for_two_finger_tap_in_pixels_;
192 float max_fling_velocity_;
193 float max_gesture_bounds_length_;
194 float max_separation_for_gesture_touches_in_pixels_;
195 float max_swipe_deviation_angle_;
196 int max_time_between_double_click_in_ms_;
197 int max_touch_down_duration_for_click_in_ms_;
198 float max_touch_move_in_pixels_for_click_;
199 float min_distance_for_pinch_scroll_in_pixels_;
200 float min_fling_velocity_;
201 float min_gesture_bounds_length_;
202 // Only used with --compensate-for-unstable-pinch-zoom.
203 float min_pinch_update_span_delta_;
204 float min_scaling_span_in_pixels_;
205 float min_scaling_touch_major_;
206 float min_swipe_velocity_;
207 int scroll_debounce_interval_in_ms_;
208 int semi_long_press_time_in_ms_;
209 int show_press_delay_in_ms_;
210 float span_slop_;
211 bool swipe_enabled_;
212
213 // TODO(davemoore): Move into chrome/browser/ui.
214 int tab_scrub_activation_delay_in_ms_;
215 bool two_finger_tap_enabled_;
216
217 friend struct DefaultSingletonTraits<GestureConfiguration>;
218 DISALLOW_COPY_AND_ASSIGN(GestureConfiguration);
219 };
220
221 } // namespace ui
222
223 #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