pointer_device.h 2.7 KB

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