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

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

Issue 128613003: [Tracking Patch] Unified gesture detection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address tdresser@ comments and run clang-format on everything Created 6 years, 10 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 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.
4
5 #include "ui/events/gesture_detection/gesture_config_helper.h"
6
7 #include "ui/events/gesture_configuration.h"
8 #include "ui/gfx/screen.h"
9
10 namespace ui {
11 namespace {
12
13 GestureDetector::Config DefaultGestureDetectorConfig() {
14 GestureDetector::Config config;
15
16 config.longpress_timeout = base::TimeDelta::FromSecondsF(
17 GestureConfiguration::long_press_time_in_seconds());
18 config.tap_timeout = base::TimeDelta::FromMilliseconds(
19 GestureConfiguration::show_press_delay_in_ms());
20 config.double_tap_timeout = base::TimeDelta::FromSecondsF(
21 GestureConfiguration::semi_long_press_time_in_seconds());
22 config.scaled_touch_slop =
23 GestureConfiguration::max_touch_move_in_pixels_for_click();
24 config.scaled_double_tap_slop =
25 GestureConfiguration::max_distance_between_taps_for_double_tap();
26 config.scaled_minimum_fling_velocity =
27 GestureConfiguration::min_scroll_velocity();
28 config.scaled_maximum_fling_velocity =
29 GestureConfiguration::fling_velocity_cap();
30
31 return config;
32 }
33
34 ScaleGestureDetector::Config DefaultScaleGestureDetectorConfig() {
35 ScaleGestureDetector::Config config;
36
37 config.gesture_detector_config = GetGestureDetectorConfig();
38 config.quick_scale_enabled = false;
39 config.min_scaling_touch_major = GestureConfiguration::default_radius() / 2;
40 config.min_scaling_span =
41 GestureConfiguration::min_distance_for_pinch_scroll_in_pixels();
42 return config;
43 }
44
45 SnapScrollController::Config DefaultSnapScrollControllerConfig() {
46 SnapScrollController::Config config;
47
48 const gfx::Display& display =
49 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay();
50
51 config.screen_width_pixels = display.GetSizeInPixel().width();
52 config.screen_height_pixels = display.GetSizeInPixel().height();
53 config.device_scale_factor = display.device_scale_factor();
54
55 return config;
56 }
57
58 GestureHandler::Config DefaultGestureHandlerConfig() {
59 GestureHandler::Config config;
60 config.gesture_detector_config = DefaultGestureDetectorConfig();
61 config.scale_gesture_detector_config = DefaultScaleGestureDetectorConfig();
62 config.snap_scroll_controller_config = DefaultSnapScrollControllerConfig();
63 return config;
64 }
65
66 } // namespace ui
67
68 #endif // UI_EVENTS_GESTURE_DETECTION__H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698