Chromium Code Reviews| Index: ui/events/gesture_detection/gesture_config_helper_android.cc |
| diff --git a/ui/events/gesture_detection/gesture_config_helper_android.cc b/ui/events/gesture_detection/gesture_config_helper_android.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8d8e4dced0e73ff9361e626b3cd8ac6eb3d7e2de |
| --- /dev/null |
| +++ b/ui/events/gesture_detection/gesture_config_helper_android.cc |
| @@ -0,0 +1,73 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "ui/events/gesture_detection/gesture_config_helper.h" |
| + |
| +#include "ui/gfx/android/view_configuration.h" |
| +#include "ui/gfx/screen.h" |
| + |
| +using gfx::ViewConfiguration; |
| + |
| +namespace ui { |
| + |
| +// TODO(jdduke): Adopt GestureConfiguration on Android, crbug/339203. |
| + |
| +GestureDetector::Config DefaultGestureDetectorConfig() { |
| + GestureDetector::Config config; |
| + |
| + config.longpress_timeout = base::TimeDelta::FromMilliseconds( |
| + ViewConfiguration::GetLongPressTimeoutInMs()); |
| + config.tap_timeout = base::TimeDelta::FromMilliseconds( |
| + ViewConfiguration::GetTapTimeoutInMs());; |
|
tdresser
2014/02/19 17:44:12
Getting a little ; happy in here.
jdduke (slow)
2014/02/19 18:51:58
Done.
|
| + config.double_tap_timeout = base::TimeDelta::FromMilliseconds( |
| + ViewConfiguration::GetDoubleTapTimeoutInMs());;; |
|
tdresser
2014/02/19 17:44:12
;;;
jdduke (slow)
2014/02/19 18:51:58
Done.
|
| + |
| + config.scaled_touch_slop = ViewConfiguration::GetTouchSlopInPixels(); |
| + config.scaled_double_tap_slop = ViewConfiguration::GetDoubleTapSlopInPixels(); |
| + config.scaled_minimum_fling_velocity = |
| + ViewConfiguration::GetMinimumFlingVelocityInPixelsPerSecond(); |
| + config.scaled_maximum_fling_velocity = |
| + ViewConfiguration::GetMaximumFlingVelocityInPixelsPerSecond();; |
|
tdresser
2014/02/19 17:44:12
;;
jdduke (slow)
2014/02/19 18:51:58
Oh dear...
|
| + |
| + return config; |
| +} |
| + |
| +ScaleGestureDetector::Config DefaultScaleGestureDetectorConfig() { |
| + ScaleGestureDetector::Config config; |
| + |
| + config.gesture_detector_config = DefaultGestureDetectorConfig(); |
| + // TODO(jdduke): Enable "quick scale" on the ScaleGestureDetector, and remove |
| + // corresponding double tap drag zoom code from GestureProvider, crbug/331092. |
| + config.quick_scale_enabled = false; |
| + config.min_scaling_touch_major = |
| + ViewConfiguration::GetMinScalingTouchMajorInPixels(); |
| + config.min_scaling_span = |
| + ViewConfiguration::GetMinScalingSpanInPixels();; |
|
tdresser
2014/02/19 17:44:12
;;
jdduke (slow)
2014/02/19 18:51:58
Done.
|
| + |
| + return config; |
| +} |
| + |
| +SnapScrollController::Config DefaultSnapScrollControllerConfig() { |
| + SnapScrollController::Config config; |
| + |
| + const gfx::Display& display = |
| + gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); |
| + |
| + config.screen_width_pixels = display.GetSizeInPixel().width(); |
| + config.screen_height_pixels = display.GetSizeInPixel().height(); |
| + config.device_scale_factor = display.device_scale_factor(); |
| + |
| + return config; |
| +} |
| + |
| +GestureProvider::Config DefaultGestureProviderConfig() { |
| + GestureProvider::Config config; |
| + config.gesture_detector_config = DefaultGestureDetectorConfig(); |
| + config.scale_gesture_detector_config = DefaultScaleGestureDetectorConfig(); |
| + config.snap_scroll_controller_config = DefaultSnapScrollControllerConfig(); |
| + return config; |
| +} |
| + |
| +} // namespace ui |
| + |