From f6855a0a211cadb37c953fe585405fb6d4ee02ba Mon Sep 17 00:00:00 2001 From: "dtseng@chromium.org" Date: Tue, 3 May 2011 19:36:38 +0000 Subject: Modify screen reader detection to use the AXEnhancedUserInterface attribute set on AXApplication when VoiceOver's turned on. This gives us the ability to turn on ax even after a render widget host has started. BUG=none TEST=manually with VoiceOver. Launch Chrome, VoiceOver, windows, tabs (permuted order) and verify that ax is on. This sometimes required navigation to a different page or efreshing the current page. Review URL: http://codereview.chromium.org/6909013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83940 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/chrome_browser_application_mac.mm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'chrome/browser/chrome_browser_application_mac.mm') diff --git a/chrome/browser/chrome_browser_application_mac.mm b/chrome/browser/chrome_browser_application_mac.mm index 7ba8cda..745e0ab 100644 --- a/chrome/browser/chrome_browser_application_mac.mm +++ b/chrome/browser/chrome_browser_application_mac.mm @@ -9,9 +9,13 @@ #import "base/memory/scoped_nsobject.h" #import "base/sys_string_conversions.h" #import "chrome/app/breakpad_mac.h" +#include "chrome/browser/accessibility/browser_accessibility_state.h" #import "chrome/browser/app_controller_mac.h" +#include "chrome/browser/ui/browser_list.h" #import "chrome/browser/ui/cocoa/objc_method_swizzle.h" #import "chrome/browser/ui/cocoa/objc_zombie.h" +#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "content/browser/renderer_host/render_view_host.h" // The implementation of NSExceptions break various assumptions in the // Chrome code. This category defines a replacement for @@ -384,4 +388,21 @@ BOOL SwizzleNSExceptionInit() { [super reportException:anException]; } +- (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute { + if ([attribute isEqualToString:@"AXEnhancedUserInterface"] && + [value intValue] == 1) { + BrowserAccessibilityState::GetInstance()->OnScreenReaderDetected(); + for (TabContentsIterator it; + !it.done(); + ++it) { + if (TabContentsWrapper* contents = *it) { + if (RenderViewHost* rvh = contents->render_view_host()) { + rvh->EnableRendererAccessibility(); + } + } + } + } + return [super accessibilitySetValue:value forAttribute:attribute]; +} + @end -- cgit v1.1