OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/base/touch/touch_device.h" | 5 #include "ui/base/touch/touch_device.h" |
6 | 6 |
| 7 #include "jni/TouchDevice_jni.h" |
| 8 |
7 namespace ui { | 9 namespace ui { |
8 | 10 |
9 bool IsTouchDevicePresent() { | 11 bool IsTouchDevicePresent() { |
10 return true; | 12 return true; |
11 } | 13 } |
12 | 14 |
13 // Looks like the best we can do here is detect 1, 2+, or 5+ by | |
14 // feature detecting: | |
15 // FEATURE_TOUCHSCREEN (1), | |
16 // FEATURE_TOUCHSCREEN_MULTITOUCH (2), | |
17 // FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT (2+), or | |
18 // FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHANDS (5+) | |
19 // | |
20 // Probably start from the biggest and detect down the list until we | |
21 // find one that's supported and return its value. | |
22 int MaxTouchPoints() { | 15 int MaxTouchPoints() { |
23 return kMaxTouchPointsUnknown; | 16 JNIEnv* env = base::android::AttachCurrentThread(); |
| 17 jobject context = base::android::GetApplicationContext(); |
| 18 jint max_touch_points = Java_TouchDevice_maxTouchPoints(env, context); |
| 19 return static_cast<int>(max_touch_points); |
| 20 } |
| 21 |
| 22 bool RegisterTouchDeviceAndroid(JNIEnv* env) { |
| 23 return RegisterNativesImpl(env); |
24 } | 24 } |
25 | 25 |
26 } // namespace ui | 26 } // namespace ui |
OLD | NEW |