accessible/mac/Platform.mm
author Keita Mimura <k-mimura@onu.edu>
Tue, 07 Apr 2015 11:35:38 -0700
changeset 238128 af2151f856fbfe2391827c9d019dd661401bc4a5
parent 223876 5b5517af41232739241566feb3aa17fdee2f3812
child 244133 e5649b9714d1c08effc7dd8e10598c8fe931f0ea
permissions -rw-r--r--
Bug 1137234 - Make middle clicks on search suggestions on about:home, about:newtab open search results in a background tab. r=adw

/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#import <Cocoa/Cocoa.h>

#include "Platform.h"

#include "nsAppShell.h"

namespace mozilla {
namespace a11y {

// Mac a11y whitelisting
static bool sA11yShouldBeEnabled = false;

bool
ShouldA11yBeEnabled()
{
  EPlatformDisabledState disabledState = PlatformDisabledState();
  return (disabledState == ePlatformIsForceEnabled) || ((disabledState == ePlatformIsEnabled) && sA11yShouldBeEnabled);
}

void
PlatformInit()
{
}

void
PlatformShutdown()
{
}

void
ProxyCreated(ProxyAccessible*, uint32_t)
{
}

void
ProxyDestroyed(ProxyAccessible*)
{
}

void
ProxyEvent(ProxyAccessible*, uint32_t)
{
}
}
}

@interface GeckoNSApplication(a11y)
-(void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute;
@end

@implementation GeckoNSApplication(a11y)

-(void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute
{
  if ([attribute isEqualToString:@"AXEnhancedUserInterface"])
    mozilla::a11y::sA11yShouldBeEnabled = ([value intValue] == 1);

  return [super accessibilitySetValue:value forAttribute:attribute];
}

@end