Compatibility.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef COMPATIBILITY_MANAGER_H
  6. #define COMPATIBILITY_MANAGER_H
  7. #include <stdint.h>
  8. namespace mozilla {
  9. namespace a11y {
  10. /**
  11. * Used to get compatibility modes. Note, modes are computed at accessibility
  12. * start up time and aren't changed during lifetime.
  13. */
  14. class Compatibility
  15. {
  16. public:
  17. /**
  18. * Return true if IAccessible2 disabled.
  19. */
  20. static bool IsIA2Off() { return !!(sConsumers & OLDJAWS); }
  21. /**
  22. * Return true if JAWS mode is enabled.
  23. */
  24. static bool IsJAWS() { return !!(sConsumers & (JAWS | OLDJAWS)); }
  25. /**
  26. * Return true if WE mode is enabled.
  27. */
  28. static bool IsWE() { return !!(sConsumers & WE); }
  29. /**
  30. * Return true if Dolphin mode is enabled.
  31. */
  32. static bool IsDolphin() { return !!(sConsumers & DOLPHIN); }
  33. private:
  34. Compatibility();
  35. Compatibility(const Compatibility&);
  36. Compatibility& operator = (const Compatibility&);
  37. /**
  38. * Initialize compatibility mode. Called by platform (see Platform.h) during
  39. * accessibility initialization.
  40. */
  41. static void Init();
  42. friend void PlatformInit();
  43. /**
  44. * List of detected consumers of a11y (used for statistics/telemetry and compat)
  45. */
  46. enum {
  47. NVDA = 1 << 0,
  48. JAWS = 1 << 1,
  49. OLDJAWS = 1 << 2,
  50. WE = 1 << 3,
  51. DOLPHIN = 1 << 4,
  52. SEROTEK = 1 << 5,
  53. COBRA = 1 << 6,
  54. ZOOMTEXT = 1 << 7,
  55. KAZAGURU = 1 << 8,
  56. YOUDAO = 1 << 9,
  57. UNKNOWN = 1 << 10,
  58. UIAUTOMATION = 1 << 11
  59. };
  60. private:
  61. static uint32_t sConsumers;
  62. };
  63. } // a11y namespace
  64. } // mozilla namespace
  65. #endif