| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 } | 45 } |
| 46 | 46 |
| 47 ScaleGestureDetector::Config DefaultScaleGestureDetectorConfig() { | 47 ScaleGestureDetector::Config DefaultScaleGestureDetectorConfig() { |
| 48 ScaleGestureDetector::Config config; | 48 ScaleGestureDetector::Config config; |
| 49 double min_pinch_update_distance = | 49 double min_pinch_update_distance = |
| 50 CommandLine::ForCurrentProcess()->HasSwitch( | 50 CommandLine::ForCurrentProcess()->HasSwitch( |
| 51 switches::kCompensateForUnstablePinchZoom) | 51 switches::kCompensateForUnstablePinchZoom) |
| 52 ? GestureConfiguration::min_pinch_update_distance_in_pixels() | 52 ? GestureConfiguration::min_pinch_update_distance_in_pixels() |
| 53 : 0; | 53 : 0; |
| 54 | 54 |
| 55 config.gesture_detector_config = DefaultGestureDetectorConfig(); | 55 config.span_slop = |
| 56 GestureConfiguration::max_touch_move_in_pixels_for_click() * 2; |
| 56 config.min_scaling_touch_major = GestureConfiguration::default_radius() * 2; | 57 config.min_scaling_touch_major = GestureConfiguration::default_radius() * 2; |
| 57 config.min_scaling_span = GestureConfiguration::min_scaling_span_in_pixels(); | 58 config.min_scaling_span = GestureConfiguration::min_scaling_span_in_pixels(); |
| 58 config.min_pinch_update_span_delta = min_pinch_update_distance; | 59 config.min_pinch_update_span_delta = min_pinch_update_distance; |
| 59 return config; | 60 return config; |
| 60 } | 61 } |
| 61 | 62 |
| 62 } // namespace | 63 } // namespace |
| 63 | 64 |
| 64 GestureProvider::Config DefaultGestureProviderConfig() { | 65 GestureProvider::Config DefaultGestureProviderConfig() { |
| 65 GestureProvider::Config config; | 66 GestureProvider::Config config; |
| 66 gfx::Screen* screen = gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE); | 67 gfx::Screen* screen = gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE); |
| 67 // |screen| is sometimes NULL during tests. | 68 // |screen| is sometimes NULL during tests. |
| 68 if (screen) | 69 if (screen) |
| 69 config.display = screen->GetPrimaryDisplay(); | 70 config.display = screen->GetPrimaryDisplay(); |
| 70 config.gesture_detector_config = DefaultGestureDetectorConfig(); | 71 config.gesture_detector_config = DefaultGestureDetectorConfig(); |
| 71 config.scale_gesture_detector_config = DefaultScaleGestureDetectorConfig(); | 72 config.scale_gesture_detector_config = DefaultScaleGestureDetectorConfig(); |
| 72 config.gesture_begin_end_types_enabled = true; | 73 config.gesture_begin_end_types_enabled = true; |
| 73 // Half the size of the default touch length is a reasonable minimum. | 74 // Half the size of the default touch length is a reasonable minimum. |
| 74 config.min_gesture_bounds_length = GestureConfiguration::default_radius(); | 75 config.min_gesture_bounds_length = GestureConfiguration::default_radius(); |
| 75 return config; | 76 return config; |
| 76 } | 77 } |
| 77 | 78 |
| 78 } // namespace ui | 79 } // namespace ui |
| OLD | NEW |