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/accessibility_tree_formatter.h" | 5 #include "content/browser/accessibility/accessibility_tree_formatter.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 NSMutableArray* tokens = [[NSMutableArray alloc] init]; | 98 NSMutableArray* tokens = [[NSMutableArray alloc] init]; |
99 | 99 |
100 // Always include the role | 100 // Always include the role |
101 id role = [obj role]; | 101 id role = [obj role]; |
102 [tokens addObject:role]; | 102 [tokens addObject:role]; |
103 | 103 |
104 // If the role is "group", include the role description as well. | 104 // If the role is "group", include the role description as well. |
105 id roleDescription = [obj roleDescription]; | 105 id roleDescription = [obj roleDescription]; |
106 if ([role isEqualToString:NSAccessibilityGroupRole] && | 106 if ([role isEqualToString:NSAccessibilityGroupRole] && |
107 roleDescription != nil && | 107 roleDescription != nil && |
108 ![roleDescription isEqualToString:@""]) { | 108 ![roleDescription isEqualToString:@""] && |
| 109 ![roleDescription isEqualToString:@"group"]) { |
109 [tokens addObject:roleDescription]; | 110 [tokens addObject:roleDescription]; |
110 } | 111 } |
111 | 112 |
112 // Include the description, title, or value - the first one not empty. | 113 // Include the description, title, or value - the first one not empty. |
113 id title = [obj title]; | 114 id title = [obj title]; |
114 id description = [obj description]; | 115 id description = [obj description]; |
115 id value = [obj value]; | 116 id value = [obj value]; |
116 if (description && ![description isEqual:@""]) { | 117 if (description && ![description isEqual:@""]) { |
117 [tokens addObject:description]; | 118 [tokens addObject:description]; |
118 } else if (title && ![title isEqual:@""]) { | 119 } else if (title && ![title isEqual:@""]) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 const base::DictionaryValue& dict) { | 233 const base::DictionaryValue& dict) { |
233 base::string16 line; | 234 base::string16 line; |
234 if (show_ids_) { | 235 if (show_ids_) { |
235 int id_value; | 236 int id_value; |
236 dict.GetInteger("id", &id_value); | 237 dict.GetInteger("id", &id_value); |
237 WriteAttribute(true, base::IntToString16(id_value), &line); | 238 WriteAttribute(true, base::IntToString16(id_value), &line); |
238 } | 239 } |
239 | 240 |
240 NSArray* defaultAttributes = | 241 NSArray* defaultAttributes = |
241 [NSArray arrayWithObjects:NSAccessibilityTitleAttribute, | 242 [NSArray arrayWithObjects:NSAccessibilityTitleAttribute, |
| 243 NSAccessibilityTitleUIElementAttribute, |
| 244 NSAccessibilityDescriptionAttribute, |
| 245 NSAccessibilityHelpAttribute, |
242 NSAccessibilityValueAttribute, | 246 NSAccessibilityValueAttribute, |
243 nil]; | 247 nil]; |
244 string s_value; | 248 string s_value; |
245 dict.GetString(SysNSStringToUTF8(NSAccessibilityRoleAttribute), &s_value); | 249 dict.GetString(SysNSStringToUTF8(NSAccessibilityRoleAttribute), &s_value); |
246 WriteAttribute(true, base::UTF8ToUTF16(s_value), &line); | 250 WriteAttribute(true, base::UTF8ToUTF16(s_value), &line); |
247 | 251 |
248 string subroleAttribute = SysNSStringToUTF8(NSAccessibilitySubroleAttribute); | 252 string subroleAttribute = SysNSStringToUTF8(NSAccessibilitySubroleAttribute); |
249 if (dict.GetString(subroleAttribute, &s_value)) { | 253 if (dict.GetString(subroleAttribute, &s_value)) { |
250 WriteAttribute(false, | 254 WriteAttribute(false, |
251 StringPrintf("%s=%s", | 255 StringPrintf("%s=%s", |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 const string AccessibilityTreeFormatter::GetAllowString() { | 319 const string AccessibilityTreeFormatter::GetAllowString() { |
316 return "@MAC-ALLOW:"; | 320 return "@MAC-ALLOW:"; |
317 } | 321 } |
318 | 322 |
319 // static | 323 // static |
320 const string AccessibilityTreeFormatter::GetDenyString() { | 324 const string AccessibilityTreeFormatter::GetDenyString() { |
321 return "@MAC-DENY:"; | 325 return "@MAC-DENY:"; |
322 } | 326 } |
323 | 327 |
324 } // namespace content | 328 } // namespace content |
OLD | NEW |