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_configuration.h" | |
| 6 | |
| 7 #include <cmath> | |
| 8 | |
| 9 namespace ui { | |
| 10 | |
| 11 namespace { | |
| 12 | |
| 13 class GESTURE_DETECTION_EXPORT GestureConfigurationAura | |
| 14 : public GestureConfiguration { | |
| 15 public: | |
| 16 static GestureConfigurationAura* GetInstance() { | |
| 17 return Singleton<GestureConfigurationAura>::get(); | |
| 18 } | |
| 19 | |
| 20 private: | |
| 21 GestureConfigurationAura() : GestureConfiguration() { | |
| 22 set_fling_velocity_cap(17000.0f); | |
| 23 set_gesture_begin_end_types_enabled(true); | |
| 24 set_long_press_time_in_ms(1000); | |
| 25 set_max_distance_between_taps_for_double_tap(20); | |
| 26 set_max_touch_move_in_pixels_for_click(15); | |
| 27 // Half the size of the default touch length is a reasonable minimum. | |
| 28 set_min_gesture_bounds_length(default_radius()); | |
| 29 set_min_pinch_update_span_delta( | |
| 30 CommandLine::ForCurrentProcess()->HasSwitch( | |
| 31 switches::kCompensateForUnstablePinchZoom) | |
| 32 ? min_pinch_update_distance_in_pixels() | |
| 33 : 0); | |
| 34 // If this is too small, we currently can get single finger pinch zoom. See | |
| 35 // crbug.com/357237 for details. | |
| 36 set_min_scaling_span_in_pixels(125); | |
| 37 set_min_scaling_touch_major(default_radius() * 2); | |
| 38 set_min_scroll_velocity(30.0f); | |
| 39 set_semi_long_press_time_in_ms(400); | |
| 40 set_show_press_delay_in_ms(150); | |
| 41 set_span_slop(max_touch_move_in_pixels_for_click() * 2); | |
| 42 set_swipe_enabled(true); | |
| 43 set_two_finger_tap_enabled(true); | |
| 44 gfx::Screen* screen = gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE); | |
| 45 // |screen| is sometimes NULL during tests. | |
| 46 if (screen) | |
| 47 set_display(screen->GetPrimaryDisplay()); | |
| 48 } | |
| 49 friend struct DefaultSingletonTraits<GestureConfigurationAura>; | |
| 50 DISALLOW_COPY_AND_ASSIGN(GestureConfigurationAura); | |
| 51 }; | |
|
tdresser
2014/10/22 17:25:18
We use a comment to indicate ending namespaces, an
lanwei
2014/10/23 01:26:18
Done.
| |
| 52 } | |
| 53 | |
| 54 GestureConfiguration* GestureConfiguration::GetInstance() { | |
| 55 return GestureConfigurationAura::GetInstance(); | |
| 56 } | |
| 57 | |
| 58 GestureProvider::Config DefaultGestureProviderConfig() { | |
| 59 return GestureConfigurationAura::GetInstance() | |
| 60 ->DefaultGestureProviderConfig(); | |
| 61 } | |
| 62 | |
| 63 } // namespace ui | |
| OLD | NEW |