OLD | NEW |
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" |
| 11 #import "base/mac/sdk_forward_declarations.h" |
11 #include "base/strings/sys_string_conversions.h" | 12 #include "base/strings/sys_string_conversions.h" |
12 #import "ui/accessibility/ax_node_data.h" | 13 #import "ui/accessibility/ax_node_data.h" |
13 #import "ui/accessibility/platform/ax_platform_node_delegate.h" | 14 #import "ui/accessibility/platform/ax_platform_node_delegate.h" |
14 #import "ui/gfx/mac/coordinate_conversion.h" | 15 #import "ui/gfx/mac/coordinate_conversion.h" |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
18 struct MapEntry { | 19 struct MapEntry { |
19 ui::AXRole value; | 20 ui::AXRole value; |
20 NSString* nativeValue; | 21 NSString* nativeValue; |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 AXPlatformNodeBase::Destroy(); | 329 AXPlatformNodeBase::Destroy(); |
329 } | 330 } |
330 | 331 |
331 gfx::NativeViewAccessible AXPlatformNodeMac::GetNativeViewAccessible() { | 332 gfx::NativeViewAccessible AXPlatformNodeMac::GetNativeViewAccessible() { |
332 if (!native_node_) | 333 if (!native_node_) |
333 native_node_.reset([[AXPlatformNodeCocoa alloc] initWithNode:this]); | 334 native_node_.reset([[AXPlatformNodeCocoa alloc] initWithNode:this]); |
334 return native_node_.get(); | 335 return native_node_.get(); |
335 } | 336 } |
336 | 337 |
337 void AXPlatformNodeMac::NotifyAccessibilityEvent(ui::AXEvent event_type) { | 338 void AXPlatformNodeMac::NotifyAccessibilityEvent(ui::AXEvent event_type) { |
338 // TODO(dmazzoni): implement this. http://crbug.com/396137 | 339 switch (event_type) { |
| 340 case ui::AX_EVENT_ALERT: { |
| 341 NSString* announcement = base::SysUTF8ToNSString( |
| 342 GetData().GetStringAttribute(ui::AX_ATTR_NAME)); |
| 343 NSDictionary* notification_info = @{ |
| 344 NSAccessibilityAnnouncementKey : announcement, |
| 345 NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh) |
| 346 }; |
| 347 NSAccessibilityPostNotificationWithUserInfo( |
| 348 [NSApp mainWindow], NSAccessibilityAnnouncementRequestedNotification, |
| 349 notification_info); |
| 350 } break; |
| 351 default: |
| 352 // TODO(dmazzoni): implement this. http://crbug.com/396137 |
| 353 break; |
| 354 } |
339 } | 355 } |
340 | 356 |
341 int AXPlatformNodeMac::GetIndexInParent() { | 357 int AXPlatformNodeMac::GetIndexInParent() { |
342 // TODO(dmazzoni): implement this. http://crbug.com/396137 | 358 // TODO(dmazzoni): implement this. http://crbug.com/396137 |
343 return -1; | 359 return -1; |
344 } | 360 } |
345 | 361 |
346 } // namespace ui | 362 } // namespace ui |
OLD | NEW |