| 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 "content/browser/accessibility/browser_accessibility_manager_mac.h" | 5 #include "content/browser/accessibility/browser_accessibility_manager_mac.h" |
| 6 | 6 |
| 7 #import "base/logging.h" | 7 #import "base/logging.h" |
| 8 #import "content/browser/accessibility/browser_accessibility_cocoa.h" | 8 #import "content/browser/accessibility/browser_accessibility_cocoa.h" |
| 9 #include "content/common/accessibility_messages.h" | 9 #include "content/common/accessibility_messages.h" |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 gfx::NativeView parent_window, | 22 gfx::NativeView parent_window, |
| 23 const webkit_glue::WebAccessibility& src, | 23 const webkit_glue::WebAccessibility& src, |
| 24 BrowserAccessibilityDelegate* delegate, | 24 BrowserAccessibilityDelegate* delegate, |
| 25 BrowserAccessibilityFactory* factory) | 25 BrowserAccessibilityFactory* factory) |
| 26 : BrowserAccessibilityManager(parent_window, src, delegate, factory) { | 26 : BrowserAccessibilityManager(parent_window, src, delegate, factory) { |
| 27 } | 27 } |
| 28 | 28 |
| 29 void BrowserAccessibilityManagerMac::NotifyAccessibilityEvent( | 29 void BrowserAccessibilityManagerMac::NotifyAccessibilityEvent( |
| 30 int type, | 30 int type, |
| 31 BrowserAccessibility* node) { | 31 BrowserAccessibility* node) { |
| 32 BrowserAccessibilityCocoa* native_node = node->ToBrowserAccessibilityCocoa(); |
| 33 if (!native_node) |
| 34 return; |
| 35 |
| 32 // Refer to AXObjectCache.mm (webkit). | 36 // Refer to AXObjectCache.mm (webkit). |
| 33 NSString* event_id = @""; | 37 NSString* event_id = @""; |
| 34 switch (type) { | 38 switch (type) { |
| 35 case AccessibilityNotificationActiveDescendantChanged: | 39 case AccessibilityNotificationActiveDescendantChanged: |
| 36 if (node->role() == WebAccessibility::ROLE_TREE) | 40 if (node->role() == WebAccessibility::ROLE_TREE) |
| 37 event_id = NSAccessibilitySelectedRowsChangedNotification; | 41 event_id = NSAccessibilitySelectedRowsChangedNotification; |
| 38 else | 42 else |
| 39 event_id = NSAccessibilityFocusedUIElementChangedNotification; | 43 event_id = NSAccessibilityFocusedUIElementChangedNotification; |
| 40 case AccessibilityNotificationAlert: | 44 case AccessibilityNotificationAlert: |
| 41 // Not used on Mac. | 45 // Not used on Mac. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 case AccessibilityNotificationTextInserted: | 95 case AccessibilityNotificationTextInserted: |
| 92 // Not used on Mac. | 96 // Not used on Mac. |
| 93 return; | 97 return; |
| 94 case AccessibilityNotificationTextRemoved: | 98 case AccessibilityNotificationTextRemoved: |
| 95 // Not used on Mac. | 99 // Not used on Mac. |
| 96 return; | 100 return; |
| 97 case AccessibilityNotificationValueChanged: | 101 case AccessibilityNotificationValueChanged: |
| 98 event_id = NSAccessibilityValueChangedNotification; | 102 event_id = NSAccessibilityValueChangedNotification; |
| 99 break; | 103 break; |
| 100 } | 104 } |
| 101 BrowserAccessibilityCocoa* native_node = node->toBrowserAccessibilityCocoa(); | |
| 102 DCHECK(native_node); | |
| 103 NSAccessibilityPostNotification(native_node, event_id); | 105 NSAccessibilityPostNotification(native_node, event_id); |
| 104 } | 106 } |
| OLD | NEW |