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

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: Move all the methods to superclass 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/command_line.h"
10 #include "base/memory/singleton.h"
11 #include "ui/events/event_switches.h"
12 #include "ui/events/gesture_detection/gesture_detection_export.h"
13 #include "ui/events/gesture_detection/gesture_detector.h"
14 #include "ui/events/gesture_detection/gesture_provider.h"
15 #include "ui/events/gesture_detection/scale_gesture_detector.h"
16 #include "ui/gfx/screen.h"
17
18 namespace ui {
19
20 class GESTURE_DETECTION_EXPORT GestureConfiguration {
21 public:
22 GestureConfiguration();
jdduke (slow) 2014/10/22 17:31:34 I believe this constructor should be protected?
lanwei 2014/10/23 01:26:18 Done.
23 virtual ~GestureConfiguration();
24
25 static GestureConfiguration* GetInstance();
26
27 GestureProvider::Config DefaultGestureProviderConfig();
28 GestureDetector::Config DefaultGestureDetectorConfig();
29 ScaleGestureDetector::Config DefaultScaleGestureDetectorConfig();
30
31 // Ordered alphabetically ignoring underscores.
32 float default_radius() { return default_radius_; }
33 void set_default_radius(float radius) {
34 default_radius_ = radius;
35 min_scaling_touch_major_ = default_radius_ * 2;
36 min_gesture_bounds_length_ = default_radius_;
37 }
38 int fling_max_cancel_to_down_time_in_ms() {
39 return fling_max_cancel_to_down_time_in_ms_;
40 }
41 void set_fling_max_cancel_to_down_time_in_ms(int val) {
42 fling_max_cancel_to_down_time_in_ms_ = val;
43 }
44 int fling_max_tap_gap_time_in_ms() { return fling_max_tap_gap_time_in_ms_; }
45 void set_fling_max_tap_gap_time_in_ms(int val) {
46 fling_max_tap_gap_time_in_ms_ = val;
47 }
48 float fling_velocity_cap() { return fling_velocity_cap_; }
49 void set_fling_velocity_cap(float val) { fling_velocity_cap_ = val; }
50 bool gesture_begin_end_types_enabled() {
51 return gesture_begin_end_types_enabled_;
52 }
53 void set_gesture_begin_end_types_enabled(bool val) {
54 gesture_begin_end_types_enabled_ = val;
55 }
56 int long_press_time_in_ms() { return long_press_time_in_ms_; }
57 void set_long_press_time_in_ms(int val) { long_press_time_in_ms_ = val; }
58 float max_distance_between_taps_for_double_tap() {
59 return max_distance_between_taps_for_double_tap_;
60 }
61 void set_max_distance_between_taps_for_double_tap(float val) {
62 max_distance_between_taps_for_double_tap_ = val;
63 }
64 float max_distance_for_two_finger_tap_in_pixels() {
jdduke (slow) 2014/10/22 17:56:18 One last question. All of these properties have se
lanwei 2014/10/23 01:26:18 Done.
65 return max_distance_for_two_finger_tap_in_pixels_;
66 }
67 void set_max_distance_for_two_finger_tap_in_pixels(float val) {
68 max_distance_for_two_finger_tap_in_pixels_ = val;
69 }
70 float max_gesture_bounds_length() { return max_gesture_bounds_length_; }
71 void set_max_gesture_bounds_length(float val) {
72 max_gesture_bounds_length_ = val;
73 }
74 float max_separation_for_gesture_touches_in_pixels() {
75 return max_separation_for_gesture_touches_in_pixels_;
76 }
77 void set_max_separation_for_gesture_touches_in_pixels(float val) {
78 max_separation_for_gesture_touches_in_pixels_ = val;
79 }
80 float max_swipe_deviation_angle() { return max_swipe_deviation_angle_; }
81 void set_max_swipe_deviation_angle(float val) {
82 max_swipe_deviation_angle_ = val;
83 }
84 int max_time_between_double_click_in_ms() {
85 return max_time_between_double_click_in_ms_;
86 }
87 void set_max_time_between_double_click_in_ms(int val) {
88 max_time_between_double_click_in_ms_ = val;
89 }
90 int max_touch_down_duration_for_click_in_ms() {
91 return max_touch_down_duration_for_click_in_ms_;
92 }
93 void set_max_touch_down_duration_for_click_in_ms(int val) {
94 max_touch_down_duration_for_click_in_ms_ = val;
95 }
96 float max_touch_move_in_pixels_for_click() {
97 return max_touch_move_in_pixels_for_click_;
98 }
99 void set_max_touch_move_in_pixels_for_click(float val) {
100 max_touch_move_in_pixels_for_click_ = val;
101 span_slop_ = max_touch_move_in_pixels_for_click_ * 2;
102 }
103 float min_distance_for_pinch_scroll_in_pixels() {
104 return min_distance_for_pinch_scroll_in_pixels_;
105 }
106 void set_min_distance_for_pinch_scroll_in_pixels(float val) {
107 min_distance_for_pinch_scroll_in_pixels_ = val;
108 }
109 float min_gesture_bounds_length() { return min_gesture_bounds_length_; }
110 void set_min_gesture_bounds_length(float val) {
111 min_gesture_bounds_length_ = val;
112 }
113 float min_pinch_update_distance_in_pixels() {
114 return min_pinch_update_distance_in_pixels_;
115 }
116 void set_min_pinch_update_distance_in_pixels(float val) {
117 min_pinch_update_distance_in_pixels_ = val;
118 min_pinch_update_span_delta_ =
119 CommandLine::ForCurrentProcess()->HasSwitch(
120 switches::kCompensateForUnstablePinchZoom)
121 ? min_pinch_update_distance_in_pixels()
122 : 0;
123 }
124 float min_pinch_update_span_delta() { return min_pinch_update_span_delta_; }
125 void set_min_pinch_update_span_delta(float val) {
126 min_pinch_update_span_delta_ = val;
127 }
128 float min_scaling_span_in_pixels() { return min_scaling_span_in_pixels_; }
129 void set_min_scaling_span_in_pixels(float val) {
130 min_scaling_span_in_pixels_ = val;
131 }
132 float min_scaling_touch_major() { return min_scaling_touch_major_; }
133 void set_min_scaling_touch_major(float val) {
134 min_scaling_touch_major_ = val;
135 }
136 float min_scroll_velocity() { return min_scroll_velocity_; }
137 void set_min_scroll_velocity(float val) { min_scroll_velocity_ = val; }
138 float min_swipe_speed() { return min_swipe_speed_; }
139 void set_min_swipe_speed(float val) { min_swipe_speed_ = val; }
140 int scroll_debounce_interval_in_ms() {
141 return scroll_debounce_interval_in_ms_;
142 }
143 int set_scroll_debounce_interval_in_ms(int val) {
144 return scroll_debounce_interval_in_ms_ = val;
145 }
146 int semi_long_press_time_in_ms() { return semi_long_press_time_in_ms_; }
147 void set_semi_long_press_time_in_ms(int val) {
148 semi_long_press_time_in_ms_ = val;
149 }
150 int show_press_delay_in_ms() { return show_press_delay_in_ms_; }
151 int set_show_press_delay_in_ms(int val) {
152 return show_press_delay_in_ms_ = val;
153 }
154 float span_slop() { return span_slop_; }
155 void set_span_slop(float val) { span_slop_ = val; }
156 bool swipe_enabled() { return swipe_enabled_; }
157 void set_swipe_enabled(bool val) { swipe_enabled_ = val; }
158
159 // TODO(davemoore): Move into chrome/browser/ui.
160 int tab_scrub_activation_delay_in_ms() {
161 return tab_scrub_activation_delay_in_ms_;
162 }
163 void set_tab_scrub_activation_delay_in_ms(int val) {
164 tab_scrub_activation_delay_in_ms_ = val;
165 }
166 bool two_finger_tap_enabled() { return two_finger_tap_enabled_; }
167 void set_two_finger_tap_enabled(bool val) { two_finger_tap_enabled_ = val; }
168 gfx::Display display() { return display_; }
jdduke (slow) 2014/10/22 17:31:34 Display probably does not belong here.
lanwei 2014/10/23 01:26:18 Done.
169 void set_display(gfx::Display val) { display_ = val; }
170
171 private:
172 // These are listed in alphabetical order ignoring underscores.
173
174 // The default touch radius length used when the only information given
175 // by the device is the touch center.
176 float default_radius_;
177
178 // Maximum time between a GestureFlingCancel and a mousedown such that the
179 // mousedown is considered associated with the cancel event.
180 int fling_max_cancel_to_down_time_in_ms_;
181
182 // Maxium time between a mousedown/mouseup pair that is considered to be a
183 // suppressable tap.
184 int fling_max_tap_gap_time_in_ms_;
185 float fling_velocity_cap_;
186 bool gesture_begin_end_types_enabled_;
187 int long_press_time_in_ms_;
188 float max_distance_between_taps_for_double_tap_;
189
190 // The maximum allowed distance between two fingers for a two finger tap. If
191 // the distance between two fingers is greater than this value, we will not
192 // recognize a two finger tap.
193 float max_distance_for_two_finger_tap_in_pixels_;
194 float max_gesture_bounds_length_;
195 float max_separation_for_gesture_touches_in_pixels_;
196 float max_swipe_deviation_angle_;
197 int max_time_between_double_click_in_ms_;
198 int max_touch_down_duration_for_click_in_ms_;
199 float max_touch_move_in_pixels_for_click_;
200 float min_distance_for_pinch_scroll_in_pixels_;
201 float min_gesture_bounds_length_;
202 // Only used with --compensate-for-unstable-pinch-zoom.
203 float min_pinch_update_distance_in_pixels_;
204 float min_pinch_update_span_delta_;
205 float min_scaling_span_in_pixels_;
206 float min_scaling_touch_major_;
207 float min_scroll_velocity_;
208 float min_swipe_speed_;
209 int scroll_debounce_interval_in_ms_;
210 int semi_long_press_time_in_ms_;
211 int show_press_delay_in_ms_;
212 float span_slop_;
213 bool swipe_enabled_;
214
215 // TODO(davemoore): Move into chrome/browser/ui.
216 int tab_scrub_activation_delay_in_ms_;
217 bool two_finger_tap_enabled_;
218 gfx::Display display_;
219
220 friend struct DefaultSingletonTraits<GestureConfiguration>;
221 DISALLOW_COPY_AND_ASSIGN(GestureConfiguration);
222 };
223
224 GESTURE_DETECTION_EXPORT GestureProvider::Config DefaultGestureProviderConfig();
225
226 } // namespace ui
227
228 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_CONFIGURATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698