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 if (!node->IsNative()) |
| 33 return; |
| 34 |
32 // Refer to AXObjectCache.mm (webkit). | 35 // Refer to AXObjectCache.mm (webkit). |
33 NSString* event_id = @""; | 36 NSString* event_id = @""; |
34 switch (type) { | 37 switch (type) { |
35 case AccessibilityNotificationActiveDescendantChanged: | 38 case AccessibilityNotificationActiveDescendantChanged: |
36 if (node->role() == WebAccessibility::ROLE_TREE) | 39 if (node->role() == WebAccessibility::ROLE_TREE) |
37 event_id = NSAccessibilitySelectedRowsChangedNotification; | 40 event_id = NSAccessibilitySelectedRowsChangedNotification; |
38 else | 41 else |
39 event_id = NSAccessibilityFocusedUIElementChangedNotification; | 42 event_id = NSAccessibilityFocusedUIElementChangedNotification; |
40 case AccessibilityNotificationAlert: | 43 case AccessibilityNotificationAlert: |
41 // Not used on Mac. | 44 // Not used on Mac. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 case AccessibilityNotificationTextInserted: | 94 case AccessibilityNotificationTextInserted: |
92 // Not used on Mac. | 95 // Not used on Mac. |
93 return; | 96 return; |
94 case AccessibilityNotificationTextRemoved: | 97 case AccessibilityNotificationTextRemoved: |
95 // Not used on Mac. | 98 // Not used on Mac. |
96 return; | 99 return; |
97 case AccessibilityNotificationValueChanged: | 100 case AccessibilityNotificationValueChanged: |
98 event_id = NSAccessibilityValueChangedNotification; | 101 event_id = NSAccessibilityValueChangedNotification; |
99 break; | 102 break; |
100 } | 103 } |
101 BrowserAccessibilityCocoa* native_node = node->toBrowserAccessibilityCocoa(); | 104 BrowserAccessibilityCocoa* native_node = node->ToBrowserAccessibilityCocoa(); |
102 DCHECK(native_node); | 105 DCHECK(native_node); |
103 NSAccessibilityPostNotification(native_node, event_id); | 106 NSAccessibilityPostNotification(native_node, event_id); |
104 } | 107 } |
OLD | NEW |