| 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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 base::string16 role_value; | 342 base::string16 role_value; |
| 343 dict.GetString("role", &role_value); | 343 dict.GetString("role", &role_value); |
| 344 WriteAttribute(true, base::UTF16ToUTF8(role_value), &line); | 344 WriteAttribute(true, base::UTF16ToUTF8(role_value), &line); |
| 345 | 345 |
| 346 for (const char* attribute_name : ALL_ATTRIBUTES) { | 346 for (const char* attribute_name : ALL_ATTRIBUTES) { |
| 347 const base::Value* value; | 347 const base::Value* value; |
| 348 if (!dict.Get(attribute_name, &value)) | 348 if (!dict.Get(attribute_name, &value)) |
| 349 continue; | 349 continue; |
| 350 | 350 |
| 351 switch (value->GetType()) { | 351 switch (value->GetType()) { |
| 352 case base::Value::TYPE_STRING: { | 352 case base::Value::Type::STRING: { |
| 353 base::string16 string_value; | 353 base::string16 string_value; |
| 354 value->GetAsString(&string_value); | 354 value->GetAsString(&string_value); |
| 355 WriteAttribute(false, | 355 WriteAttribute(false, |
| 356 base::StringPrintf(L"%ls='%ls'", | 356 base::StringPrintf(L"%ls='%ls'", |
| 357 base::UTF8ToUTF16(attribute_name).c_str(), | 357 base::UTF8ToUTF16(attribute_name).c_str(), |
| 358 string_value.c_str()), | 358 string_value.c_str()), |
| 359 &line); | 359 &line); |
| 360 break; | 360 break; |
| 361 } | 361 } |
| 362 case base::Value::TYPE_INTEGER: { | 362 case base::Value::Type::INTEGER: { |
| 363 int int_value = 0; | 363 int int_value = 0; |
| 364 value->GetAsInteger(&int_value); | 364 value->GetAsInteger(&int_value); |
| 365 WriteAttribute(false, | 365 WriteAttribute(false, |
| 366 base::StringPrintf(L"%ls=%d", | 366 base::StringPrintf(L"%ls=%d", |
| 367 base::UTF8ToUTF16( | 367 base::UTF8ToUTF16( |
| 368 attribute_name).c_str(), | 368 attribute_name).c_str(), |
| 369 int_value), | 369 int_value), |
| 370 &line); | 370 &line); |
| 371 break; | 371 break; |
| 372 } | 372 } |
| 373 case base::Value::TYPE_DOUBLE: { | 373 case base::Value::Type::DOUBLE: { |
| 374 double double_value = 0.0; | 374 double double_value = 0.0; |
| 375 value->GetAsDouble(&double_value); | 375 value->GetAsDouble(&double_value); |
| 376 WriteAttribute(false, | 376 WriteAttribute(false, |
| 377 base::StringPrintf(L"%ls=%.2f", | 377 base::StringPrintf(L"%ls=%.2f", |
| 378 base::UTF8ToUTF16( | 378 base::UTF8ToUTF16( |
| 379 attribute_name).c_str(), | 379 attribute_name).c_str(), |
| 380 double_value), | 380 double_value), |
| 381 &line); | 381 &line); |
| 382 break; | 382 break; |
| 383 } | 383 } |
| 384 case base::Value::TYPE_LIST: { | 384 case base::Value::Type::LIST: { |
| 385 // Currently all list values are string and are written without | 385 // Currently all list values are string and are written without |
| 386 // attribute names. | 386 // attribute names. |
| 387 const base::ListValue* list_value; | 387 const base::ListValue* list_value; |
| 388 value->GetAsList(&list_value); | 388 value->GetAsList(&list_value); |
| 389 for (base::ListValue::const_iterator it = list_value->begin(); | 389 for (base::ListValue::const_iterator it = list_value->begin(); |
| 390 it != list_value->end(); | 390 it != list_value->end(); |
| 391 ++it) { | 391 ++it) { |
| 392 base::string16 string_value; | 392 base::string16 string_value; |
| 393 if ((*it)->GetAsString(&string_value)) | 393 if ((*it)->GetAsString(&string_value)) |
| 394 WriteAttribute(false, string_value, &line); | 394 WriteAttribute(false, string_value, &line); |
| 395 } | 395 } |
| 396 break; | 396 break; |
| 397 } | 397 } |
| 398 case base::Value::TYPE_DICTIONARY: { | 398 case base::Value::Type::DICTIONARY: { |
| 399 // Currently all dictionary values are coordinates. | 399 // Currently all dictionary values are coordinates. |
| 400 // Revisit this if that changes. | 400 // Revisit this if that changes. |
| 401 const base::DictionaryValue* dict_value; | 401 const base::DictionaryValue* dict_value; |
| 402 value->GetAsDictionary(&dict_value); | 402 value->GetAsDictionary(&dict_value); |
| 403 if (strcmp(attribute_name, "size") == 0) { | 403 if (strcmp(attribute_name, "size") == 0) { |
| 404 WriteAttribute(false, | 404 WriteAttribute(false, |
| 405 FormatCoordinates("size", "width", "height", | 405 FormatCoordinates("size", "width", "height", |
| 406 *dict_value), | 406 *dict_value), |
| 407 &line); | 407 &line); |
| 408 } else if (strcmp(attribute_name, "location") == 0) { | 408 } else if (strcmp(attribute_name, "location") == 0) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 432 | 432 |
| 433 const std::string AccessibilityTreeFormatterWin::GetAllowString() { | 433 const std::string AccessibilityTreeFormatterWin::GetAllowString() { |
| 434 return "@WIN-ALLOW:"; | 434 return "@WIN-ALLOW:"; |
| 435 } | 435 } |
| 436 | 436 |
| 437 const std::string AccessibilityTreeFormatterWin::GetDenyString() { | 437 const std::string AccessibilityTreeFormatterWin::GetDenyString() { |
| 438 return "@WIN-DENY:"; | 438 return "@WIN-DENY:"; |
| 439 } | 439 } |
| 440 | 440 |
| 441 } // namespace content | 441 } // namespace content |
| OLD | NEW |