Index: ui/events/gesture_detection/gesture_configuration_aura.cc |
diff --git a/ui/events/gesture_detection/gesture_configuration_aura.cc b/ui/events/gesture_detection/gesture_configuration_aura.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..51fb2db07de52a55361daf71a906e93a25c91a94 |
--- /dev/null |
+++ b/ui/events/gesture_detection/gesture_configuration_aura.cc |
@@ -0,0 +1,63 @@ |
+// Copyright 2014 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_configuration.h" |
+ |
+#include <cmath> |
+ |
+namespace ui { |
+ |
+namespace { |
+ |
+class GESTURE_DETECTION_EXPORT GestureConfigurationAura |
+ : public GestureConfiguration { |
+ public: |
+ static GestureConfigurationAura* GetInstance() { |
+ return Singleton<GestureConfigurationAura>::get(); |
+ } |
+ |
+ private: |
+ GestureConfigurationAura() : GestureConfiguration() { |
+ set_fling_velocity_cap(17000.0f); |
+ set_gesture_begin_end_types_enabled(true); |
+ set_long_press_time_in_ms(1000); |
+ set_max_distance_between_taps_for_double_tap(20); |
+ set_max_touch_move_in_pixels_for_click(15); |
+ // Half the size of the default touch length is a reasonable minimum. |
+ set_min_gesture_bounds_length(default_radius()); |
+ set_min_pinch_update_span_delta( |
+ CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kCompensateForUnstablePinchZoom) |
+ ? min_pinch_update_distance_in_pixels() |
+ : 0); |
+ // If this is too small, we currently can get single finger pinch zoom. See |
+ // crbug.com/357237 for details. |
+ set_min_scaling_span_in_pixels(125); |
+ set_min_scaling_touch_major(default_radius() * 2); |
+ set_min_scroll_velocity(30.0f); |
+ set_semi_long_press_time_in_ms(400); |
+ set_show_press_delay_in_ms(150); |
+ set_span_slop(max_touch_move_in_pixels_for_click() * 2); |
+ set_swipe_enabled(true); |
+ set_two_finger_tap_enabled(true); |
+ gfx::Screen* screen = gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE); |
+ // |screen| is sometimes NULL during tests. |
+ if (screen) |
+ set_display(screen->GetPrimaryDisplay()); |
+ } |
+ friend struct DefaultSingletonTraits<GestureConfigurationAura>; |
+ DISALLOW_COPY_AND_ASSIGN(GestureConfigurationAura); |
+}; |
tdresser
2014/10/22 17:25:18
We use a comment to indicate ending namespaces, an
lanwei
2014/10/23 01:26:18
Done.
|
+} |
+ |
+GestureConfiguration* GestureConfiguration::GetInstance() { |
+ return GestureConfigurationAura::GetInstance(); |
+} |
+ |
+GestureProvider::Config DefaultGestureProviderConfig() { |
+ return GestureConfigurationAura::GetInstance() |
+ ->DefaultGestureProviderConfig(); |
+} |
+ |
+} // namespace ui |