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> | 5 #include <stddef.h> |
6 | 6 |
| 7 #include <utility> |
| 8 |
| 9 #include "base/memory/ptr_util.h" |
7 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
8 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 #include "base/values.h" |
9 #include "content/browser/accessibility/accessibility_tree_formatter_blink.h" | 13 #include "content/browser/accessibility/accessibility_tree_formatter_blink.h" |
10 #include "content/browser/accessibility/browser_accessibility_manager.h" | 14 #include "content/browser/accessibility/browser_accessibility_manager.h" |
11 #include "ui/gfx/geometry/rect_conversions.h" | 15 #include "ui/gfx/geometry/rect_conversions.h" |
12 #include "ui/gfx/transform.h" | 16 #include "ui/gfx/transform.h" |
13 | 17 |
14 namespace content { | 18 namespace content { |
15 | 19 |
16 AccessibilityTreeFormatterBlink::AccessibilityTreeFormatterBlink() | 20 AccessibilityTreeFormatterBlink::AccessibilityTreeFormatterBlink() |
17 : AccessibilityTreeFormatter() { | 21 : AccessibilityTreeFormatter() { |
18 } | 22 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 dict->SetBoolean(ui::ToString(attr), node.GetBoolAttribute(attr)); | 116 dict->SetBoolean(ui::ToString(attr), node.GetBoolAttribute(attr)); |
113 } | 117 } |
114 | 118 |
115 for (int attr_index = ui::AX_INT_LIST_ATTRIBUTE_NONE; | 119 for (int attr_index = ui::AX_INT_LIST_ATTRIBUTE_NONE; |
116 attr_index <= ui::AX_INT_LIST_ATTRIBUTE_LAST; | 120 attr_index <= ui::AX_INT_LIST_ATTRIBUTE_LAST; |
117 ++attr_index) { | 121 ++attr_index) { |
118 auto attr = static_cast<ui::AXIntListAttribute>(attr_index); | 122 auto attr = static_cast<ui::AXIntListAttribute>(attr_index); |
119 if (node.HasIntListAttribute(attr)) { | 123 if (node.HasIntListAttribute(attr)) { |
120 std::vector<int32_t> values; | 124 std::vector<int32_t> values; |
121 node.GetIntListAttribute(attr, &values); | 125 node.GetIntListAttribute(attr, &values); |
122 base::ListValue* value_list = new base::ListValue; | 126 auto value_list = base::MakeUnique<base::ListValue>(); |
123 for (size_t i = 0; i < values.size(); ++i) { | 127 for (size_t i = 0; i < values.size(); ++i) { |
124 if (ui::IsNodeIdIntListAttribute(attr)) { | 128 if (ui::IsNodeIdIntListAttribute(attr)) { |
125 BrowserAccessibility* target = node.manager()->GetFromID(values[i]); | 129 BrowserAccessibility* target = node.manager()->GetFromID(values[i]); |
126 if (target) | 130 if (target) |
127 value_list->AppendString(ui::ToString(target->GetData().role)); | 131 value_list->AppendString(ui::ToString(target->GetData().role)); |
128 else | 132 else |
129 value_list->AppendString("null"); | 133 value_list->AppendString("null"); |
130 } else { | 134 } else { |
131 value_list->AppendInteger(values[i]); | 135 value_list->AppendInteger(values[i]); |
132 } | 136 } |
133 } | 137 } |
134 dict->Set(ui::ToString(attr), value_list); | 138 dict->Set(ui::ToString(attr), std::move(value_list)); |
135 } | 139 } |
136 } | 140 } |
137 } | 141 } |
138 | 142 |
139 base::string16 AccessibilityTreeFormatterBlink::ToString( | 143 base::string16 AccessibilityTreeFormatterBlink::ToString( |
140 const base::DictionaryValue& dict) { | 144 const base::DictionaryValue& dict) { |
141 base::string16 line; | 145 base::string16 line; |
142 | 146 |
143 if (show_ids()) { | 147 if (show_ids()) { |
144 int id_value; | 148 int id_value; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 280 |
277 const std::string AccessibilityTreeFormatterBlink::GetAllowString() { | 281 const std::string AccessibilityTreeFormatterBlink::GetAllowString() { |
278 return "@BLINK-ALLOW:"; | 282 return "@BLINK-ALLOW:"; |
279 } | 283 } |
280 | 284 |
281 const std::string AccessibilityTreeFormatterBlink::GetDenyString() { | 285 const std::string AccessibilityTreeFormatterBlink::GetDenyString() { |
282 return "@BLINK-DENY:"; | 286 return "@BLINK-DENY:"; |
283 } | 287 } |
284 | 288 |
285 } // namespace content | 289 } // namespace content |
OLD | NEW |