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