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

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: Created 6 years, 2 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 (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
17 namespace ui {
18
19 class GESTURE_DETECTION_EXPORT GestureConfiguration {
20 public:
21 GestureConfiguration();
22 virtual ~GestureConfiguration();
23
24 static GestureConfiguration* GetInstance();
25
26 virtual GestureDetector::Config DefaultGestureDetectorConfig();
27 virtual ScaleGestureDetector::Config DefaultScaleGestureDetectorConfig();
28
29 // Ordered alphabetically ignoring underscores, to align with the
30 // associated list of prefs in gesture_prefs_aura.cc.
tdresser 2014/10/21 15:21:57 gesture_prefs_aura.cc doesn't exist anymore, so we
lanwei 2014/10/21 20:52:31 Done.
31 float default_radius() { return default_radius_; }
32 void set_default_radius(float radius) {
33 default_radius_ = radius;
34 min_scaling_touch_major_ = default_radius_ * 2;
35 }
36 int fling_max_cancel_to_down_time_in_ms() {
37 return fling_max_cancel_to_down_time_in_ms_;
38 }
39 void set_fling_max_cancel_to_down_time_in_ms(int val) {
40 fling_max_cancel_to_down_time_in_ms_ = val;
41 }
42 int fling_max_tap_gap_time_in_ms() { return fling_max_tap_gap_time_in_ms_; }
43 void set_fling_max_tap_gap_time_in_ms(int val) {
44 fling_max_tap_gap_time_in_ms_ = val;
45 }
46 int long_press_time_in_ms() { return long_press_time_in_ms_; }
47 int semi_long_press_time_in_ms() { return semi_long_press_time_in_ms_; }
48 float max_distance_for_two_finger_tap_in_pixels() {
49 return max_distance_for_two_finger_tap_in_pixels_;
50 }
51 void set_max_distance_for_two_finger_tap_in_pixels(float val) {
52 max_distance_for_two_finger_tap_in_pixels_ = val;
53 }
54 void set_long_press_time_in_ms(int val) { long_press_time_in_ms_ = val; }
55 void set_semi_long_press_time_in_ms(int val) {
56 semi_long_press_time_in_ms_ = val;
57 }
58 int max_time_between_double_click_in_ms() {
59 return max_time_between_double_click_in_ms_;
60 }
61 void set_max_time_between_double_click_in_ms(int val) {
62 max_time_between_double_click_in_ms_ = val;
63 }
64 float max_separation_for_gesture_touches_in_pixels() {
65 return max_separation_for_gesture_touches_in_pixels_;
66 }
67 void set_max_separation_for_gesture_touches_in_pixels(float val) {
68 max_separation_for_gesture_touches_in_pixels_ = val;
69 }
70 float max_swipe_deviation_angle() { return max_swipe_deviation_angle_; }
71 void set_max_swipe_deviation_angle(float val) {
72 max_swipe_deviation_angle_ = val;
73 }
74 int max_touch_down_duration_for_click_in_ms() {
75 return max_touch_down_duration_for_click_in_ms_;
76 }
77 void set_max_touch_down_duration_for_click_in_ms(int val) {
78 max_touch_down_duration_for_click_in_ms_ = val;
79 }
80 float max_touch_move_in_pixels_for_click() {
81 return max_touch_move_in_pixels_for_click_;
82 }
83 void set_max_touch_move_in_pixels_for_click(float val) {
84 max_touch_move_in_pixels_for_click_ = val;
85 span_slop_ = max_touch_move_in_pixels_for_click_ * 2;
86 }
87 float max_distance_between_taps_for_double_tap() {
88 return max_distance_between_taps_for_double_tap_;
89 }
90 void set_max_distance_between_taps_for_double_tap(float val) {
91 max_distance_between_taps_for_double_tap_ = val;
92 }
93 float min_distance_for_pinch_scroll_in_pixels() {
94 return min_distance_for_pinch_scroll_in_pixels_;
95 }
96 void set_min_distance_for_pinch_scroll_in_pixels(float val) {
97 min_distance_for_pinch_scroll_in_pixels_ = val;
98 }
99 float min_pinch_update_distance_in_pixels() {
100 return min_pinch_update_distance_in_pixels_;
101 }
102 void set_min_pinch_update_distance_in_pixels(float val) {
103 min_pinch_update_distance_in_pixels_ = val;
104 min_pinch_update_span_delta_ =
105 CommandLine::ForCurrentProcess()->HasSwitch(
106 switches::kCompensateForUnstablePinchZoom)
107 ? min_pinch_update_distance_in_pixels()
108 : 0;
109 }
110 float min_scroll_velocity() { return min_scroll_velocity_; }
111 void set_min_scroll_velocity(float val) { min_scroll_velocity_ = val; }
112 float min_swipe_speed() { return min_swipe_speed_; }
113 void set_min_swipe_speed(float val) { min_swipe_speed_ = val; }
114 float min_scaling_span_in_pixels() { return min_scaling_span_in_pixels_; }
115 void set_min_scaling_span_in_pixels(float val) {
116 min_scaling_span_in_pixels_ = val;
117 }
118 int show_press_delay_in_ms() { return show_press_delay_in_ms_; }
119 int set_show_press_delay_in_ms(int val) {
120 return show_press_delay_in_ms_ = val;
121 }
122 int scroll_debounce_interval_in_ms() {
123 return scroll_debounce_interval_in_ms_;
124 }
125 int set_scroll_debounce_interval_in_ms(int val) {
126 return scroll_debounce_interval_in_ms_ = val;
127 }
128 float fling_velocity_cap() { return fling_velocity_cap_; }
129 void set_fling_velocity_cap(float val) { fling_velocity_cap_ = val; }
130 // TODO(davemoore): Move into chrome/browser/ui.
131 int tab_scrub_activation_delay_in_ms() {
132 return tab_scrub_activation_delay_in_ms_;
133 }
134 void set_tab_scrub_activation_delay_in_ms(int val) {
135 tab_scrub_activation_delay_in_ms_ = val;
136 }
137 float span_slop() { return span_slop_; }
138 void set_span_slop(float val) { span_slop_ = val; }
139 float min_scaling_touch_major() { return min_scaling_touch_major_; }
140 void set_min_scaling_touch_major(float val) {
141 min_scaling_touch_major_ = val;
142 }
143 float min_pinch_update_span_delta() { return min_pinch_update_span_delta_; }
144 void set_min_pinch_update_span_delta(float val) {
145 min_pinch_update_span_delta_ = val;
146 }
147
148 private:
149 // These are listed in alphabetical order ignoring underscores, to
150 // align with the associated list of preferences in
151 // gesture_prefs_aura.cc. These two lists should be kept in sync.
tdresser 2014/10/21 15:21:57 Remove reference to gesture_prefs_aura.cc.
lanwei 2014/10/21 20:52:31 Done.
152
153 // The default touch radius length used when the only information given
154 // by the device is the touch center.
155 float default_radius_;
156
157 // The maximum allowed distance between two fingers for a two finger tap. If
158 // the distance between two fingers is greater than this value, we will not
159 // recognize a two finger tap.
160 float max_distance_for_two_finger_tap_in_pixels_;
161
162 // Maximum time between a GestureFlingCancel and a mousedown such that the
163 // mousedown is considered associated with the cancel event.
164 int fling_max_cancel_to_down_time_in_ms_;
165
166 // Maxium time between a mousedown/mouseup pair that is considered to be a
167 // suppressable tap.
168 int fling_max_tap_gap_time_in_ms_;
169
170 int long_press_time_in_ms_;
171 int semi_long_press_time_in_ms_;
172 int max_time_between_double_click_in_ms_;
173 float max_separation_for_gesture_touches_in_pixels_;
174 float max_swipe_deviation_angle_;
175 int max_touch_down_duration_for_click_in_ms_;
176 float max_touch_move_in_pixels_for_click_;
177 float max_distance_between_taps_for_double_tap_;
178 float min_distance_for_pinch_scroll_in_pixels_;
179 // Only used with --compensate-for-unstable-pinch-zoom.
180 float min_pinch_update_distance_in_pixels_;
181 float min_scroll_velocity_;
182 float min_swipe_speed_;
183 float min_scaling_span_in_pixels_;
184 int show_press_delay_in_ms_;
185 int scroll_debounce_interval_in_ms_;
186 float fling_velocity_cap_;
187 // TODO(davemoore): Move into chrome/browser/ui.
188 int tab_scrub_activation_delay_in_ms_;
189 float span_slop_;
190 float min_scaling_touch_major_;
191 float min_pinch_update_span_delta_;
192
193 friend struct DefaultSingletonTraits<GestureConfiguration>;
194 DISALLOW_COPY_AND_ASSIGN(GestureConfiguration);
195 };
196
197 GESTURE_DETECTION_EXPORT GestureProvider::Config DefaultGestureProviderConfig();
198
199 } // namespace ui
200
201 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_CONFIGURATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698