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 3 // found in the LICENSE file. 4 5 #ifndef UI_BASE_POINTER_POINTER_DEVICE_H_ 6 #define UI_BASE_POINTER_POINTER_DEVICE_H_ 7 8 #include <tuple> 9 10 #include "build/build_config.h" 11 #include "ui/base/ui_base_export.h" 12 13 #if defined(OS_ANDROID) 14 #include <jni.h> 15 #endif 16 17 namespace ui { 18 19 enum class TouchScreensAvailability { 20 NONE, // No touch screens are present. 21 ENABLED, // Touch screens are present and enabled. 22 DISABLED, // Touch screens are present and disabled. 23 }; 24 25 UI_BASE_EXPORT TouchScreensAvailability GetTouchScreensAvailability(); 26 27 // Returns the maximum number of simultaneous touch contacts supported 28 // by the device. In the case of devices with multiple digitizers (e.g. 29 // multiple touchscreens), the value MUST be the maximum of the set of 30 // maximum supported contacts by each individual digitizer. 31 // For example, suppose a device has 3 touchscreens, which support 2, 5, 32 // and 10 simultaneous touch contacts, respectively. This returns 10. 33 // http://www.w3.org/TR/pointerevents/#widl-Navigator-maxTouchPoints 34 UI_BASE_EXPORT int MaxTouchPoints(); 35 36 // Bit field values indicating available pointer types. Identical to 37 // blink::PointerType enums, enforced by compile-time assertions in 38 // content/public/common/web_preferences.cc . 39 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.ui.base 40 // GENERATED_JAVA_PREFIX_TO_STRIP: POINTER_TYPE_ 41 enum PointerType { 42 POINTER_TYPE_NONE = 1 << 0, 43 POINTER_TYPE_FIRST = POINTER_TYPE_NONE, 44 POINTER_TYPE_COARSE = 1 << 1, 45 POINTER_TYPE_FINE = 1 << 2, 46 POINTER_TYPE_LAST = POINTER_TYPE_FINE 47 }; 48 49 // Bit field values indicating available hover types. Identical to 50 // blink::HoverType enums, enforced by compile-time assertions in 51 // content/public/common/web_preferences.cc . 52 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.ui.base 53 // GENERATED_JAVA_PREFIX_TO_STRIP: HOVER_TYPE_ 54 enum HoverType { 55 HOVER_TYPE_NONE = 1 << 0, 56 HOVER_TYPE_FIRST = HOVER_TYPE_NONE, 57 HOVER_TYPE_HOVER = 1 << 1, 58 HOVER_TYPE_LAST = HOVER_TYPE_HOVER 59 }; 60 61 int GetAvailablePointerTypes(); 62 int GetAvailableHoverTypes(); 63 UI_BASE_EXPORT std::pair<int, int> GetAvailablePointerAndHoverTypes(); 64 UI_BASE_EXPORT void SetAvailablePointerAndHoverTypesForTesting( 65 int available_pointer_types, 66 int available_hover_types); 67 UI_BASE_EXPORT PointerType GetPrimaryPointerType(int available_pointer_types); 68 UI_BASE_EXPORT HoverType GetPrimaryHoverType(int available_hover_types); 69 70 } // namespace ui 71 72 #endif // UI_BASE_POINTER_POINTER_DEVICE_H_ 73