Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / events / gesture_detection / gesture_configuration.cc
blobc3d3d2fe9cc2f2e5242b81e610488b7cae8ae0ea
1 // Copyright 2014 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.
5 #include "ui/events/gesture_detection/gesture_configuration.h"
7 namespace ui {
8 namespace {
10 GestureConfiguration* instance = nullptr;
12 } // namespace
14 // static
15 void GestureConfiguration::SetInstance(GestureConfiguration* config) {
16 instance = config;
19 // static
20 GestureConfiguration* GestureConfiguration::GetInstance() {
21 if (instance)
22 return instance;
24 return GestureConfiguration::GetPlatformSpecificInstance();
27 GestureConfiguration::GestureConfiguration()
28 : default_radius_(25),
29 double_tap_enabled_(false),
30 double_tap_timeout_in_ms_(400),
31 fling_touchpad_tap_suppression_enabled_(false),
32 fling_touchscreen_tap_suppression_enabled_(false),
33 fling_max_cancel_to_down_time_in_ms_(400),
34 fling_max_tap_gap_time_in_ms_(200),
35 gesture_begin_end_types_enabled_(false),
36 long_press_time_in_ms_(1000),
37 max_distance_between_taps_for_double_tap_(20),
38 max_distance_for_two_finger_tap_in_pixels_(300),
39 max_fling_velocity_(17000.0f),
40 max_gesture_bounds_length_(0),
41 max_separation_for_gesture_touches_in_pixels_(150),
42 max_swipe_deviation_angle_(20),
43 max_time_between_double_click_in_ms_(700),
44 max_touch_down_duration_for_click_in_ms_(800),
45 max_touch_move_in_pixels_for_click_(15),
46 min_distance_for_pinch_scroll_in_pixels_(20),
47 min_fling_velocity_(30.0f),
48 min_gesture_bounds_length_(0),
49 min_pinch_update_span_delta_(0),
50 // If this is too small, we currently can get single finger pinch zoom.
51 // See crbug.com/357237 for details.
52 min_scaling_span_in_pixels_(125),
53 // The default value of min_scaling_touch_major_ is 2 * default_radius_.
54 min_scaling_touch_major_(50),
55 min_swipe_velocity_(20),
56 // TODO(jdduke): Disable and remove entirely when issues with intermittent
57 // scroll end detection on the Pixel are resolved, crbug.com/353702.
58 #if defined(OS_CHROMEOS)
59 scroll_debounce_interval_in_ms_(30),
60 #else
61 scroll_debounce_interval_in_ms_(0),
62 #endif
63 semi_long_press_time_in_ms_(400),
64 show_press_delay_in_ms_(150),
65 // The default value of span_slop_ is
66 // 2 * max_touch_move_in_pixels_for_click_.
67 span_slop_(30),
68 swipe_enabled_(false),
69 tab_scrub_activation_delay_in_ms_(200),
70 two_finger_tap_enabled_(false),
71 velocity_tracker_strategy_(VelocityTracker::Strategy::STRATEGY_DEFAULT) {
74 GestureConfiguration::~GestureConfiguration() {
77 } // namespace ui