summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-28 21:40:05 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-28 21:40:05 +0000
commitf6deb01344e0f41850f90298ab055cd1a1370018 (patch)
tree624316ded56c207e7e02781e9dd96f4c9ba31d40
parentc3df2b248dabeec03a9a208a703cd5509ce1e40c (diff)
downloadchromium_src-f6deb01344e0f41850f90298ab055cd1a1370018.zip
chromium_src-f6deb01344e0f41850f90298ab055cd1a1370018.tar.gz
chromium_src-f6deb01344e0f41850f90298ab055cd1a1370018.tar.bz2
Cleaning up the tab accessibility model.
BUG=http://crbug.com/28286 TEST=As in bug Review URL: http://codereview.chromium.org/519012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35310 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/cocoa/hover_close_button.mm8
-rw-r--r--chrome/browser/cocoa/tab_view.mm38
2 files changed, 46 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/hover_close_button.mm b/chrome/browser/cocoa/hover_close_button.mm
index 3c06f7d..2d974d7 100644
--- a/chrome/browser/cocoa/hover_close_button.mm
+++ b/chrome/browser/cocoa/hover_close_button.mm
@@ -4,7 +4,9 @@
#import "hover_close_button.h"
+#include "app/l10n_util.h"
#include "base/nsimage_cache_mac.h"
+#include "grit/generated_resources.h"
namespace {
@@ -17,6 +19,12 @@ const NSString* kHoverImageString = @"close_bar_h.pdf";
- (void)awakeFromNib {
[self setTrackingEnabled:YES];
+
+ // Set accessibility description.
+ NSString* description = l10n_util::GetNSStringWithFixup(IDS_ACCNAME_CLOSE);
+ [[self cell]
+ accessibilitySetOverrideValue:description
+ forAttribute:NSAccessibilityDescriptionAttribute];
}
- (void)dealloc {
diff --git a/chrome/browser/cocoa/tab_view.mm b/chrome/browser/cocoa/tab_view.mm
index 3432908..0ad8c8c 100644
--- a/chrome/browser/cocoa/tab_view.mm
+++ b/chrome/browser/cocoa/tab_view.mm
@@ -804,10 +804,48 @@ const CGFloat kRapidCloseDist = 2.5;
return [parentActions arrayByAddingObject:NSAccessibilityPressAction];
}
+- (NSArray*)accessibilityAttributeNames {
+ NSMutableArray* attributes =
+ [[super accessibilityAttributeNames] mutableCopy];
+ [attributes addObject:NSAccessibilityTitleAttribute];
+ [attributes addObject:NSAccessibilityEnabledAttribute];
+
+ return attributes;
+}
+
+- (BOOL)accessibilityIsAttributeSettable:(NSString*)attribute {
+ if ([attribute isEqual:NSAccessibilityTitleAttribute])
+ return NO;
+
+ if ([attribute isEqual:NSAccessibilityEnabledAttribute])
+ return NO;
+
+ return [super accessibilityIsAttributeSettable:attribute];
+}
+
- (id)accessibilityAttributeValue:(NSString*)attribute {
if ([attribute isEqual:NSAccessibilityRoleAttribute])
return NSAccessibilityButtonRole;
+ if ([attribute isEqual:NSAccessibilityTitleAttribute])
+ return [controller_ title];
+
+ if ([attribute isEqual:NSAccessibilityEnabledAttribute])
+ return [NSNumber numberWithBool:YES];
+
+ if ([attribute isEqual:NSAccessibilityChildrenAttribute]) {
+ // The subviews (icon and text) are clutter; filter out everything but
+ // useful controls.
+ NSArray* children = [super accessibilityAttributeValue:attribute];
+ NSMutableArray* okChildren = [NSMutableArray array];
+ for (id child in children) {
+ if ([child isKindOfClass:[NSButtonCell class]])
+ [okChildren addObject:child];
+ }
+
+ return okChildren;
+ }
+
return [super accessibilityAttributeValue:attribute];
}