michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef COMPATIBILITY_MANAGER_H michael@0: #define COMPATIBILITY_MANAGER_H michael@0: michael@0: #include michael@0: michael@0: namespace mozilla { michael@0: namespace a11y { michael@0: michael@0: /** michael@0: * Used to get compatibility modes. Note, modes are computed at accessibility michael@0: * start up time and aren't changed during lifetime. michael@0: */ michael@0: class Compatibility michael@0: { michael@0: public: michael@0: /** michael@0: * Return true if IAccessible2 disabled. michael@0: */ michael@0: static bool IsIA2Off() { return !!(sConsumers & OLDJAWS); } michael@0: michael@0: /** michael@0: * Return true if JAWS mode is enabled. michael@0: */ michael@0: static bool IsJAWS() { return !!(sConsumers & (JAWS | OLDJAWS)); } michael@0: michael@0: /** michael@0: * Return true if WE mode is enabled. michael@0: */ michael@0: static bool IsWE() { return !!(sConsumers & WE); } michael@0: michael@0: /** michael@0: * Return true if Dolphin mode is enabled. michael@0: */ michael@0: static bool IsDolphin() { return !!(sConsumers & DOLPHIN); } michael@0: michael@0: private: michael@0: Compatibility(); michael@0: Compatibility(const Compatibility&); michael@0: Compatibility& operator = (const Compatibility&); michael@0: michael@0: /** michael@0: * Initialize compatibility mode. Called by platform (see Platform.h) during michael@0: * accessibility initialization. michael@0: */ michael@0: static void Init(); michael@0: friend void PlatformInit(); michael@0: michael@0: /** michael@0: * List of detected consumers of a11y (used for statistics/telemetry and compat) michael@0: */ michael@0: enum { michael@0: NVDA = 1 << 0, michael@0: JAWS = 1 << 1, michael@0: OLDJAWS = 1 << 2, michael@0: WE = 1 << 3, michael@0: DOLPHIN = 1 << 4, michael@0: SEROTEK = 1 << 5, michael@0: COBRA = 1 << 6, michael@0: ZOOMTEXT = 1 << 7, michael@0: KAZAGURU = 1 << 8, michael@0: YOUDAO = 1 << 9, michael@0: UNKNOWN = 1 << 10, michael@0: UIAUTOMATION = 1 << 11 michael@0: }; michael@0: michael@0: private: michael@0: static uint32_t sConsumers; michael@0: }; michael@0: michael@0: } // a11y namespace michael@0: } // mozilla namespace michael@0: michael@0: #endif