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

Unified Diff: ui/base/touch/touch_device_android.cc

Issue 186943002: Plumbing maxTouchPoints for Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months 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: ui/base/touch/touch_device_android.cc
diff --git a/ui/base/touch/touch_device_android.cc b/ui/base/touch/touch_device_android.cc
index 2b359c0e3dd44e39d669ddd7db8800862342ac9e..1828703291a2cdc979356922eb0b77db7fc1a8ee 100644
--- a/ui/base/touch/touch_device_android.cc
+++ b/ui/base/touch/touch_device_android.cc
@@ -4,23 +4,30 @@
#include "ui/base/touch/touch_device.h"
+#include "jni/TouchDevice_jni.h"
+#include "ui/base/touch/touch_device_android_initialization.h"
Ted C 2014/03/05 21:14:26 hmm...this name is a bit odd to me. I might just
bokan 2014/03/05 22:49:20 Went with the latter.
+
+using namespace base::android;
Ted C 2014/03/05 21:14:26 Since the usage is pretty small, I would leave thi
bokan 2014/03/05 22:49:20 Done.
+
namespace ui {
bool IsTouchDevicePresent() {
return true;
}
-// Looks like the best we can do here is detect 1, 2+, or 5+ by
-// feature detecting:
-// FEATURE_TOUCHSCREEN (1),
-// FEATURE_TOUCHSCREEN_MULTITOUCH (2),
-// FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT (2+), or
-// FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHANDS (5+)
-//
-// Probably start from the biggest and detect down the list until we
-// find one that's supported and return its value.
int MaxTouchPoints() {
- return kMaxTouchPointsUnknown;
+ JNIEnv* env = AttachCurrentThread();
+ DCHECK(env);
Ted C 2014/03/05 21:14:26 Do we DCHECK any other usages of AttachCurrentThre
bokan 2014/03/05 22:49:20 Done.
+
+ jobject context = base::android::GetApplicationContext();
+ DCHECK(context);
+
+ jint max_touch_points = Java_TouchDevice_maxTouchPoints(env, context);
+ return static_cast<int>(max_touch_points);
+}
+
+bool RegisterTouchDeviceAndroid(JNIEnv* env) {
+ return RegisterNativesImpl(env);
}
} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698