accessible/src/windows/msaa/Compatibility.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/src/windows/msaa/Compatibility.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,79 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim: set ts=2 et sw=2 tw=80: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef COMPATIBILITY_MANAGER_H
    1.11 +#define COMPATIBILITY_MANAGER_H
    1.12 +
    1.13 +#include <stdint.h>
    1.14 +
    1.15 +namespace mozilla {
    1.16 +namespace a11y {
    1.17 +
    1.18 +/**
    1.19 + * Used to get compatibility modes. Note, modes are computed at accessibility
    1.20 + * start up time and aren't changed during lifetime.
    1.21 + */
    1.22 +class Compatibility
    1.23 +{
    1.24 +public:
    1.25 +  /**
    1.26 +   * Return true if IAccessible2 disabled.
    1.27 +   */
    1.28 +  static bool IsIA2Off() { return !!(sConsumers & OLDJAWS); }
    1.29 +
    1.30 +  /**
    1.31 +   * Return true if JAWS mode is enabled.
    1.32 +   */
    1.33 +  static bool IsJAWS() { return !!(sConsumers & (JAWS | OLDJAWS)); }
    1.34 +
    1.35 +  /**
    1.36 +   * Return true if WE mode is enabled.
    1.37 +   */
    1.38 +  static bool IsWE() { return !!(sConsumers & WE); }
    1.39 +
    1.40 +  /**
    1.41 +   * Return true if Dolphin mode is enabled.
    1.42 +   */
    1.43 +  static bool IsDolphin() { return !!(sConsumers & DOLPHIN); }
    1.44 +
    1.45 +private:
    1.46 +  Compatibility();
    1.47 +  Compatibility(const Compatibility&);
    1.48 +  Compatibility& operator = (const Compatibility&);
    1.49 +
    1.50 +  /**
    1.51 +   * Initialize compatibility mode. Called by platform (see Platform.h) during
    1.52 +   * accessibility initialization.
    1.53 +   */
    1.54 +  static void Init();
    1.55 +  friend void PlatformInit();
    1.56 +
    1.57 +  /**
    1.58 +   * List of detected consumers of a11y (used for statistics/telemetry and compat)
    1.59 +   */
    1.60 +  enum {
    1.61 +    NVDA = 1 << 0,
    1.62 +    JAWS = 1 << 1,
    1.63 +    OLDJAWS = 1 << 2,
    1.64 +    WE = 1 << 3,
    1.65 +    DOLPHIN = 1 << 4,
    1.66 +    SEROTEK = 1 << 5,
    1.67 +    COBRA = 1 << 6,
    1.68 +    ZOOMTEXT = 1 << 7,
    1.69 +    KAZAGURU = 1 << 8,
    1.70 +    YOUDAO = 1 << 9,
    1.71 +    UNKNOWN = 1 << 10,
    1.72 +    UIAUTOMATION = 1 << 11
    1.73 +  };
    1.74 +
    1.75 +private:
    1.76 +  static uint32_t sConsumers;
    1.77 +};
    1.78 +
    1.79 +} // a11y namespace
    1.80 +} // mozilla namespace
    1.81 +
    1.82 +#endif

mercurial