Chromium Code Reviews| 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 #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.
| |
| 9 | |
| 10 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.
| |
| 11 | |
| 7 namespace ui { | 12 namespace ui { |
| 8 | 13 |
| 9 bool IsTouchDevicePresent() { | 14 bool IsTouchDevicePresent() { |
| 10 return true; | 15 return true; |
| 11 } | 16 } |
| 12 | 17 |
| 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() { | 18 int MaxTouchPoints() { |
| 23 return kMaxTouchPointsUnknown; | 19 JNIEnv* env = AttachCurrentThread(); |
| 20 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.
| |
| 21 | |
| 22 jobject context = base::android::GetApplicationContext(); | |
| 23 DCHECK(context); | |
| 24 | |
| 25 jint max_touch_points = Java_TouchDevice_maxTouchPoints(env, context); | |
| 26 return static_cast<int>(max_touch_points); | |
| 27 } | |
| 28 | |
| 29 bool RegisterTouchDeviceAndroid(JNIEnv* env) { | |
| 30 return RegisterNativesImpl(env); | |
| 24 } | 31 } |
| 25 | 32 |
| 26 } // namespace ui | 33 } // namespace ui |
| OLD | NEW |