Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: ui/accessibility/platform/ax_platform_node_mac.mm

Issue 2010493005: a11y/Mac: Add screenreader support for SubtleNotificationView announcements. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and use title instead of value. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ui/accessibility/platform/ax_platform_node_mac.h" 5 #import "ui/accessibility/platform/ax_platform_node_mac.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 300
301 - (id)accessibilityAttributeValue:(NSString*)attribute { 301 - (id)accessibilityAttributeValue:(NSString*)attribute {
302 SEL selector = NSSelectorFromString(attribute); 302 SEL selector = NSSelectorFromString(attribute);
303 if ([self respondsToSelector:selector]) 303 if ([self respondsToSelector:selector])
304 return [self performSelector:selector]; 304 return [self performSelector:selector];
305 return nil; 305 return nil;
306 } 306 }
307 307
308 @end 308 @end
309 309
310 // TODO(patricialor): Remove this when the deployment target is 10.9 or later.
dmazzoni 2016/06/21 20:09:36 Just an idea: rather than a TODO, how about just m
tapted 2016/06/22 00:23:38 This is a good suggestion! But I have an alternati
Patti Lor 2016/06/23 01:00:39 Done, thanks for the suggestions. I stole that bit
311 extern NSString* const NSAccessibilityPriorityKey;
312
310 namespace ui { 313 namespace ui {
311 314
312 // static 315 // static
313 AXPlatformNode* AXPlatformNode::Create(AXPlatformNodeDelegate* delegate) { 316 AXPlatformNode* AXPlatformNode::Create(AXPlatformNodeDelegate* delegate) {
314 AXPlatformNodeBase* node = new AXPlatformNodeMac(); 317 AXPlatformNodeBase* node = new AXPlatformNodeMac();
315 node->Init(delegate); 318 node->Init(delegate);
316 return node; 319 return node;
317 } 320 }
318 321
319 AXPlatformNodeMac::AXPlatformNodeMac() { 322 AXPlatformNodeMac::AXPlatformNodeMac() {
320 } 323 }
321 324
322 AXPlatformNodeMac::~AXPlatformNodeMac() { 325 AXPlatformNodeMac::~AXPlatformNodeMac() {
323 } 326 }
324 327
325 void AXPlatformNodeMac::Destroy() { 328 void AXPlatformNodeMac::Destroy() {
326 if (native_node_) 329 if (native_node_)
327 [native_node_ detach]; 330 [native_node_ detach];
328 AXPlatformNodeBase::Destroy(); 331 AXPlatformNodeBase::Destroy();
329 } 332 }
330 333
331 gfx::NativeViewAccessible AXPlatformNodeMac::GetNativeViewAccessible() { 334 gfx::NativeViewAccessible AXPlatformNodeMac::GetNativeViewAccessible() {
332 if (!native_node_) 335 if (!native_node_)
333 native_node_.reset([[AXPlatformNodeCocoa alloc] initWithNode:this]); 336 native_node_.reset([[AXPlatformNodeCocoa alloc] initWithNode:this]);
334 return native_node_.get(); 337 return native_node_.get();
335 } 338 }
336 339
337 void AXPlatformNodeMac::NotifyAccessibilityEvent(ui::AXEvent event_type) { 340 void AXPlatformNodeMac::NotifyAccessibilityEvent(ui::AXEvent event_type) {
338 // TODO(dmazzoni): implement this. http://crbug.com/396137 341 switch (event_type) {
342 case ui::AX_EVENT_ALERT: {
343 NSString* announcement = base::SysUTF8ToNSString(
344 GetData().GetStringAttribute(ui::AX_ATTR_NAME));
345 NSDictionary* notification_info = @{
346 NSAccessibilityAnnouncementKey : announcement,
347 NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh)
tapted 2016/06/22 00:23:38 does NSAccessibilityPriorityKey : NSAccessibility
Patti Lor 2016/06/23 01:00:39 It complains "collection element of type 'NSAccess
tapted 2016/07/11 03:46:47 Ah - right you are. [NSNumber numberWithInteger:NS
348 };
349 NSAccessibilityPostNotificationWithUserInfo(
350 [NSApp mainWindow], NSAccessibilityAnnouncementRequestedNotification,
351 notification_info);
352 } break;
353 default:
354 // TODO(dmazzoni): implement this. http://crbug.com/396137
355 break;
356 }
339 } 357 }
340 358
341 int AXPlatformNodeMac::GetIndexInParent() { 359 int AXPlatformNodeMac::GetIndexInParent() {
342 // TODO(dmazzoni): implement this. http://crbug.com/396137 360 // TODO(dmazzoni): implement this. http://crbug.com/396137
343 return -1; 361 return -1;
344 } 362 }
345 363
346 } // namespace ui 364 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698