Chromium Code Reviews| Index: ui/events/gesture_detection/gesture_configuration.cc |
| diff --git a/ui/events/gesture_detection/gesture_configuration.cc b/ui/events/gesture_detection/gesture_configuration.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..30e02163fc4372ab0c451121362df80357ed0b8e |
| --- /dev/null |
| +++ b/ui/events/gesture_detection/gesture_configuration.cc |
| @@ -0,0 +1,83 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "ui/events/gesture_detection/gesture_configuration.h" |
| + |
| +namespace ui { |
| + |
| +GestureConfiguration::GestureConfiguration() |
| + : default_radius_(25), |
| + fling_max_cancel_to_down_time_in_ms_(400), |
| + fling_max_tap_gap_time_in_ms_(200), |
| + gesture_begin_end_types_enabled_(false), |
| + max_distance_for_two_finger_tap_in_pixels_(300), |
| + max_gesture_bounds_length_(0), |
| + max_separation_for_gesture_touches_in_pixels_(150), |
| + max_swipe_deviation_angle_(20), |
| + max_time_between_double_click_in_ms_(700), |
| + max_touch_down_duration_for_click_in_ms_(800), |
| + min_distance_for_pinch_scroll_in_pixels_(20), |
| + min_gesture_bounds_length_(0), |
|
jdduke (slow)
2014/10/22 17:31:34
It looks like we're missing a number of initialize
lanwei
2014/10/23 01:26:17
Done.
|
| + min_pinch_update_distance_in_pixels_(5), |
|
jdduke (slow)
2014/10/22 17:31:33
min_pinch_update_distance_in_pixels_ should defaul
lanwei
2014/10/23 01:26:17
Done.
|
| + min_swipe_speed_(20), |
| +// TODO(jdduke): Disable and remove entirely when issues with intermittent |
| +// scroll end detection on the Pixel are resolved, crbug.com/353702. |
| +#if defined(OS_CHROMEOS) |
| + scroll_debounce_interval_in_ms_(30), |
| +#else |
| + scroll_debounce_interval_in_ms_(0), |
| +#endif |
| + swipe_enabled_(false), |
| + tab_scrub_activation_delay_in_ms_(200), |
| + two_finger_tap_enabled_(false) { |
| +} |
| + |
| +GestureConfiguration::~GestureConfiguration() { |
| +} |
| + |
| +GestureProvider::Config GestureConfiguration::DefaultGestureProviderConfig() { |
| + GestureProvider::Config config; |
| + config.display = display(); |
| + config.gesture_detector_config = DefaultGestureDetectorConfig(); |
| + config.scale_gesture_detector_config = DefaultScaleGestureDetectorConfig(); |
| + config.gesture_begin_end_types_enabled = gesture_begin_end_types_enabled(); |
| + config.min_gesture_bounds_length = min_gesture_bounds_length(); |
| + config.max_gesture_bounds_length = max_gesture_bounds_length(); |
| + return config; |
| +} |
| + |
| +GestureDetector::Config GestureConfiguration::DefaultGestureDetectorConfig() { |
| + GestureDetector::Config config; |
| + config.longpress_timeout = |
| + base::TimeDelta::FromMilliseconds(long_press_time_in_ms()); |
| + config.showpress_timeout = |
| + base::TimeDelta::FromMilliseconds(show_press_delay_in_ms()); |
| + config.double_tap_timeout = |
| + base::TimeDelta::FromMilliseconds(semi_long_press_time_in_ms()); |
| + config.touch_slop = max_touch_move_in_pixels_for_click(); |
| + config.double_tap_slop = max_distance_between_taps_for_double_tap(); |
| + config.minimum_fling_velocity = min_scroll_velocity(); |
|
jdduke (slow)
2014/10/22 17:31:33
Can we rename min_scroll_velocity and fling_veloci
lanwei
2014/10/23 01:26:18
Done.
|
| + config.maximum_fling_velocity = fling_velocity_cap(); |
| + config.swipe_enabled = swipe_enabled(); |
| + config.minimum_swipe_velocity = min_swipe_speed(); |
|
jdduke (slow)
2014/10/22 17:31:34
We use velocity elsewhere, can we use it here too
lanwei
2014/10/23 01:26:18
Done.
|
| + config.maximum_swipe_deviation_angle = max_swipe_deviation_angle(); |
| + config.two_finger_tap_enabled = two_finger_tap_enabled(); |
| + config.two_finger_tap_max_separation = |
| + max_distance_for_two_finger_tap_in_pixels(); |
| + config.two_finger_tap_timeout = base::TimeDelta::FromMilliseconds( |
| + max_touch_down_duration_for_click_in_ms()); |
| + return config; |
| +} |
| + |
| +ScaleGestureDetector::Config |
| +GestureConfiguration::DefaultScaleGestureDetectorConfig() { |
| + ScaleGestureDetector::Config config; |
| + config.span_slop = span_slop(); |
| + config.min_scaling_touch_major = min_scaling_touch_major(); |
| + config.min_scaling_span = min_scaling_span_in_pixels(); |
| + config.min_pinch_update_span_delta = min_pinch_update_span_delta(); |
| + return config; |
| +} |
| + |
| +} // namespace ui |