OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/events/gesture_detection/gesture_config_helper.h" | 5 #include "ui/events/gesture_detection/gesture_config_helper.h" |
6 | 6 |
7 #include "ui/gfx/android/view_configuration.h" | 7 #include "ui/gfx/android/view_configuration.h" |
8 #include "ui/gfx/screen.h" | 8 #include "ui/gfx/screen.h" |
9 | 9 |
10 using gfx::ViewConfiguration; | 10 using gfx::ViewConfiguration; |
11 | 11 |
12 namespace ui { | 12 namespace ui { |
13 namespace { | 13 namespace { |
14 // TODO(jdduke): Adopt GestureConfiguration on Android, crbug/339203. | 14 // TODO(jdduke): Adopt GestureConfiguration on Android, crbug/339203. |
15 | 15 |
| 16 // This was the minimum tap/press size used on Android before the new gesture |
| 17 // detection pipeline. |
| 18 const float kMinGestureBoundsLengthDips = 24.f; |
| 19 |
16 GestureDetector::Config DefaultGestureDetectorConfig( | 20 GestureDetector::Config DefaultGestureDetectorConfig( |
17 const gfx::Display& display) { | 21 const gfx::Display& display) { |
18 GestureDetector::Config config; | 22 GestureDetector::Config config; |
19 | 23 |
20 config.longpress_timeout = base::TimeDelta::FromMilliseconds( | 24 config.longpress_timeout = base::TimeDelta::FromMilliseconds( |
21 ViewConfiguration::GetLongPressTimeoutInMs()); | 25 ViewConfiguration::GetLongPressTimeoutInMs()); |
22 config.showpress_timeout = | 26 config.showpress_timeout = |
23 base::TimeDelta::FromMilliseconds(ViewConfiguration::GetTapTimeoutInMs()); | 27 base::TimeDelta::FromMilliseconds(ViewConfiguration::GetTapTimeoutInMs()); |
24 config.double_tap_timeout = base::TimeDelta::FromMilliseconds( | 28 config.double_tap_timeout = base::TimeDelta::FromMilliseconds( |
25 ViewConfiguration::GetDoubleTapTimeoutInMs()); | 29 ViewConfiguration::GetDoubleTapTimeoutInMs()); |
(...skipping 29 matching lines...) Expand all Loading... |
55 | 59 |
56 } // namespace | 60 } // namespace |
57 | 61 |
58 GestureProvider::Config DefaultGestureProviderConfig() { | 62 GestureProvider::Config DefaultGestureProviderConfig() { |
59 GestureProvider::Config config; | 63 GestureProvider::Config config; |
60 config.display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); | 64 config.display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); |
61 config.gesture_detector_config = DefaultGestureDetectorConfig(config.display); | 65 config.gesture_detector_config = DefaultGestureDetectorConfig(config.display); |
62 config.scale_gesture_detector_config = | 66 config.scale_gesture_detector_config = |
63 DefaultScaleGestureDetectorConfig(config.display); | 67 DefaultScaleGestureDetectorConfig(config.display); |
64 config.gesture_begin_end_types_enabled = false; | 68 config.gesture_begin_end_types_enabled = false; |
| 69 config.min_gesture_bounds_length = kMinGestureBoundsLengthDips; |
65 return config; | 70 return config; |
66 } | 71 } |
67 | 72 |
68 } // namespace ui | 73 } // namespace ui |
OLD | NEW |