| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 <stddef.h> |
| 6 |
| 5 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 6 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 7 #include "content/browser/accessibility/accessibility_tree_formatter_blink.h" | 9 #include "content/browser/accessibility/accessibility_tree_formatter_blink.h" |
| 8 | 10 |
| 9 namespace content { | 11 namespace content { |
| 10 | 12 |
| 11 AccessibilityTreeFormatterBlink::AccessibilityTreeFormatterBlink() | 13 AccessibilityTreeFormatterBlink::AccessibilityTreeFormatterBlink() |
| 12 : AccessibilityTreeFormatter() { | 14 : AccessibilityTreeFormatter() { |
| 13 } | 15 } |
| 14 | 16 |
| 15 AccessibilityTreeFormatterBlink::~AccessibilityTreeFormatterBlink() { | 17 AccessibilityTreeFormatterBlink::~AccessibilityTreeFormatterBlink() { |
| 16 } | 18 } |
| 17 | 19 |
| 18 uint32 AccessibilityTreeFormatterBlink::ChildCount( | 20 uint32_t AccessibilityTreeFormatterBlink::ChildCount( |
| 19 const BrowserAccessibility& node) const{ | 21 const BrowserAccessibility& node) const { |
| 20 return node.InternalChildCount(); | 22 return node.InternalChildCount(); |
| 21 } | 23 } |
| 22 | 24 |
| 23 BrowserAccessibility* AccessibilityTreeFormatterBlink::GetChild( | 25 BrowserAccessibility* AccessibilityTreeFormatterBlink::GetChild( |
| 24 const BrowserAccessibility& node, uint32 i) const { | 26 const BrowserAccessibility& node, |
| 27 uint32_t i) const { |
| 25 return node.InternalGetChild(i); | 28 return node.InternalGetChild(i); |
| 26 } | 29 } |
| 27 | 30 |
| 28 void AccessibilityTreeFormatterBlink::AddProperties( | 31 void AccessibilityTreeFormatterBlink::AddProperties( |
| 29 const BrowserAccessibility& node, | 32 const BrowserAccessibility& node, |
| 30 base::DictionaryValue* dict) { | 33 base::DictionaryValue* dict) { |
| 31 dict->SetInteger("id", node.GetId()); | 34 dict->SetInteger("id", node.GetId()); |
| 32 | 35 |
| 33 dict->SetString("role", ui::ToString(node.GetData().role)); | 36 dict->SetString("role", ui::ToString(node.GetData().role)); |
| 34 | 37 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 auto attr = static_cast<ui::AXBoolAttribute>(attr_index); | 78 auto attr = static_cast<ui::AXBoolAttribute>(attr_index); |
| 76 if (node.HasBoolAttribute(attr)) | 79 if (node.HasBoolAttribute(attr)) |
| 77 dict->SetBoolean(ui::ToString(attr), node.GetBoolAttribute(attr)); | 80 dict->SetBoolean(ui::ToString(attr), node.GetBoolAttribute(attr)); |
| 78 } | 81 } |
| 79 | 82 |
| 80 for (int attr_index = ui::AX_INT_LIST_ATTRIBUTE_NONE; | 83 for (int attr_index = ui::AX_INT_LIST_ATTRIBUTE_NONE; |
| 81 attr_index <= ui::AX_INT_LIST_ATTRIBUTE_LAST; | 84 attr_index <= ui::AX_INT_LIST_ATTRIBUTE_LAST; |
| 82 ++attr_index) { | 85 ++attr_index) { |
| 83 auto attr = static_cast<ui::AXIntListAttribute>(attr_index); | 86 auto attr = static_cast<ui::AXIntListAttribute>(attr_index); |
| 84 if (node.HasIntListAttribute(attr)) { | 87 if (node.HasIntListAttribute(attr)) { |
| 85 std::vector<int32> values; | 88 std::vector<int32_t> values; |
| 86 node.GetIntListAttribute(attr, &values); | 89 node.GetIntListAttribute(attr, &values); |
| 87 base::ListValue* value_list = new base::ListValue; | 90 base::ListValue* value_list = new base::ListValue; |
| 88 for (size_t i = 0; i < values.size(); ++i) | 91 for (size_t i = 0; i < values.size(); ++i) |
| 89 value_list->AppendInteger(values[i]); | 92 value_list->AppendInteger(values[i]); |
| 90 dict->Set(ui::ToString(attr), value_list); | 93 dict->Set(ui::ToString(attr), value_list); |
| 91 } | 94 } |
| 92 } | 95 } |
| 93 } | 96 } |
| 94 | 97 |
| 95 base::string16 AccessibilityTreeFormatterBlink::ToString( | 98 base::string16 AccessibilityTreeFormatterBlink::ToString( |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 204 |
| 202 const std::string AccessibilityTreeFormatterBlink::GetAllowString() { | 205 const std::string AccessibilityTreeFormatterBlink::GetAllowString() { |
| 203 return "@BLINK-ALLOW:"; | 206 return "@BLINK-ALLOW:"; |
| 204 } | 207 } |
| 205 | 208 |
| 206 const std::string AccessibilityTreeFormatterBlink::GetDenyString() { | 209 const std::string AccessibilityTreeFormatterBlink::GetDenyString() { |
| 207 return "@BLINK-DENY:"; | 210 return "@BLINK-DENY:"; |
| 208 } | 211 } |
| 209 | 212 |
| 210 } // namespace content | 213 } // namespace content |
| OLD | NEW |