Chromium Code Reviews| Index: content/browser/renderer_host/input/touch_emulator.cc |
| diff --git a/content/browser/renderer_host/input/touch_emulator.cc b/content/browser/renderer_host/input/touch_emulator.cc |
| index 4d28e062322f0f3d9147d991a48d807a7fe3cf05..1536009f5092bbace91ad06f04b96e7ce90eec7b 100644 |
| --- a/content/browser/renderer_host/input/touch_emulator.cc |
| +++ b/content/browser/renderer_host/input/touch_emulator.cc |
| @@ -27,11 +27,10 @@ namespace content { |
| namespace { |
| -ui::GestureProvider::Config GetGestureProviderConfig() { |
| - // TODO(dgozman): Use different configs to emulate mobile/desktop as |
| - // requested by renderer, crbug/425586. |
| - ui::GestureProvider::Config config = ui::GetGestureProviderConfig( |
| - ui::GestureProviderConfigType::GENERIC_MOBILE); |
| +ui::GestureProvider::Config GetEmulatorGestureProviderConfig( |
| + ui::GestureProviderConfigType config_type) { |
| + ui::GestureProvider::Config config = |
| + ui::GetGestureProviderConfig(config_type); |
| config.gesture_begin_end_types_enabled = false; |
| config.gesture_detector_config.swipe_enabled = false; |
| config.gesture_detector_config.two_finger_tap_enabled = false; |
| @@ -46,6 +45,8 @@ const double kMouseMoveDropIntervalSeconds = 5.f / 1000; |
| TouchEmulator::TouchEmulator(TouchEmulatorClient* client) |
| : client_(client), |
| + gesture_provider_config_type_( |
| + ui::GestureProviderConfigType::CURRENT_PLATFORM), |
| emulated_stream_active_sequence_count_(0), |
| native_stream_active_sequence_count_(0) { |
| DCHECK(client_); |
| @@ -84,17 +85,16 @@ void TouchEmulator::ResetState() { |
| pinch_gesture_active_ = false; |
| } |
| -void TouchEmulator::Enable() { |
| - if (!enabled()) { |
| +void TouchEmulator::Enable(ui::GestureProviderConfigType config_type) { |
| + if (!gesture_provider_ || gesture_provider_config_type_ != config_type) { |
|
dgozman
2015/01/15 11:07:11
I decided to be a little safer here and not recrea
|
| + gesture_provider_config_type_ = config_type; |
| gesture_provider_.reset(new ui::FilteredGestureProvider( |
| - GetGestureProviderConfig(), this)); |
| + GetEmulatorGestureProviderConfig(config_type), this)); |
| // TODO(dgozman): Use synthetic secondary touch to support multi-touch. |
| gesture_provider_->SetMultiTouchZoomSupportEnabled(false); |
| // TODO(dgozman): Enable double tap if requested by the renderer. |
| // TODO(dgozman): Don't break double-tap-based pinch with shift handling. |
| gesture_provider_->SetDoubleTapSupportForPlatformEnabled(false); |
| - |
| - ResetState(); |
| } |
| UpdateCursor(); |
| } |
| @@ -106,6 +106,7 @@ void TouchEmulator::Disable() { |
| UpdateCursor(); |
| CancelTouch(); |
| gesture_provider_.reset(); |
| + ResetState(); |
| } |
| gfx::SizeF TouchEmulator::InitCursorFromResource( |