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

Side by Side Diff: ui/events/gesture_detection/gesture_configuration.cc

Issue 613373004: Adopt ui::GestureConfiguration on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 #include "ui/events/gesture_detection/gesture_configuration.h"
6
7 namespace ui {
8
9 GestureConfiguration::GestureConfiguration()
10 : default_radius_(25),
11 double_tap_timeout_in_ms_(400),
12 fling_max_cancel_to_down_time_in_ms_(400),
13 fling_max_tap_gap_time_in_ms_(200),
14 gesture_begin_end_types_enabled_(false),
15 long_press_time_in_ms_(1000),
16 max_distance_between_taps_for_double_tap_(20),
17 max_distance_for_two_finger_tap_in_pixels_(300),
18 max_fling_velocity_(17000.0f),
19 max_gesture_bounds_length_(0),
20 max_separation_for_gesture_touches_in_pixels_(150),
21 max_swipe_deviation_angle_(20),
22 max_time_between_double_click_in_ms_(700),
23 max_touch_down_duration_for_click_in_ms_(800),
24 max_touch_move_in_pixels_for_click_(15),
25 min_distance_for_pinch_scroll_in_pixels_(20),
26 min_fling_velocity_(30.0f),
27 min_gesture_bounds_length_(0),
28 min_pinch_update_distance_in_pixels_(0),
29 min_pinch_update_span_delta_(0),
30 // If this is too small, we currently can get single finger pinch zoom.
31 // See
tdresser 2014/10/23 14:26:22 Formatting.
lanwei 2014/10/23 19:54:19 Done.
32 // crbug.com/357237 for details.
33 min_scaling_span_in_pixels_(125),
34 min_scaling_touch_major_(0),
35 min_swipe_velocity_(20),
36 // TODO(jdduke): Disable and remove entirely when issues with intermittent
37 // scroll end detection on the Pixel are resolved, crbug.com/353702.
38 #if defined(OS_CHROMEOS)
39 scroll_debounce_interval_in_ms_(30),
40 #else
41 scroll_debounce_interval_in_ms_(0),
42 #endif
43 semi_long_press_time_in_ms_(400),
44 show_press_delay_in_ms_(150),
45 span_slop_(0),
46 swipe_enabled_(false),
47 tab_scrub_activation_delay_in_ms_(200),
48 two_finger_tap_enabled_(false) {
49 }
50
51 GestureConfiguration::~GestureConfiguration() {
52 }
53
54 GestureProvider::Config GestureConfiguration::DefaultGestureProviderConfig() {
55 GestureProvider::Config config;
56 gfx::Screen* screen = gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE);
57 // |screen| is sometimes NULL during tests.
58 if (screen)
59 config.display = screen->GetPrimaryDisplay();
60 config.gesture_detector_config = DefaultGestureDetectorConfig();
61 config.scale_gesture_detector_config = DefaultScaleGestureDetectorConfig();
62 config.gesture_begin_end_types_enabled = gesture_begin_end_types_enabled();
63 config.min_gesture_bounds_length = min_gesture_bounds_length();
64 config.max_gesture_bounds_length = max_gesture_bounds_length();
65 return config;
66 }
67
68 GestureDetector::Config GestureConfiguration::DefaultGestureDetectorConfig() {
69 GestureDetector::Config config;
70 config.longpress_timeout =
71 base::TimeDelta::FromMilliseconds(long_press_time_in_ms());
72 config.showpress_timeout =
73 base::TimeDelta::FromMilliseconds(show_press_delay_in_ms());
74 config.double_tap_timeout =
75 base::TimeDelta::FromMilliseconds(double_tap_timeout_in_ms());
76 config.touch_slop = max_touch_move_in_pixels_for_click();
77 config.double_tap_slop = max_distance_between_taps_for_double_tap();
78 config.minimum_fling_velocity = min_fling_velocity();
79 config.maximum_fling_velocity = max_fling_velocity();
80 config.swipe_enabled = swipe_enabled();
81 config.minimum_swipe_velocity = min_swipe_velocity();
82 config.maximum_swipe_deviation_angle = max_swipe_deviation_angle();
83 config.two_finger_tap_enabled = two_finger_tap_enabled();
84 config.two_finger_tap_max_separation =
85 max_distance_for_two_finger_tap_in_pixels();
86 config.two_finger_tap_timeout = base::TimeDelta::FromMilliseconds(
87 max_touch_down_duration_for_click_in_ms());
88 return config;
89 }
90
91 ScaleGestureDetector::Config
92 GestureConfiguration::DefaultScaleGestureDetectorConfig() {
93 ScaleGestureDetector::Config config;
94 config.span_slop = span_slop();
95 config.min_scaling_touch_major = min_scaling_touch_major();
96 config.min_scaling_span = min_scaling_span_in_pixels();
97 config.min_pinch_update_span_delta = min_pinch_update_span_delta();
98 return config;
99 }
100
101 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698