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