| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 std::vector<base::string16> state_strings; | 182 std::vector<base::string16> state_strings; |
| 183 int32_t ia_state = ax_object->ia_state(); | 183 int32_t ia_state = ax_object->ia_state(); |
| 184 | 184 |
| 185 // Avoid flakiness: these states depend on whether the window is focused | 185 // Avoid flakiness: these states depend on whether the window is focused |
| 186 // and the position of the mouse cursor. | 186 // and the position of the mouse cursor. |
| 187 ia_state &= ~STATE_SYSTEM_HOTTRACKED; | 187 ia_state &= ~STATE_SYSTEM_HOTTRACKED; |
| 188 ia_state &= ~STATE_SYSTEM_OFFSCREEN; | 188 ia_state &= ~STATE_SYSTEM_OFFSCREEN; |
| 189 | 189 |
| 190 IAccessibleStateToStringVector(ia_state, &state_strings); | 190 IAccessibleStateToStringVector(ia_state, &state_strings); |
| 191 IAccessible2StateToStringVector(ax_object->ia2_state(), &state_strings); | 191 IAccessible2StateToStringVector(ax_object->ia2_state(), &state_strings); |
| 192 scoped_ptr<base::ListValue> states(new base::ListValue()); | 192 std::unique_ptr<base::ListValue> states(new base::ListValue()); |
| 193 for (const base::string16& state_string : state_strings) | 193 for (const base::string16& state_string : state_strings) |
| 194 states->AppendString(base::UTF16ToUTF8(state_string)); | 194 states->AppendString(base::UTF16ToUTF8(state_string)); |
| 195 dict->Set("states", std::move(states)); | 195 dict->Set("states", std::move(states)); |
| 196 | 196 |
| 197 const std::vector<base::string16>& ia2_attributes = | 197 const std::vector<base::string16>& ia2_attributes = |
| 198 ax_object->ia2_attributes(); | 198 ax_object->ia2_attributes(); |
| 199 scoped_ptr<base::ListValue> attributes(new base::ListValue()); | 199 std::unique_ptr<base::ListValue> attributes(new base::ListValue()); |
| 200 for (const base::string16& ia2_attribute : ia2_attributes) | 200 for (const base::string16& ia2_attribute : ia2_attributes) |
| 201 attributes->AppendString(base::UTF16ToUTF8(ia2_attribute)); | 201 attributes->AppendString(base::UTF16ToUTF8(ia2_attribute)); |
| 202 dict->Set("attributes", std::move(attributes)); | 202 dict->Set("attributes", std::move(attributes)); |
| 203 | 203 |
| 204 ax_object->ComputeStylesIfNeeded(); | 204 ax_object->ComputeStylesIfNeeded(); |
| 205 const std::map<int, std::vector<base::string16>>& ia2_text_attributes = | 205 const std::map<int, std::vector<base::string16>>& ia2_text_attributes = |
| 206 ax_object->offset_to_text_attributes(); | 206 ax_object->offset_to_text_attributes(); |
| 207 scoped_ptr<base::ListValue> text_attributes(new base::ListValue()); | 207 std::unique_ptr<base::ListValue> text_attributes(new base::ListValue()); |
| 208 for (const auto& style_span : ia2_text_attributes) { | 208 for (const auto& style_span : ia2_text_attributes) { |
| 209 int start_offset = style_span.first; | 209 int start_offset = style_span.first; |
| 210 text_attributes->AppendString("offset:" + base::IntToString(start_offset)); | 210 text_attributes->AppendString("offset:" + base::IntToString(start_offset)); |
| 211 for (const base::string16& text_attribute : style_span.second) | 211 for (const base::string16& text_attribute : style_span.second) |
| 212 text_attributes->AppendString(base::UTF16ToUTF8(text_attribute)); | 212 text_attributes->AppendString(base::UTF16ToUTF8(text_attribute)); |
| 213 } | 213 } |
| 214 dict->Set("text_attributes", std::move(text_attributes)); | 214 dict->Set("text_attributes", std::move(text_attributes)); |
| 215 | 215 |
| 216 dict->SetString("role_name", ax_object->role_name()); | 216 dict->SetString("role_name", ax_object->role_name()); |
| 217 dict->SetString("ia2_hypertext", GetIA2Hypertext(*ax_object)); | 217 dict->SetString("ia2_hypertext", GetIA2Hypertext(*ax_object)); |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 | 428 |
| 429 const std::string AccessibilityTreeFormatterWin::GetAllowString() { | 429 const std::string AccessibilityTreeFormatterWin::GetAllowString() { |
| 430 return "@WIN-ALLOW:"; | 430 return "@WIN-ALLOW:"; |
| 431 } | 431 } |
| 432 | 432 |
| 433 const std::string AccessibilityTreeFormatterWin::GetDenyString() { | 433 const std::string AccessibilityTreeFormatterWin::GetDenyString() { |
| 434 return "@WIN-DENY:"; | 434 return "@WIN-DENY:"; |
| 435 } | 435 } |
| 436 | 436 |
| 437 } // namespace content | 437 } // namespace content |
| OLD | NEW |