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

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