| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include <execinfo.h> | 5 #include <execinfo.h> |
| 6 #include <stddef.h> | 6 #include <stddef.h> |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #import "content/browser/accessibility/browser_accessibility_cocoa.h" | 9 #import "content/browser/accessibility/browser_accessibility_cocoa.h" |
| 10 | 10 |
| (...skipping 2778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2789 return [self isIgnored]; | 2789 return [self isIgnored]; |
| 2790 } | 2790 } |
| 2791 | 2791 |
| 2792 // Performs the given accessibility action on the webkit accessibility object | 2792 // Performs the given accessibility action on the webkit accessibility object |
| 2793 // that backs this object. | 2793 // that backs this object. |
| 2794 - (void)accessibilityPerformAction:(NSString*)action { | 2794 - (void)accessibilityPerformAction:(NSString*)action { |
| 2795 if (![self instanceActive]) | 2795 if (![self instanceActive]) |
| 2796 return; | 2796 return; |
| 2797 | 2797 |
| 2798 // TODO(dmazzoni): Support more actions. | 2798 // TODO(dmazzoni): Support more actions. |
| 2799 BrowserAccessibilityManager* manager = browserAccessibility_->manager(); |
| 2799 if ([action isEqualToString:NSAccessibilityPressAction]) { | 2800 if ([action isEqualToString:NSAccessibilityPressAction]) { |
| 2800 [self delegate]->AccessibilityDoDefaultAction( | 2801 manager->DoDefaultAction(*browserAccessibility_); |
| 2801 browserAccessibility_->GetId()); | |
| 2802 } else if ([action isEqualToString:NSAccessibilityShowMenuAction]) { | 2802 } else if ([action isEqualToString:NSAccessibilityShowMenuAction]) { |
| 2803 [self delegate]->AccessibilityShowContextMenu( | 2803 manager->ShowContextMenu(*browserAccessibility_); |
| 2804 browserAccessibility_->GetId()); | |
| 2805 } else if ([action isEqualToString:NSAccessibilityScrollToVisibleAction]) { | 2804 } else if ([action isEqualToString:NSAccessibilityScrollToVisibleAction]) { |
| 2806 browserAccessibility_->manager()->ScrollToMakeVisible( | 2805 manager->ScrollToMakeVisible( |
| 2807 *browserAccessibility_, gfx::Rect()); | 2806 *browserAccessibility_, gfx::Rect()); |
| 2808 } | 2807 } |
| 2809 } | 2808 } |
| 2810 | 2809 |
| 2811 // Returns the description of the given action. | 2810 // Returns the description of the given action. |
| 2812 - (NSString*)accessibilityActionDescription:(NSString*)action { | 2811 - (NSString*)accessibilityActionDescription:(NSString*)action { |
| 2813 if (![self instanceActive]) | 2812 if (![self instanceActive]) |
| 2814 return nil; | 2813 return nil; |
| 2815 | 2814 |
| 2816 return NSAccessibilityActionDescription(action); | 2815 return NSAccessibilityActionDescription(action); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2832 | 2831 |
| 2833 if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) { | 2832 if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) { |
| 2834 BrowserAccessibilityManager* manager = browserAccessibility_->manager(); | 2833 BrowserAccessibilityManager* manager = browserAccessibility_->manager(); |
| 2835 NSNumber* focusedNumber = value; | 2834 NSNumber* focusedNumber = value; |
| 2836 BOOL focused = [focusedNumber intValue]; | 2835 BOOL focused = [focusedNumber intValue]; |
| 2837 if (focused) | 2836 if (focused) |
| 2838 manager->SetFocus(*browserAccessibility_); | 2837 manager->SetFocus(*browserAccessibility_); |
| 2839 } | 2838 } |
| 2840 if ([attribute isEqualToString:NSAccessibilitySelectedTextRangeAttribute]) { | 2839 if ([attribute isEqualToString:NSAccessibilitySelectedTextRangeAttribute]) { |
| 2841 NSRange range = [(NSValue*)value rangeValue]; | 2840 NSRange range = [(NSValue*)value rangeValue]; |
| 2842 [self delegate]->AccessibilitySetSelection( | 2841 BrowserAccessibilityManager* manager = browserAccessibility_->manager(); |
| 2843 browserAccessibility_->GetId(), range.location, | 2842 manager->SetTextSelection( |
| 2844 browserAccessibility_->GetId(), range.location + range.length); | 2843 *browserAccessibility_, range.location, range.location + range.length); |
| 2845 } | 2844 } |
| 2846 } | 2845 } |
| 2847 | 2846 |
| 2848 // Returns the deepest accessibility child that should not be ignored. | 2847 // Returns the deepest accessibility child that should not be ignored. |
| 2849 // It is assumed that the hit test has been narrowed down to this object | 2848 // It is assumed that the hit test has been narrowed down to this object |
| 2850 // or one of its children, so this will never return nil unless this | 2849 // or one of its children, so this will never return nil unless this |
| 2851 // object is invalid. | 2850 // object is invalid. |
| 2852 - (id)accessibilityHitTest:(NSPoint)point { | 2851 - (id)accessibilityHitTest:(NSPoint)point { |
| 2853 if (![self instanceActive]) | 2852 if (![self instanceActive]) |
| 2854 return nil; | 2853 return nil; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2878 } | 2877 } |
| 2879 | 2878 |
| 2880 - (BOOL)accessibilityNotifiesWhenDestroyed { | 2879 - (BOOL)accessibilityNotifiesWhenDestroyed { |
| 2881 // Indicate that BrowserAccessibilityCocoa will post a notification when it's | 2880 // Indicate that BrowserAccessibilityCocoa will post a notification when it's |
| 2882 // destroyed (see -detach). This allows VoiceOver to do some internal things | 2881 // destroyed (see -detach). This allows VoiceOver to do some internal things |
| 2883 // more efficiently. | 2882 // more efficiently. |
| 2884 return YES; | 2883 return YES; |
| 2885 } | 2884 } |
| 2886 | 2885 |
| 2887 @end | 2886 @end |
| OLD | NEW |