Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 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_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 = base::TimeDelta::FromMilliseconds( | |
| 22 ViewConfiguration::GetTapTimeoutInMs());; | |
|
tdresser
2014/02/19 17:44:12
Getting a little ; happy in here.
jdduke (slow)
2014/02/19 18:51:58
Done.
| |
| 23 config.double_tap_timeout = base::TimeDelta::FromMilliseconds( | |
| 24 ViewConfiguration::GetDoubleTapTimeoutInMs());;; | |
|
tdresser
2014/02/19 17:44:12
;;;
jdduke (slow)
2014/02/19 18:51:58
Done.
| |
| 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();; | |
|
tdresser
2014/02/19 17:44:12
;;
jdduke (slow)
2014/02/19 18:51:58
Oh dear...
| |
| 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 = | |
| 46 ViewConfiguration::GetMinScalingSpanInPixels();; | |
|
tdresser
2014/02/19 17:44:12
;;
jdduke (slow)
2014/02/19 18:51:58
Done.
| |
| 47 | |
| 48 return config; | |
| 49 } | |
| 50 | |
| 51 SnapScrollController::Config DefaultSnapScrollControllerConfig() { | |
| 52 SnapScrollController::Config config; | |
| 53 | |
| 54 const gfx::Display& display = | |
| 55 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); | |
| 56 | |
| 57 config.screen_width_pixels = display.GetSizeInPixel().width(); | |
| 58 config.screen_height_pixels = display.GetSizeInPixel().height(); | |
| 59 config.device_scale_factor = display.device_scale_factor(); | |
| 60 | |
| 61 return config; | |
| 62 } | |
| 63 | |
| 64 GestureProvider::Config DefaultGestureProviderConfig() { | |
| 65 GestureProvider::Config config; | |
| 66 config.gesture_detector_config = DefaultGestureDetectorConfig(); | |
| 67 config.scale_gesture_detector_config = DefaultScaleGestureDetectorConfig(); | |
| 68 config.snap_scroll_controller_config = DefaultSnapScrollControllerConfig(); | |
| 69 return config; | |
| 70 } | |
| 71 | |
| 72 } // namespace ui | |
| 73 | |
| OLD | NEW |