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 #include <oleacc.h> | 7 #include <oleacc.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 ToBrowserAccessibilityWin(const_cast<BrowserAccessibility*>(&node)); | 164 ToBrowserAccessibilityWin(const_cast<BrowserAccessibility*>(&node)); |
165 DCHECK(ax_object); | 165 DCHECK(ax_object); |
166 | 166 |
167 VARIANT variant_self; | 167 VARIANT variant_self; |
168 variant_self.vt = VT_I4; | 168 variant_self.vt = VT_I4; |
169 variant_self.lVal = CHILDID_SELF; | 169 variant_self.lVal = CHILDID_SELF; |
170 | 170 |
171 dict->SetString("role", IAccessible2RoleToString(ax_object->ia2_role())); | 171 dict->SetString("role", IAccessible2RoleToString(ax_object->ia2_role())); |
172 | 172 |
173 base::win::ScopedBstr temp_bstr; | 173 base::win::ScopedBstr temp_bstr; |
174 if (SUCCEEDED(ax_object->get_accName(variant_self, temp_bstr.Receive()))) { | 174 // If S_FALSE it means there is no name |
| 175 if (S_OK == ax_object->get_accName(variant_self, temp_bstr.Receive())) { |
175 base::string16 name = base::string16(temp_bstr, temp_bstr.Length()); | 176 base::string16 name = base::string16(temp_bstr, temp_bstr.Length()); |
176 | 177 |
177 // Ignore a JAWS workaround where the name of a document is " ". | 178 // Ignore a JAWS workaround where the name of a document is " ". |
178 if (name != L" " || ax_object->ia2_role() != ROLE_SYSTEM_DOCUMENT) | 179 if (name != L" " || ax_object->ia2_role() != ROLE_SYSTEM_DOCUMENT) |
179 dict->SetString("name", name); | 180 dict->SetString("name", name); |
180 } | 181 } |
181 temp_bstr.Reset(); | 182 temp_bstr.Reset(); |
182 | 183 |
183 if (SUCCEEDED(ax_object->get_accValue(variant_self, temp_bstr.Receive()))) | 184 if (SUCCEEDED(ax_object->get_accValue(variant_self, temp_bstr.Receive()))) |
184 dict->SetString("value", base::string16(temp_bstr, temp_bstr.Length())); | 185 dict->SetString("value", base::string16(temp_bstr, temp_bstr.Length())); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 | 360 |
360 for (const char* attribute_name : ALL_ATTRIBUTES) { | 361 for (const char* attribute_name : ALL_ATTRIBUTES) { |
361 const base::Value* value; | 362 const base::Value* value; |
362 if (!dict.Get(attribute_name, &value)) | 363 if (!dict.Get(attribute_name, &value)) |
363 continue; | 364 continue; |
364 | 365 |
365 switch (value->GetType()) { | 366 switch (value->GetType()) { |
366 case base::Value::Type::STRING: { | 367 case base::Value::Type::STRING: { |
367 base::string16 string_value; | 368 base::string16 string_value; |
368 value->GetAsString(&string_value); | 369 value->GetAsString(&string_value); |
369 WriteAttribute(false, | 370 WriteAttribute( |
370 base::StringPrintf(L"%ls='%ls'", | 371 false, |
371 base::UTF8ToUTF16(attribute_name).c_str(), | 372 base::StringPrintf(L"%ls='%ls'", |
372 string_value.c_str()), | 373 base::UTF8ToUTF16(attribute_name).c_str(), |
373 &line); | 374 string_value.c_str()), |
| 375 &line); |
374 break; | 376 break; |
375 } | 377 } |
376 case base::Value::Type::INTEGER: { | 378 case base::Value::Type::INTEGER: { |
377 int int_value = 0; | 379 int int_value = 0; |
378 value->GetAsInteger(&int_value); | 380 value->GetAsInteger(&int_value); |
379 WriteAttribute(false, | 381 WriteAttribute(false, |
380 base::StringPrintf(L"%ls=%d", | 382 base::StringPrintf(L"%ls=%d", |
381 base::UTF8ToUTF16( | 383 base::UTF8ToUTF16( |
382 attribute_name).c_str(), | 384 attribute_name).c_str(), |
383 int_value), | 385 int_value), |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 | 448 |
447 const std::string AccessibilityTreeFormatterWin::GetAllowString() { | 449 const std::string AccessibilityTreeFormatterWin::GetAllowString() { |
448 return "@WIN-ALLOW:"; | 450 return "@WIN-ALLOW:"; |
449 } | 451 } |
450 | 452 |
451 const std::string AccessibilityTreeFormatterWin::GetDenyString() { | 453 const std::string AccessibilityTreeFormatterWin::GetDenyString() { |
452 return "@WIN-DENY:"; | 454 return "@WIN-DENY:"; |
453 } | 455 } |
454 | 456 |
455 } // namespace content | 457 } // namespace content |
OLD | NEW |