accessible/src/mac/Platform.mm

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/src/mac/Platform.mm	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,54 @@
     1.4 +/* -*- Mode: Objective-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 +#import <Cocoa/Cocoa.h>
    1.11 +
    1.12 +#include "Platform.h"
    1.13 +
    1.14 +#include "nsAppShell.h"
    1.15 +
    1.16 +namespace mozilla {
    1.17 +namespace a11y {
    1.18 +
    1.19 +// Mac a11y whitelisting
    1.20 +static bool sA11yShouldBeEnabled = false;
    1.21 +
    1.22 +bool
    1.23 +ShouldA11yBeEnabled()
    1.24 +{
    1.25 +  EPlatformDisabledState disabledState = PlatformDisabledState();
    1.26 +  return (disabledState == ePlatformIsForceEnabled) || ((disabledState == ePlatformIsEnabled) && sA11yShouldBeEnabled);
    1.27 +}
    1.28 +
    1.29 +void
    1.30 +PlatformInit()
    1.31 +{
    1.32 +}
    1.33 +
    1.34 +void
    1.35 +PlatformShutdown()
    1.36 +{
    1.37 +}
    1.38 +
    1.39 +}
    1.40 +}
    1.41 +
    1.42 +@interface GeckoNSApplication(a11y)
    1.43 +-(void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute;
    1.44 +@end
    1.45 +
    1.46 +@implementation GeckoNSApplication(a11y)
    1.47 +
    1.48 +-(void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute
    1.49 +{
    1.50 +  if ([attribute isEqualToString:@"AXEnhancedUserInterface"])
    1.51 +    mozilla::a11y::sA11yShouldBeEnabled = ([value intValue] == 1);
    1.52 +
    1.53 +  return [super accessibilitySetValue:value forAttribute:attribute];
    1.54 +}
    1.55 +
    1.56 +@end
    1.57 +

mercurial