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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 } | 59 } |
60 | 60 |
61 void AccessibilityTreeFormatter::RecursiveBuildAccessibilityTree( | 61 void AccessibilityTreeFormatter::RecursiveBuildAccessibilityTree( |
62 const BrowserAccessibility& node, base::DictionaryValue* dict) { | 62 const BrowserAccessibility& node, base::DictionaryValue* dict) { |
63 AddProperties(node, dict); | 63 AddProperties(node, dict); |
64 | 64 |
65 base::ListValue* children = new base::ListValue; | 65 base::ListValue* children = new base::ListValue; |
66 dict->Set(kChildrenDictAttr, children); | 66 dict->Set(kChildrenDictAttr, children); |
67 | 67 |
68 for (size_t i = 0; i < node.PlatformChildCount(); ++i) { | 68 for (size_t i = 0; i < node.PlatformChildCount(); ++i) { |
69 BrowserAccessibility* child_node = node.InternalGetChild(i); | 69 BrowserAccessibility* child_node = node.PlatformGetChild(i); |
70 base::DictionaryValue* child_dict = new base::DictionaryValue; | 70 base::DictionaryValue* child_dict = new base::DictionaryValue; |
71 children->Append(child_dict); | 71 children->Append(child_dict); |
72 RecursiveBuildAccessibilityTree(*child_node, child_dict); | 72 RecursiveBuildAccessibilityTree(*child_node, child_dict); |
73 } | 73 } |
74 } | 74 } |
75 | 75 |
76 void AccessibilityTreeFormatter::RecursiveFormatAccessibilityTree( | 76 void AccessibilityTreeFormatter::RecursiveFormatAccessibilityTree( |
77 const base::DictionaryValue& dict, base::string16* contents, int depth) { | 77 const base::DictionaryValue& dict, base::string16* contents, int depth) { |
78 base::string16 line = | 78 base::string16 line = |
79 ToString(dict, base::string16(depth * kIndentSpaces, ' ')); | 79 ToString(dict, base::string16(depth * kIndentSpaces, ' ')); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 if (attr.empty()) | 178 if (attr.empty()) |
179 return; | 179 return; |
180 if (!MatchesFilters(attr, include_by_default)) | 180 if (!MatchesFilters(attr, include_by_default)) |
181 return; | 181 return; |
182 if (!line->empty()) | 182 if (!line->empty()) |
183 *line += base::ASCIIToUTF16(" "); | 183 *line += base::ASCIIToUTF16(" "); |
184 *line += attr; | 184 *line += attr; |
185 } | 185 } |
186 | 186 |
187 } // namespace content | 187 } // namespace content |
OLD | NEW |