Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1020)

Unified Diff: content/browser/renderer_host/input/touch_emulator.cc

Issue 821223002: Pass gesture detector config type when enabling touch emulator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@touch-emulator-enabled
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 e398e0ed38e157d5e6aa075008e793fcd46c7748..5a7e4cd0f9c6b8b1f585505aa4068b7bae683430 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;
@@ -84,18 +83,14 @@ void TouchEmulator::ResetState() {
pinch_gesture_active_ = false;
}
-void TouchEmulator::Enable() {
- if (!gesture_provider_) {
- gesture_provider_.reset(new ui::FilteredGestureProvider(
- GetGestureProviderConfig(), 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();
- }
+void TouchEmulator::Enable(ui::GestureProviderConfigType config_type) {
+ gesture_provider_.reset(new ui::FilteredGestureProvider(
jdduke (slow) 2014/12/30 18:13:00 I'm a little concerned about repeated enables (wit
dgozman 2015/01/14 14:00:23 Yeah, but what else can we do? With this code, ren
+ 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);
UpdateCursor();
}
@@ -106,6 +101,7 @@ void TouchEmulator::Disable() {
UpdateCursor();
CancelTouch();
gesture_provider_.reset();
+ ResetState();
}
gfx::SizeF TouchEmulator::InitCursorFromResource(

Powered by Google App Engine
This is Rietveld 408576698