Chromium Code Reviews| OLD | NEW |
|---|---|
| (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/gfx/android/view_configuration.h" | |
| 8 #include "ui/gfx/screen.h" | |
| 9 | |
| 10 using gfx::ViewConfiguration; | |
| 11 | |
| 12 namespace ui { | |
| 13 | |
| 14 // TODO(jdduke): Adopt GestureConfiguration on Android, crbug/339203. | |
| 15 | |
| 16 GestureDetector::Config DefaultGestureDetectorConfig() { | |
| 17 GestureDetector::Config config; | |
| 18 | |
| 19 config.longpress_timeout = base::TimeDelta::FromMilliseconds( | |
| 20 ViewConfiguration::GetLongPressTimeoutInMs()); | |
| 21 config.tap_timeout = | |
|
tdresser
2014/02/19 19:42:28
That is some spectacularly inconsistent line break
jdduke (slow)
2014/02/20 18:01:09
Hmm, you're right, and it's worth being consistent
| |
| 22 base::TimeDelta::FromMilliseconds(ViewConfiguration::GetTapTimeoutInMs()); | |
| 23 config.double_tap_timeout = base::TimeDelta::FromMilliseconds( | |
| 24 ViewConfiguration::GetDoubleTapTimeoutInMs()); | |
| 25 | |
| 26 config.scaled_touch_slop = ViewConfiguration::GetTouchSlopInPixels(); | |
| 27 config.scaled_double_tap_slop = ViewConfiguration::GetDoubleTapSlopInPixels(); | |
| 28 config.scaled_minimum_fling_velocity = | |
| 29 ViewConfiguration::GetMinimumFlingVelocityInPixelsPerSecond(); | |
| 30 config.scaled_maximum_fling_velocity = | |
| 31 ViewConfiguration::GetMaximumFlingVelocityInPixelsPerSecond(); | |
| 32 | |
| 33 return config; | |
| 34 } | |
| 35 | |
| 36 ScaleGestureDetector::Config DefaultScaleGestureDetectorConfig() { | |
| 37 ScaleGestureDetector::Config config; | |
| 38 | |
| 39 config.gesture_detector_config = DefaultGestureDetectorConfig(); | |
| 40 // TODO(jdduke): Enable "quick scale" on the ScaleGestureDetector, and remove | |
| 41 // corresponding double tap drag zoom code from GestureProvider, crbug/331092. | |
| 42 config.quick_scale_enabled = false; | |
| 43 config.min_scaling_touch_major = | |
| 44 ViewConfiguration::GetMinScalingTouchMajorInPixels(); | |
| 45 config.min_scaling_span = ViewConfiguration::GetMinScalingSpanInPixels(); | |
| 46 | |
| 47 return config; | |
| 48 } | |
| 49 | |
| 50 SnapScrollController::Config DefaultSnapScrollControllerConfig() { | |
| 51 SnapScrollController::Config config; | |
| 52 | |
| 53 const gfx::Display& display = | |
| 54 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); | |
| 55 | |
| 56 config.screen_width_pixels = display.GetSizeInPixel().width(); | |
| 57 config.screen_height_pixels = display.GetSizeInPixel().height(); | |
| 58 config.device_scale_factor = display.device_scale_factor(); | |
| 59 | |
| 60 return config; | |
| 61 } | |
| 62 | |
| 63 GestureProvider::Config DefaultGestureProviderConfig() { | |
| 64 GestureProvider::Config config; | |
| 65 config.gesture_detector_config = DefaultGestureDetectorConfig(); | |
| 66 config.scale_gesture_detector_config = DefaultScaleGestureDetectorConfig(); | |
| 67 config.snap_scroll_controller_config = DefaultSnapScrollControllerConfig(); | |
| 68 return config; | |
| 69 } | |
| 70 | |
| 71 } // namespace ui | |
| OLD | NEW |