OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/events/gesture_detection/gesture_config_helper.h" | 5 #include "ui/events/gesture_detection/gesture_config_helper.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "ui/events/event_switches.h" | 10 #include "ui/events/event_switches.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 return config; | 43 return config; |
44 } | 44 } |
45 | 45 |
46 ScaleGestureDetector::Config DefaultScaleGestureDetectorConfig() { | 46 ScaleGestureDetector::Config DefaultScaleGestureDetectorConfig() { |
47 ScaleGestureDetector::Config config; | 47 ScaleGestureDetector::Config config; |
48 config.span_slop = | 48 config.span_slop = |
49 GestureConfiguration::max_touch_move_in_pixels_for_click() * 2; | 49 GestureConfiguration::max_touch_move_in_pixels_for_click() * 2; |
50 config.min_scaling_touch_major = GestureConfiguration::default_radius() * 2; | 50 config.min_scaling_touch_major = GestureConfiguration::default_radius() * 2; |
51 config.min_scaling_span = GestureConfiguration::min_scaling_span_in_pixels(); | 51 config.min_scaling_span = GestureConfiguration::min_scaling_span_in_pixels(); |
52 config.min_pinch_update_span_delta = | 52 config.min_pinch_update_span_delta = 0; |
53 base::CommandLine::ForCurrentProcess()->HasSwitch( | |
54 switches::kCompensateForUnstablePinchZoom) ? | |
55 GestureConfiguration::min_pinch_update_distance_in_pixels() : 0; | |
56 return config; | 53 return config; |
57 } | 54 } |
58 | 55 |
59 } // namespace | 56 } // namespace |
60 | 57 |
61 GestureProvider::Config DefaultGestureProviderConfig() { | 58 GestureProvider::Config DefaultGestureProviderConfig() { |
62 GestureProvider::Config config; | 59 GestureProvider::Config config; |
63 gfx::Screen* screen = gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE); | 60 gfx::Screen* screen = gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE); |
64 // |screen| is sometimes NULL during tests. | 61 // |screen| is sometimes NULL during tests. |
65 if (screen) | 62 if (screen) |
66 config.display = screen->GetPrimaryDisplay(); | 63 config.display = screen->GetPrimaryDisplay(); |
67 config.gesture_detector_config = DefaultGestureDetectorConfig(); | 64 config.gesture_detector_config = DefaultGestureDetectorConfig(); |
68 config.scale_gesture_detector_config = DefaultScaleGestureDetectorConfig(); | 65 config.scale_gesture_detector_config = DefaultScaleGestureDetectorConfig(); |
69 config.gesture_begin_end_types_enabled = true; | 66 config.gesture_begin_end_types_enabled = true; |
70 // Half the size of the default touch length is a reasonable minimum. | 67 // Half the size of the default touch length is a reasonable minimum. |
71 config.min_gesture_bounds_length = GestureConfiguration::default_radius(); | 68 config.min_gesture_bounds_length = GestureConfiguration::default_radius(); |
72 return config; | 69 return config; |
73 } | 70 } |
74 | 71 |
75 } // namespace ui | 72 } // namespace ui |
OLD | NEW |