summaryrefslogtreecommitdiffstats
path: root/content/common/android
diff options
context:
space:
mode:
authorjdduke@chromium.org <jdduke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-10 00:32:58 +0000
committerjdduke@chromium.org <jdduke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-10 00:32:58 +0000
commit2b17b8ab071b17c45b9ebde25e4dfc85c1dc4375 (patch)
tree6b0d82bd96361c1822feceb2a91060e2b064599b /content/common/android
parenta272c9d6d2038c994b4de093464cf53b9d007a09 (diff)
downloadchromium_src-2b17b8ab071b17c45b9ebde25e4dfc85c1dc4375.zip
chromium_src-2b17b8ab071b17c45b9ebde25e4dfc85c1dc4375.tar.gz
chromium_src-2b17b8ab071b17c45b9ebde25e4dfc85c1dc4375.tar.bz2
[Android] Enable touchscreen tap suppression
Further unify fling and tap behavior across platforms by enabling touchscreen tap suppression on Android. Also correct for GestureShowPress deferral on a deferred GestureTapDown BUG=313223,313259 Review URL: https://codereview.chromium.org/67103002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@234147 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/android')
-rw-r--r--content/common/android/common_jni_registrar.cc2
-rw-r--r--content/common/android/view_configuration.cc59
-rw-r--r--content/common/android/view_configuration.h31
3 files changed, 92 insertions, 0 deletions
diff --git a/content/common/android/common_jni_registrar.cc b/content/common/android/common_jni_registrar.cc
index ead0cfe..c9d51e9 100644
--- a/content/common/android/common_jni_registrar.cc
+++ b/content/common/android/common_jni_registrar.cc
@@ -10,6 +10,7 @@
#include "content/common/android/device_telephony_info.h"
#include "content/common/android/hash_set.h"
#include "content/common/android/trace_event_binding.h"
+#include "content/common/android/view_configuration.h"
namespace {
base::android::RegistrationMethod kContentRegisteredMethods[] = {
@@ -18,6 +19,7 @@ base::android::RegistrationMethod kContentRegisteredMethods[] = {
content::DeviceTelephonyInfo::RegisterDeviceTelephonyInfo },
{ "HashSet", content::RegisterHashSet },
{ "TraceEvent", RegisterTraceEvent },
+ { "ViewConfiguration", content::ViewConfiguration::RegisterViewConfiguration }
};
} // namespace
diff --git a/content/common/android/view_configuration.cc b/content/common/android/view_configuration.cc
new file mode 100644
index 0000000..9363ebb
--- /dev/null
+++ b/content/common/android/view_configuration.cc
@@ -0,0 +1,59 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/common/android/view_configuration.h"
+
+#include "base/android/jni_android.h"
+#include "jni/ViewConfiguration_jni.h"
+
+using namespace JNI_ViewConfiguration;
+using base::android::AttachCurrentThread;
+using base::android::GetApplicationContext;
+
+namespace content {
+
+int ViewConfiguration::GetDoubleTapTimeoutInMs() {
+ JNIEnv* env = AttachCurrentThread();
+ return Java_ViewConfiguration_getDoubleTapTimeout(env);
+}
+
+int ViewConfiguration::GetLongPressTimeoutInMs() {
+ JNIEnv* env = AttachCurrentThread();
+ return Java_ViewConfiguration_getLongPressTimeout(env);
+}
+
+int ViewConfiguration::GetTapTimeoutInMs() {
+ JNIEnv* env = AttachCurrentThread();
+ return Java_ViewConfiguration_getTapTimeout(env);
+}
+
+int ViewConfiguration::GetMaximumFlingVelocityInDipsPerSecond() {
+ JNIEnv* env = AttachCurrentThread();
+ return Java_ViewConfiguration_getMaximumFlingVelocity(env);
+}
+
+int ViewConfiguration::GetMinimumFlingVelocityInDipsPerSecond() {
+ JNIEnv* env = AttachCurrentThread();
+ return Java_ViewConfiguration_getMinimumFlingVelocity(env);
+}
+
+int ViewConfiguration::GetMaximumFlingVelocityInPixelsPerSecond() {
+ JNIEnv* env = AttachCurrentThread();
+ ScopedJavaLocalRef<jobject> view =
+ Java_ViewConfiguration_get(env, GetApplicationContext());
+ return Java_ViewConfiguration_getScaledMaximumFlingVelocity(env, view.obj());
+}
+
+int ViewConfiguration::GetMinimumFlingVelocityInPixelsPerSecond() {
+ JNIEnv* env = AttachCurrentThread();
+ ScopedJavaLocalRef<jobject> view =
+ Java_ViewConfiguration_get(env, GetApplicationContext());
+ return Java_ViewConfiguration_getScaledMinimumFlingVelocity(env, view.obj());
+}
+
+bool ViewConfiguration::RegisterViewConfiguration(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
+} // namespace content
diff --git a/content/common/android/view_configuration.h b/content/common/android/view_configuration.h
new file mode 100644
index 0000000..4ac664f
--- /dev/null
+++ b/content/common/android/view_configuration.h
@@ -0,0 +1,31 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_COMMON_ANDROID_VIEW_CONFIGURATION_H_
+#define CONTENT_COMMON_ANDROID_VIEW_CONFIGURATION_H_
+
+#include <jni.h>
+
+namespace content {
+
+// Provides access to Android's ViewConfiguration for gesture-related constants.
+class ViewConfiguration {
+ public:
+ static int GetDoubleTapTimeoutInMs();
+ static int GetLongPressTimeoutInMs();
+ static int GetTapTimeoutInMs();
+
+ static int GetMaximumFlingVelocityInDipsPerSecond();
+ static int GetMinimumFlingVelocityInDipsPerSecond();
+
+ static int GetMaximumFlingVelocityInPixelsPerSecond();
+ static int GetMinimumFlingVelocityInPixelsPerSecond();
+
+ // Registers methods with JNI and returns true if succeeded.
+ static bool RegisterViewConfiguration(JNIEnv* env);
+};
+
+} // namespace content
+
+#endif // CONTENT_COMMON_ANDROID_VIEW_CONFIGURATION_H_