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