| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 = |
| 53 CommandLine::ForCurrentProcess()->HasSwitch( | 53 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 54 switches::kCompensateForUnstablePinchZoom) ? | 54 switches::kCompensateForUnstablePinchZoom) ? |
| 55 GestureConfiguration::min_pinch_update_distance_in_pixels() : 0; | 55 GestureConfiguration::min_pinch_update_distance_in_pixels() : 0; |
| 56 return config; | 56 return config; |
| 57 } | 57 } |
| 58 | 58 |
| 59 } // namespace | 59 } // namespace |
| 60 | 60 |
| 61 GestureProvider::Config DefaultGestureProviderConfig() { | 61 GestureProvider::Config DefaultGestureProviderConfig() { |
| 62 GestureProvider::Config config; | 62 GestureProvider::Config config; |
| 63 gfx::Screen* screen = gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE); | 63 gfx::Screen* screen = gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE); |
| 64 // |screen| is sometimes NULL during tests. | 64 // |screen| is sometimes NULL during tests. |
| 65 if (screen) | 65 if (screen) |
| 66 config.display = screen->GetPrimaryDisplay(); | 66 config.display = screen->GetPrimaryDisplay(); |
| 67 config.gesture_detector_config = DefaultGestureDetectorConfig(); | 67 config.gesture_detector_config = DefaultGestureDetectorConfig(); |
| 68 config.scale_gesture_detector_config = DefaultScaleGestureDetectorConfig(); | 68 config.scale_gesture_detector_config = DefaultScaleGestureDetectorConfig(); |
| 69 config.gesture_begin_end_types_enabled = true; | 69 config.gesture_begin_end_types_enabled = true; |
| 70 // Half the size of the default touch length is a reasonable minimum. | 70 // Half the size of the default touch length is a reasonable minimum. |
| 71 config.min_gesture_bounds_length = GestureConfiguration::default_radius(); | 71 config.min_gesture_bounds_length = GestureConfiguration::default_radius(); |
| 72 return config; | 72 return config; |
| 73 } | 73 } |
| 74 | 74 |
| 75 } // namespace ui | 75 } // namespace ui |
| OLD | NEW |