OLD | NEW |
---|---|
(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 #include "ui/events/gesture_detection/gesture_detector.h" | |
12 #include "ui/events/gesture_detection/gesture_provider.h" | |
13 #include "ui/events/gesture_detection/scale_gesture_detector.h" | |
14 | |
15 namespace ui { | |
16 | |
17 class EVENTS_BASE_EXPORT GestureConfiguration { | |
18 public: | |
19 GestureConfiguration(); | |
20 virtual ~GestureConfiguration(); | |
21 | |
22 static GestureConfiguration* GetInstance(); | |
23 | |
24 virtual GestureDetector::Config DefaultGestureDetectorConfig(); | |
25 virtual ScaleGestureDetector::Config DefaultScaleGestureDetectorConfig(); | |
26 | |
27 // Ordered alphabetically ignoring underscores, to align with the | |
28 // associated list of prefs in gesture_prefs_aura.cc. | |
29 virtual int default_radius(); | |
30 virtual int fling_max_cancel_to_down_time_in_ms(); | |
31 virtual int fling_max_tap_gap_time_in_ms(); | |
32 virtual int long_press_timeout_in_ms(); | |
33 virtual double semi_long_press_time_in_seconds(); | |
34 virtual double max_distance_for_two_finger_tap_in_pixels(); | |
35 virtual double max_seconds_between_double_click(); | |
36 virtual int max_separation_for_gesture_touches_in_pixels(); | |
37 virtual float max_swipe_deviation_angle(); | |
38 virtual double max_touch_down_duration_in_seconds_for_click(); | |
39 virtual double max_touch_move_in_pixels_for_click(); | |
40 virtual double max_distance_between_taps_for_double_tap(); | |
41 virtual double min_distance_for_pinch_scroll_in_pixels(); | |
42 virtual double min_pinch_update_distance_in_pixels(); | |
43 virtual float min_scroll_velocity(); | |
jdduke (slow)
2014/10/06 15:50:50
Mixing virtual and inline is a little confusing, p
| |
44 virtual double min_swipe_speed(); | |
45 virtual int min_scaling_span_in_pixels(); | |
46 virtual int show_press_delay_in_ms(); | |
47 virtual int scroll_debounce_interval_in_ms(); | |
48 virtual float fling_velocity_cap(); | |
49 // TODO(davemoore): Move into chrome/browser/ui. | |
50 virtual int tab_scrub_activation_delay_in_ms(); | |
51 virtual int double_tap_timeout_in_ms(); | |
52 virtual int min_scaling_touch_major_in_pixels(); | |
53 virtual int touch_slop_in_pixels(); | |
54 virtual int span_slop_in_pixels(); | |
55 | |
56 void set_default_radius(int radius) { default_radius_ = radius; } | |
57 void set_fling_max_cancel_to_down_time_in_ms(int val) { | |
58 fling_max_cancel_to_down_time_in_ms_ = val; | |
59 } | |
60 void set_fling_max_tap_gap_time_in_ms(int val) { | |
61 fling_max_tap_gap_time_in_ms_ = val; | |
62 } | |
63 void set_max_distance_for_two_finger_tap_in_pixels(double val) { | |
64 max_distance_for_two_finger_tap_in_pixels_ = val; | |
65 } | |
66 void set_long_press_timeout_in_ms(int val) { | |
67 long_press_timeout_in_ms_ = val; | |
68 } | |
69 void set_semi_long_press_time_in_seconds(double val) { | |
70 semi_long_press_time_in_seconds_ = val; | |
71 } | |
72 void set_max_seconds_between_double_click(double val) { | |
73 max_seconds_between_double_click_ = val; | |
74 } | |
75 void set_max_separation_for_gesture_touches_in_pixels(int val) { | |
76 max_separation_for_gesture_touches_in_pixels_ = val; | |
77 } | |
78 void set_max_swipe_deviation_angle(float val) { | |
79 max_swipe_deviation_angle_ = val; | |
80 } | |
81 void set_max_touch_down_duration_in_seconds_for_click(double val) { | |
82 max_touch_down_duration_in_seconds_for_click_ = val; | |
83 } | |
84 void set_max_touch_move_in_pixels_for_click(double val) { | |
85 max_touch_move_in_pixels_for_click_ = val; | |
86 } | |
87 void set_max_distance_between_taps_for_double_tap(double val) { | |
88 max_distance_between_taps_for_double_tap_ = val; | |
89 } | |
90 void set_min_distance_for_pinch_scroll_in_pixels(double val) { | |
91 min_distance_for_pinch_scroll_in_pixels_ = val; | |
92 } | |
93 void set_min_pinch_update_distance_in_pixels(double val) { | |
94 min_pinch_update_distance_in_pixels_ = val; | |
95 } | |
96 void set_min_scroll_velocity(float val) { min_scroll_velocity_ = val; } | |
97 void set_min_swipe_speed(double val) { min_swipe_speed_ = val; } | |
98 void set_min_scaling_span_in_pixels(int val) { | |
99 min_scaling_span_in_pixels_ = val; | |
100 } | |
101 int set_show_press_delay_in_ms(int val) { | |
102 return show_press_delay_in_ms_ = val; | |
103 } | |
104 int set_scroll_debounce_interval_in_ms(int val) { | |
105 return scroll_debounce_interval_in_ms_ = val; | |
106 } | |
107 void set_fling_velocity_cap(float val) { fling_velocity_cap_ = val; } | |
108 void set_tab_scrub_activation_delay_in_ms(int val) { | |
109 tab_scrub_activation_delay_in_ms_ = val; | |
110 } | |
111 | |
112 private: | |
113 // These are listed in alphabetical order ignoring underscores, to | |
114 // align with the associated list of preferences in | |
115 // gesture_prefs_aura.cc. These two lists should be kept in sync. | |
116 | |
117 // The default touch radius length used when the only information given | |
118 // by the device is the touch center. | |
119 int default_radius_; | |
120 | |
121 // The maximum allowed distance between two fingers for a two finger tap. If | |
122 // the distance between two fingers is greater than this value, we will not | |
123 // recognize a two finger tap. | |
124 double max_distance_for_two_finger_tap_in_pixels_; | |
125 | |
126 // Maximum time between a GestureFlingCancel and a mousedown such that the | |
127 // mousedown is considered associated with the cancel event. | |
128 int fling_max_cancel_to_down_time_in_ms_; | |
129 | |
130 // Maxium time between a mousedown/mouseup pair that is considered to be a | |
131 // suppressable tap. | |
132 int fling_max_tap_gap_time_in_ms_; | |
133 float fling_velocity_cap_; | |
134 int tab_scrub_activation_delay_in_ms_; | |
135 int long_press_timeout_in_ms_; | |
136 double semi_long_press_time_in_seconds_; | |
137 double max_seconds_between_double_click_; | |
138 double max_separation_for_gesture_touches_in_pixels_; | |
139 float max_swipe_deviation_angle_; | |
140 double max_touch_down_duration_in_seconds_for_click_; | |
141 double max_touch_move_in_pixels_for_click_; | |
142 double max_distance_between_taps_for_double_tap_; | |
143 double min_distance_for_pinch_scroll_in_pixels_; | |
144 // Only used with --compensate-for-unstable-pinch-zoom. | |
145 double min_pinch_update_distance_in_pixels_; | |
146 float min_scroll_velocity_; | |
147 double min_swipe_speed_; | |
148 int min_scaling_span_in_pixels_; | |
149 int show_press_delay_in_ms_; | |
150 int scroll_debounce_interval_in_ms_; | |
151 // TODO(davemoore): Move into chrome/browser/ui. | |
152 int double_tap_timeout_in_ms_; | |
153 // These values may vary as view-specific parameters (DPI scale) are changed, | |
154 // so read/write access must be synchronized. | |
155 int span_slop_in_pixels_; | |
156 int min_scaling_touch_major_in_pixels_; | |
157 int touch_slop_in_pixels_; | |
158 friend struct DefaultSingletonTraits<GestureConfiguration>; | |
159 DISALLOW_COPY_AND_ASSIGN(GestureConfiguration); | |
160 }; | |
161 | |
162 GESTURE_DETECTION_EXPORT GestureProvider::Config DefaultGestureProviderConfig(); | |
163 | |
164 } // namespace ui | |
165 | |
166 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_CONFIGURATION_H_ | |
OLD | NEW |