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

Side by Side Diff: content/browser/accessibility/browser_accessibility_manager_mac.mm

Issue 23651003: Use Blink accessibility enums in Chromium (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
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 13 matching lines...) Expand all
24 BrowserAccessibilityDelegate* delegate, 24 BrowserAccessibilityDelegate* delegate,
25 BrowserAccessibilityFactory* factory) 25 BrowserAccessibilityFactory* factory)
26 : BrowserAccessibilityManager(src, delegate, factory), 26 : BrowserAccessibilityManager(src, delegate, factory),
27 parent_view_(parent_view) { 27 parent_view_(parent_view) {
28 } 28 }
29 29
30 // static 30 // static
31 AccessibilityNodeData BrowserAccessibilityManagerMac::GetEmptyDocument() { 31 AccessibilityNodeData BrowserAccessibilityManagerMac::GetEmptyDocument() {
32 AccessibilityNodeData empty_document; 32 AccessibilityNodeData empty_document;
33 empty_document.id = 0; 33 empty_document.id = 0;
34 empty_document.role = AccessibilityNodeData::ROLE_ROOT_WEB_AREA; 34 empty_document.role = WebKit::WebAXRoleRootWebArea;
35 empty_document.state = 35 empty_document.state =
36 1 << AccessibilityNodeData::STATE_READONLY; 36 1 << WebKit::WebAXStateReadonly;
37 return empty_document; 37 return empty_document;
38 } 38 }
39 39
40 void BrowserAccessibilityManagerMac::NotifyAccessibilityEvent( 40 void BrowserAccessibilityManagerMac::NotifyAccessibilityEvent(
41 int type, 41 WebKit::WebAXEvent event_type,
42 BrowserAccessibility* node) { 42 BrowserAccessibility* node) {
43 if (!node->IsNative()) 43 if (!node->IsNative())
44 return; 44 return;
45 45
46 // Refer to AXObjectCache.mm (webkit). 46 // Refer to AXObjectCache.mm (webkit).
47 NSString* event_id = @""; 47 NSString* event_id = @"";
48 switch (type) { 48 switch (event_type) {
49 case AccessibilityNotificationActiveDescendantChanged: 49 case WebKit::WebAXEventActiveDescendantChanged:
50 if (node->role() == AccessibilityNodeData::ROLE_TREE) 50 if (node->role() == WebKit::WebAXRoleTree)
51 event_id = NSAccessibilitySelectedRowsChangedNotification; 51 event_id = NSAccessibilitySelectedRowsChangedNotification;
52 else 52 else
53 event_id = NSAccessibilityFocusedUIElementChangedNotification; 53 event_id = NSAccessibilityFocusedUIElementChangedNotification;
54 break; 54 break;
55 case AccessibilityNotificationAlert: 55 case WebKit::WebAXEventAlert:
56 // Not used on Mac. 56 // Not used on Mac.
57 return; 57 return;
58 case AccessibilityNotificationBlur: 58 case WebKit::WebAXEventBlur:
59 // A no-op on Mac. 59 // A no-op on Mac.
60 return; 60 return;
61 case AccessibilityNotificationCheckStateChanged: 61 case WebKit::WebAXEventCheckedStateChanged:
62 // Not used on Mac. 62 // Not used on Mac.
63 return; 63 return;
64 case AccessibilityNotificationChildrenChanged: 64 case WebKit::WebAXEventChildrenChanged:
65 // TODO(dtseng): no clear equivalent on Mac. 65 // TODO(dtseng): no clear equivalent on Mac.
66 return; 66 return;
67 case AccessibilityNotificationFocusChanged: 67 case WebKit::WebAXEventFocus:
68 event_id = NSAccessibilityFocusedUIElementChangedNotification; 68 event_id = NSAccessibilityFocusedUIElementChangedNotification;
69 break; 69 break;
70 case AccessibilityNotificationLayoutComplete: 70 case WebKit::WebAXEventLayoutComplete:
71 event_id = @"AXLayoutComplete"; 71 event_id = @"AXLayoutComplete";
72 break; 72 break;
73 case AccessibilityNotificationLiveRegionChanged: 73 case WebKit::WebAXEventLiveRegionChanged:
74 event_id = @"AXLiveRegionChanged"; 74 event_id = @"AXLiveRegionChanged";
75 break; 75 break;
76 case AccessibilityNotificationLoadComplete: 76 case WebKit::WebAXEventLoadComplete:
77 event_id = @"AXLoadComplete"; 77 event_id = @"AXLoadComplete";
78 break; 78 break;
79 case AccessibilityNotificationMenuListValueChanged: 79 case WebKit::WebAXEventMenuListValueChanged:
80 // Not used on Mac. 80 // Not used on Mac.
81 return; 81 return;
82 case AccessibilityNotificationObjectShow: 82 case WebKit::WebAXEventShow:
83 // Not used on Mac. 83 // Not used on Mac.
84 return; 84 return;
85 case AccessibilityNotificationObjectHide: 85 case WebKit::WebAXEventHide:
86 // Not used on Mac. 86 // Not used on Mac.
87 return; 87 return;
88 case AccessibilityNotificationRowCountChanged: 88 case WebKit::WebAXEventRowCountChanged:
89 event_id = NSAccessibilityRowCountChangedNotification; 89 event_id = NSAccessibilityRowCountChangedNotification;
90 break; 90 break;
91 case AccessibilityNotificationRowCollapsed: 91 case WebKit::WebAXEventRowCollapsed:
92 event_id = @"AXRowCollapsed"; 92 event_id = @"AXRowCollapsed";
93 break; 93 break;
94 case AccessibilityNotificationRowExpanded: 94 case WebKit::WebAXEventRowExpanded:
95 event_id = @"AXRowExpanded"; 95 event_id = @"AXRowExpanded";
96 break; 96 break;
97 case AccessibilityNotificationScrolledToAnchor: 97 case WebKit::WebAXEventScrolledToAnchor:
98 // Not used on Mac. 98 // Not used on Mac.
99 return; 99 return;
100 case AccessibilityNotificationSelectedChildrenChanged: 100 case WebKit::WebAXEventSelectedChildrenChanged:
101 event_id = NSAccessibilitySelectedChildrenChangedNotification; 101 event_id = NSAccessibilitySelectedChildrenChangedNotification;
102 break; 102 break;
103 case AccessibilityNotificationSelectedTextChanged: 103 case WebKit::WebAXEventSelectedTextChanged:
104 event_id = NSAccessibilitySelectedTextChangedNotification; 104 event_id = NSAccessibilitySelectedTextChangedNotification;
105 break; 105 break;
106 case AccessibilityNotificationTextInserted: 106 case WebKit::WebAXEventTextInserted:
107 // Not used on Mac. 107 // Not used on Mac.
108 return; 108 return;
109 case AccessibilityNotificationTextRemoved: 109 case WebKit::WebAXEventTextRemoved:
110 // Not used on Mac. 110 // Not used on Mac.
111 return; 111 return;
112 case AccessibilityNotificationValueChanged: 112 case WebKit::WebAXEventValueChanged:
113 event_id = NSAccessibilityValueChangedNotification; 113 event_id = NSAccessibilityValueChangedNotification;
114 break; 114 break;
115 case WebKit::WebAXEventAriaAttributeChanged:
116 // Not used on Mac.
117 return;
118 case WebKit::WebAXEventAutocorrectionOccured:
119 // Not used on Mac.
120 return;
121 case WebKit::WebAXEventInvalidStatusChanged:
122 // Not used on Mac.
123 return;
124 case WebKit::WebAXEventLocationChanged:
125 // Not used on Mac.
126 return;
127 case WebKit::WebAXEventMenuListItemSelected:
128 // Not used on Mac.
129 return;
130 case WebKit::WebAXEventTextChanged:
131 // Not used on Mac.
132 return;
133 default:
134 LOG(WARNING) << "Unknown accessibility event: " << event_type;
135 return;
115 } 136 }
116 BrowserAccessibilityCocoa* native_node = node->ToBrowserAccessibilityCocoa(); 137 BrowserAccessibilityCocoa* native_node = node->ToBrowserAccessibilityCocoa();
117 DCHECK(native_node); 138 DCHECK(native_node);
118 NSAccessibilityPostNotification(native_node, event_id); 139 NSAccessibilityPostNotification(native_node, event_id);
119 } 140 }
120 141
121 } // namespace content 142 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698