summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/login/login_utils.cc2
-rw-r--r--chrome/browser/resources/gesture_config.js10
-rw-r--r--chrome/browser/ui/gesture_prefs_observer_factory_aura.cc14
-rw-r--r--chrome/browser/ui/webui/gesture_config_ui.cc13
-rw-r--r--chrome/common/pref_names.cc4
-rw-r--r--chrome/common/pref_names.h2
-rw-r--r--content/browser/renderer_host/tap_suppression_controller_aura.cc64
-rw-r--r--content/public/common/content_switches.cc6
-rw-r--r--content/public/common/content_switches.h2
-rw-r--r--ui/base/gestures/gesture_configuration.cc2
-rw-r--r--ui/base/gestures/gesture_configuration.h20
11 files changed, 75 insertions, 64 deletions
diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc
index 9f51de2..705e7737 100644
--- a/chrome/browser/chromeos/login/login_utils.cc
+++ b/chrome/browser/chromeos/login/login_utils.cc
@@ -817,8 +817,6 @@ std::string LoginUtilsImpl::GetOffTheRecordCommandLine(
::switches::kPpapiFlashVersion,
::switches::kPpapiOutOfProcess,
::switches::kRendererStartupDialog,
- ::switches::kFlingTapSuppressMaxDown,
- ::switches::kFlingTapSuppressMaxGap,
#if defined(USE_XI2_MT)
::switches::kTouchCalibration,
#endif
diff --git a/chrome/browser/resources/gesture_config.js b/chrome/browser/resources/gesture_config.js
index 74607f9..16c60b3 100644
--- a/chrome/browser/resources/gesture_config.js
+++ b/chrome/browser/resources/gesture_config.js
@@ -132,6 +132,16 @@ function GestureConfig() {
/** List of fields used to dynamically build form. **/
var GESTURE_FIELDS = [
{
+ key: 'fling_max_cancel_to_down_time_in_ms',
+ label: 'Maximum Cancel to Down Time for Tap Suppression',
+ units: 'milliseconds',
+ },
+ {
+ key: 'fling_max_tap_gap_time_in_ms',
+ label: 'Maximum Tap Gap Time for Tap Suppression',
+ units: 'milliseconds',
+ },
+ {
key: 'long_press_time_in_seconds',
label: 'Long Press Time',
units: 'seconds'
diff --git a/chrome/browser/ui/gesture_prefs_observer_factory_aura.cc b/chrome/browser/ui/gesture_prefs_observer_factory_aura.cc
index e27a148..a8c9681 100644
--- a/chrome/browser/ui/gesture_prefs_observer_factory_aura.cc
+++ b/chrome/browser/ui/gesture_prefs_observer_factory_aura.cc
@@ -74,6 +74,8 @@ const char* kPrefsToObserve[] = {
prefs::kFlingAccelerationCurveCoefficient1,
prefs::kFlingAccelerationCurveCoefficient2,
prefs::kFlingAccelerationCurveCoefficient3,
+ prefs::kFlingMaxCancelToDownTimeInMs,
+ prefs::kFlingMaxTapGapTimeInMs,
prefs::kFlingVelocityCap,
prefs::kLongPressTimeInSeconds,
prefs::kMaxDistanceForTwoFingerTapInPixels,
@@ -130,6 +132,10 @@ void GesturePrefsObserver::Update() {
prefs_->GetDouble(prefs::kFlingAccelerationCurveCoefficient2));
GestureConfiguration::set_fling_acceleration_curve_coefficients(3,
prefs_->GetDouble(prefs::kFlingAccelerationCurveCoefficient3));
+ GestureConfiguration::set_fling_max_cancel_to_down_time_in_ms(
+ prefs_->GetInteger(prefs::kFlingMaxCancelToDownTimeInMs));
+ GestureConfiguration::set_fling_max_tap_gap_time_in_ms(
+ prefs_->GetInteger(prefs::kFlingMaxTapGapTimeInMs));
GestureConfiguration::set_fling_velocity_cap(
prefs_->GetDouble(prefs::kFlingVelocityCap));
GestureConfiguration::set_long_press_time_in_seconds(
@@ -252,6 +258,14 @@ void GesturePrefsObserverFactoryAura::RegisterUserPrefs(
prefs::kFlingAccelerationCurveCoefficient3,
GestureConfiguration::fling_acceleration_curve_coefficients(3),
PrefServiceSyncable::UNSYNCABLE_PREF);
+ prefs->RegisterIntegerPref(
+ prefs::kFlingMaxCancelToDownTimeInMs,
+ GestureConfiguration::fling_max_cancel_to_down_time_in_ms(),
+ PrefServiceSyncable::UNSYNCABLE_PREF);
+ prefs->RegisterIntegerPref(
+ prefs::kFlingMaxTapGapTimeInMs,
+ GestureConfiguration::fling_max_tap_gap_time_in_ms(),
+ PrefServiceSyncable::UNSYNCABLE_PREF);
prefs->RegisterDoublePref(
prefs::kFlingVelocityCap,
GestureConfiguration::fling_velocity_cap(),
diff --git a/chrome/browser/ui/webui/gesture_config_ui.cc b/chrome/browser/ui/webui/gesture_config_ui.cc
index 8f90f0d..6797789 100644
--- a/chrome/browser/ui/webui/gesture_config_ui.cc
+++ b/chrome/browser/ui/webui/gesture_config_ui.cc
@@ -108,6 +108,17 @@ void GestureConfigUI::SetPreferenceValue(const base::ListValue* args) {
Profile* profile = Profile::FromWebUI(web_ui());
PrefService* prefs = profile->GetPrefs();
- prefs->SetDouble(pref_name.c_str(), value);
+ const PrefService::Preference* pref =
+ prefs->FindPreference(pref_name.c_str());
+ switch (pref->GetType()) {
+ case base::Value::TYPE_INTEGER:
+ prefs->SetInteger(pref_name.c_str(), static_cast<int>(value));
+ break;
+ case base::Value::TYPE_DOUBLE:
+ prefs->SetDouble(pref_name.c_str(), value);
+ break;
+ default:
+ NOTREACHED();
+ }
}
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc
index e4474d8..174bb08 100644
--- a/chrome/common/pref_names.cc
+++ b/chrome/common/pref_names.cc
@@ -2142,6 +2142,10 @@ const char kShowLogoutButtonInTray[] = "show_logout_button_in_tray";
// kShelfAutoHideBehavior.
const char kShelfPreferences[] = "shelf_preferences";
+const char kFlingMaxCancelToDownTimeInMs[] =
+ "gesture.fling_max_cancel_to_down_time_in_ms";
+const char kFlingMaxTapGapTimeInMs[] =
+ "gesture.fling_max_tap_gap_time_in_ms";
const char kFlingVelocityCap[] = "gesture.fling_velocity_cap";
const char kLongPressTimeInSeconds[] =
"gesture.long_press_time_in_seconds";
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h
index bb9f352..77fab57 100644
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -777,6 +777,8 @@ extern const char kPinnedLauncherApps[];
extern const char kShowLogoutButtonInTray[];
extern const char kShelfPreferences[];
+extern const char kFlingMaxCancelToDownTimeInMs[];
+extern const char kFlingMaxTapGapTimeInMs[];
extern const char kFlingVelocityCap[];
extern const char kLongPressTimeInSeconds[];
extern const char kMaxDistanceBetweenTapsForDoubleTap[];
diff --git a/content/browser/renderer_host/tap_suppression_controller_aura.cc b/content/browser/renderer_host/tap_suppression_controller_aura.cc
index 0f99f5c..7d7c264 100644
--- a/content/browser/renderer_host/tap_suppression_controller_aura.cc
+++ b/content/browser/renderer_host/tap_suppression_controller_aura.cc
@@ -10,51 +10,7 @@
#include "base/string_number_conversions.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/public/common/content_switches.h"
-
-namespace {
-
-// Default maxium time between a mousedown/mouseup pair that is considered to
-// be a suppressable tap.
-static const int kMaxiumTapGapTimeMs = 200;
-
-// Default maximum time between a GestureFlingCancel and a mousedown such that
-// the mousedown is considered associated with the cancel event.
-static const int kMaxiumCancelToDownTimeMs = 400;
-
-// Sets |*value| to |switchKey| if it exists or sets it to |defaultValue|.
-static void GetFlingParamHelper(int* value, int defaultValue,
- const char switchKey[]) {
- if (*value < 0) {
- *value = defaultValue;
- CommandLine* command_line = CommandLine::ForCurrentProcess();
- std::string command_line_param =
- command_line->GetSwitchValueASCII(switchKey);
- if (!command_line_param.empty()) {
- int v;
- if (base::StringToInt(command_line_param, &v))
- *value = static_cast<int>(v);
- }
- DCHECK_GT(*value, 0);
- }
-}
-
-static int GetMaxiumTapGapTimeMs() {
- static int maximum_tap_gap_time_ms = -1;
- GetFlingParamHelper(&maximum_tap_gap_time_ms,
- kMaxiumTapGapTimeMs,
- switches::kFlingTapSuppressMaxGap);
- return maximum_tap_gap_time_ms;
-}
-
-static int GetMaxiumCancelToDownTimeMs() {
- static int maximum_cancel_to_down_time_ms = -1;
- GetFlingParamHelper(&maximum_cancel_to_down_time_ms,
- kMaxiumCancelToDownTimeMs,
- switches::kFlingTapSuppressMaxDown);
- return maximum_cancel_to_down_time_ms;
-}
-
-} // namespace
+#include "ui/base/gestures/gesture_configuration.h"
namespace content {
@@ -86,11 +42,12 @@ bool TapSuppressionController::ShouldDeferMouseDown(
case NOTHING:
return false;
case GFC_IN_PROGRESS:
- mouse_down_timer_.Start(FROM_HERE,
- base::TimeDelta::FromMilliseconds(
- GetMaxiumTapGapTimeMs()),
- this,
- &TapSuppressionController::MouseDownTimerExpired);
+ mouse_down_timer_.Start(
+ FROM_HERE,
+ base::TimeDelta::FromMilliseconds(
+ ui::GestureConfiguration::fling_max_tap_gap_time_in_ms()),
+ this,
+ &TapSuppressionController::MouseDownTimerExpired);
stashed_mouse_down_ = event;
state_ = MD_STASHED;
return true;
@@ -100,11 +57,12 @@ bool TapSuppressionController::ShouldDeferMouseDown(
return false;
case LAST_CANCEL_STOPPED_FLING:
if ((base::TimeTicks::Now() - fling_cancel_time_).InMilliseconds()
- < GetMaxiumCancelToDownTimeMs()) {
+ < ui::GestureConfiguration::fling_max_cancel_to_down_time_in_ms()) {
state_ = MD_STASHED;
- mouse_down_timer_.Start(FROM_HERE,
+ mouse_down_timer_.Start(
+ FROM_HERE,
base::TimeDelta::FromMilliseconds(
- GetMaxiumTapGapTimeMs()),
+ ui::GestureConfiguration::fling_max_tap_gap_time_in_ms()),
this,
&TapSuppressionController::MouseDownTimerExpired);
stashed_mouse_down_ = event;
diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc
index cba5f0a..aaa236d 100644
--- a/content/public/common/content_switches.cc
+++ b/content/public/common/content_switches.cc
@@ -748,12 +748,6 @@ const char kDisableCarbonInterposing[] = "disable-carbon-interposing";
const char kDisableSoftwareRasterizer[] = "disable-software-rasterizer";
#if defined(USE_AURA)
-// Configures the time after a GestureFlingCancel in which taps are cancelled.
-extern const char kFlingTapSuppressMaxDown[] = "fling-tap-suppress-max-down";
-
-// Maximum time between mousedown and mouseup to be considered a tap.
-extern const char kFlingTapSuppressMaxGap[] = "fling-tap-suppress-max-gap";
-
// Forces usage of the test compositor. Needed to run ui tests on bots.
extern const char kTestCompositor[] = "test-compositor";
#endif
diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h
index 6d3d795..d679b07 100644
--- a/content/public/common/content_switches.h
+++ b/content/public/common/content_switches.h
@@ -240,8 +240,6 @@ extern const char kDisableCarbonInterposing[];
#endif
#if defined(USE_AURA)
-CONTENT_EXPORT extern const char kFlingTapSuppressMaxDown[];
-CONTENT_EXPORT extern const char kFlingTapSuppressMaxGap[];
CONTENT_EXPORT extern const char kTestCompositor[];
#endif
diff --git a/ui/base/gestures/gesture_configuration.cc b/ui/base/gestures/gesture_configuration.cc
index ccd7958..0689921 100644
--- a/ui/base/gestures/gesture_configuration.cc
+++ b/ui/base/gestures/gesture_configuration.cc
@@ -7,6 +7,8 @@
namespace ui {
int GestureConfiguration::default_radius_ = 15;
+int GestureConfiguration::fling_max_cancel_to_down_time_in_ms_ = 400;
+int GestureConfiguration::fling_max_tap_gap_time_in_ms_ = 200;
float GestureConfiguration::fling_velocity_cap_ = 17000.0f;
double GestureConfiguration::long_press_time_in_seconds_ = 1.0;
double GestureConfiguration::semi_long_press_time_in_seconds_ = 0.4;
diff --git a/ui/base/gestures/gesture_configuration.h b/ui/base/gestures/gesture_configuration.h
index db46d95..525ee3b 100644
--- a/ui/base/gestures/gesture_configuration.h
+++ b/ui/base/gestures/gesture_configuration.h
@@ -26,6 +26,18 @@ class UI_EXPORT GestureConfiguration {
return default_radius_;
}
static void set_default_radius(int radius) { default_radius_ = radius; }
+ static int fling_max_cancel_to_down_time_in_ms() {
+ return fling_max_cancel_to_down_time_in_ms_;
+ }
+ static void set_fling_max_cancel_to_down_time_in_ms(int val) {
+ fling_max_cancel_to_down_time_in_ms_ = val;
+ }
+ static int fling_max_tap_gap_time_in_ms() {
+ return fling_max_tap_gap_time_in_ms_;
+ }
+ static void set_fling_max_tap_gap_time_in_ms(int val) {
+ fling_max_tap_gap_time_in_ms_ = val;
+ }
static double long_press_time_in_seconds() {
return long_press_time_in_seconds_;
}
@@ -186,6 +198,14 @@ class UI_EXPORT GestureConfiguration {
// forming an ET_GESTURE_TAP event.
static int max_radius_;
+ // Maximum time between a GestureFlingCancel and a mousedown such that the
+ // mousedown is considered associated with the cancel event.
+ static int fling_max_cancel_to_down_time_in_ms_;
+
+ // Maxium time between a mousedown/mouseup pair that is considered to be a
+ // suppressable tap.
+ static int fling_max_tap_gap_time_in_ms_;
+
static double long_press_time_in_seconds_;
static double semi_long_press_time_in_seconds_;
static double max_seconds_between_double_click_;