accessible/src/windows/msaa/Compatibility.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     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/. */
     7 #ifndef COMPATIBILITY_MANAGER_H
     8 #define COMPATIBILITY_MANAGER_H
    10 #include <stdint.h>
    12 namespace mozilla {
    13 namespace a11y {
    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); }
    27   /**
    28    * Return true if JAWS mode is enabled.
    29    */
    30   static bool IsJAWS() { return !!(sConsumers & (JAWS | OLDJAWS)); }
    32   /**
    33    * Return true if WE mode is enabled.
    34    */
    35   static bool IsWE() { return !!(sConsumers & WE); }
    37   /**
    38    * Return true if Dolphin mode is enabled.
    39    */
    40   static bool IsDolphin() { return !!(sConsumers & DOLPHIN); }
    42 private:
    43   Compatibility();
    44   Compatibility(const Compatibility&);
    45   Compatibility& operator = (const Compatibility&);
    47   /**
    48    * Initialize compatibility mode. Called by platform (see Platform.h) during
    49    * accessibility initialization.
    50    */
    51   static void Init();
    52   friend void PlatformInit();
    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   };
    72 private:
    73   static uint32_t sConsumers;
    74 };
    76 } // a11y namespace
    77 } // mozilla namespace
    79 #endif

mercurial