Add ICU message format support
[chromium-blink-merge.git] / ui / events / gesture_detection / gesture_configuration_android.cc
blob4a81915da19dfb825b76bd74f44093f5718de1cd
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.
5 #include "ui/events/gesture_detection/gesture_configuration.h"
7 #include "base/memory/singleton.h"
8 #include "ui/gfx/android/view_configuration.h"
9 #include "ui/gfx/screen.h"
11 using gfx::ViewConfiguration;
13 namespace ui {
14 namespace {
15 // This was the minimum tap/press size used on Android before the new gesture
16 // detection pipeline.
17 const float kMinGestureBoundsLengthDips = 24.f;
19 // This value is somewhat arbitrary, but provides a reasonable maximum
20 // approximating a large thumb depression.
21 const float kMaxGestureBoundsLengthDips = kMinGestureBoundsLengthDips * 4.f;
23 class GestureConfigurationAndroid : public GestureConfiguration {
24 public:
25 ~GestureConfigurationAndroid() override {
28 static GestureConfigurationAndroid* GetInstance() {
29 return Singleton<GestureConfigurationAndroid>::get();
32 private:
33 GestureConfigurationAndroid() : GestureConfiguration() {
34 set_double_tap_enabled(true);
35 set_double_tap_timeout_in_ms(ViewConfiguration::GetDoubleTapTimeoutInMs());
36 set_gesture_begin_end_types_enabled(false);
37 set_long_press_time_in_ms(ViewConfiguration::GetLongPressTimeoutInMs());
38 set_max_distance_between_taps_for_double_tap(
39 ViewConfiguration::GetDoubleTapSlopInDips());
40 set_max_fling_velocity(
41 ViewConfiguration::GetMaximumFlingVelocityInDipsPerSecond());
42 set_max_gesture_bounds_length(kMaxGestureBoundsLengthDips);
43 set_max_touch_move_in_pixels_for_click(
44 ViewConfiguration::GetTouchSlopInDips());
45 set_min_fling_velocity(
46 ViewConfiguration::GetMinimumFlingVelocityInDipsPerSecond());
47 set_min_gesture_bounds_length(kMinGestureBoundsLengthDips);
48 set_min_pinch_update_span_delta(0.f);
49 set_min_scaling_span_in_pixels(
50 ViewConfiguration::GetMinScalingSpanInDips());
51 set_min_scaling_touch_major(
52 ViewConfiguration::GetMinScalingTouchMajorInDips());
53 set_show_press_delay_in_ms(ViewConfiguration::GetTapTimeoutInMs());
54 set_span_slop(ViewConfiguration::GetTouchSlopInDips() * 2.f);
55 set_fling_touchscreen_tap_suppression_enabled(true);
56 set_fling_touchpad_tap_suppression_enabled(false);
57 set_fling_max_cancel_to_down_time_in_ms(
58 ViewConfiguration::GetTapTimeoutInMs());
59 set_fling_max_tap_gap_time_in_ms(
60 ViewConfiguration::GetLongPressTimeoutInMs());
63 friend struct DefaultSingletonTraits<GestureConfigurationAndroid>;
64 DISALLOW_COPY_AND_ASSIGN(GestureConfigurationAndroid);
67 } // namespace
69 // Create a GestureConfigurationAura singleton instance when using Android.
70 GestureConfiguration* GestureConfiguration::GetPlatformSpecificInstance() {
71 return GestureConfigurationAndroid::GetInstance();
74 } // namespace ui