| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef UI_BASE_TOUCH_TOUCH_DEVICE_H_ | 5 #ifndef UI_BASE_TOUCH_TOUCH_DEVICE_H_ |
| 6 #define UI_BASE_TOUCH_TOUCH_DEVICE_H_ | 6 #define UI_BASE_TOUCH_TOUCH_DEVICE_H_ |
| 7 | 7 |
| 8 #include "ui/base/ui_base_export.h" | 8 #include "ui/base/ui_base_export.h" |
| 9 | 9 |
| 10 #if defined(OS_ANDROID) | 10 #if defined(OS_ANDROID) |
| 11 #include <jni.h> | 11 #include <jni.h> |
| 12 #endif | 12 #endif |
| 13 | 13 |
| 14 // FIXME: This covers more than just touches. Rename to input_device? |
| 15 // crbug.com/438794 |
| 14 | 16 |
| 15 namespace ui { | 17 namespace ui { |
| 16 | 18 |
| 17 // Returns true if a touch device is available. | 19 // Returns true if a touch device is available. |
| 18 UI_BASE_EXPORT bool IsTouchDevicePresent(); | 20 UI_BASE_EXPORT bool IsTouchDevicePresent(); |
| 19 | 21 |
| 20 // Returns the maximum number of simultaneous touch contacts supported | 22 // Returns the maximum number of simultaneous touch contacts supported |
| 21 // by the device. In the case of devices with multiple digitizers (e.g. | 23 // by the device. In the case of devices with multiple digitizers (e.g. |
| 22 // multiple touchscreens), the value MUST be the maximum of the set of | 24 // multiple touchscreens), the value MUST be the maximum of the set of |
| 23 // maximum supported contacts by each individual digitizer. | 25 // maximum supported contacts by each individual digitizer. |
| 24 // For example, suppose a device has 3 touchscreens, which support 2, 5, | 26 // For example, suppose a device has 3 touchscreens, which support 2, 5, |
| 25 // and 10 simultaneous touch contacts, respectively. This returns 10. | 27 // and 10 simultaneous touch contacts, respectively. This returns 10. |
| 26 // http://www.w3.org/TR/pointerevents/#widl-Navigator-maxTouchPoints | 28 // http://www.w3.org/TR/pointerevents/#widl-Navigator-maxTouchPoints |
| 27 UI_BASE_EXPORT int MaxTouchPoints(); | 29 UI_BASE_EXPORT int MaxTouchPoints(); |
| 28 | 30 |
| 29 // Bit field values indicating available pointer types. Identical to | 31 // Bit field values indicating available pointer types. Identical to |
| 30 // blink::WebSettings::PointerType enums, enforced by compile-time assertions | 32 // blink::WebSettings::PointerType enums, enforced by compile-time assertions |
| 31 // in content/public/common/web_preferences.cc . | 33 // in content/public/common/web_preferences.cc . |
| 34 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.ui.base |
| 35 // GENERATED_JAVA_PREFIX_TO_STRIP: POINTER_TYPE_ |
| 32 enum PointerType { | 36 enum PointerType { |
| 33 POINTER_TYPE_NONE = 1 << 0, | 37 POINTER_TYPE_NONE = 1 << 0, |
| 34 POINTER_TYPE_FIRST = POINTER_TYPE_NONE, | 38 POINTER_TYPE_FIRST = POINTER_TYPE_NONE, |
| 35 POINTER_TYPE_COARSE = 1 << 1, | 39 POINTER_TYPE_COARSE = 1 << 1, |
| 36 POINTER_TYPE_FINE = 1 << 2, | 40 POINTER_TYPE_FINE = 1 << 2, |
| 37 POINTER_TYPE_LAST = POINTER_TYPE_FINE | 41 POINTER_TYPE_LAST = POINTER_TYPE_FINE |
| 38 }; | 42 }; |
| 39 | 43 |
| 40 // Bit field values indicating available hover types. Identical to | 44 // Bit field values indicating available hover types. Identical to |
| 41 // blink::WebSettings::HoverType enums, enforced by compile-time assertions | 45 // blink::WebSettings::HoverType enums, enforced by compile-time assertions |
| 42 // in content/public/common/web_preferences.cc . | 46 // in content/public/common/web_preferences.cc . |
| 47 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.ui.base |
| 48 // GENERATED_JAVA_PREFIX_TO_STRIP: HOVER_TYPE_ |
| 43 enum HoverType { | 49 enum HoverType { |
| 44 HOVER_TYPE_NONE = 1 << 0, | 50 HOVER_TYPE_NONE = 1 << 0, |
| 45 HOVER_TYPE_FIRST = HOVER_TYPE_NONE, | 51 HOVER_TYPE_FIRST = HOVER_TYPE_NONE, |
| 46 HOVER_TYPE_ON_DEMAND = 1 << 1, | 52 HOVER_TYPE_ON_DEMAND = 1 << 1, |
| 47 HOVER_TYPE_HOVER = 1 << 2, | 53 HOVER_TYPE_HOVER = 1 << 2, |
| 48 HOVER_TYPE_LAST = HOVER_TYPE_HOVER | 54 HOVER_TYPE_LAST = HOVER_TYPE_HOVER |
| 49 }; | 55 }; |
| 50 | 56 |
| 57 UI_BASE_EXPORT int GetAvailablePointerTypes(); |
| 58 UI_BASE_EXPORT PointerType GetPrimaryPointerType(); |
| 59 UI_BASE_EXPORT int GetAvailableHoverTypes(); |
| 60 UI_BASE_EXPORT HoverType GetPrimaryHoverType(); |
| 61 |
| 51 #if defined(OS_ANDROID) | 62 #if defined(OS_ANDROID) |
| 52 bool RegisterTouchDeviceAndroid(JNIEnv* env); | 63 bool RegisterTouchDeviceAndroid(JNIEnv* env); |
| 53 #endif | 64 #endif |
| 54 | 65 |
| 55 } // namespace ui | 66 } // namespace ui |
| 56 | 67 |
| 57 #endif // UI_BASE_TOUCH_TOUCH_DEVICE_H_ | 68 #endif // UI_BASE_TOUCH_TOUCH_DEVICE_H_ |
| OLD | NEW |