| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 void AccessibilityTreeFormatter::FormatAccessibilityTree( | 57 void AccessibilityTreeFormatter::FormatAccessibilityTree( |
| 58 string16* contents) { | 58 string16* contents) { |
| 59 scoped_ptr<base::DictionaryValue> dict = BuildAccessibilityTree(); | 59 scoped_ptr<base::DictionaryValue> dict = BuildAccessibilityTree(); |
| 60 RecursiveFormatAccessibilityTree(*(dict.get()), contents); | 60 RecursiveFormatAccessibilityTree(*(dict.get()), contents); |
| 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 ListValue* children = new ListValue; | 67 base::ListValue* children = new base::ListValue; |
| 68 dict->Set(kChildrenDictAttr, children); | 68 dict->Set(kChildrenDictAttr, children); |
| 69 if (!IncludeChildren(node)) | 69 if (!IncludeChildren(node)) |
| 70 return; | 70 return; |
| 71 | 71 |
| 72 for (size_t i = 0; i < node.children().size(); ++i) { | 72 for (size_t i = 0; i < node.children().size(); ++i) { |
| 73 BrowserAccessibility* child_node = node.children()[i]; | 73 BrowserAccessibility* child_node = node.children()[i]; |
| 74 base::DictionaryValue* child_dict = new base::DictionaryValue; | 74 base::DictionaryValue* child_dict = new base::DictionaryValue; |
| 75 children->Append(child_dict); | 75 children->Append(child_dict); |
| 76 RecursiveBuildAccessibilityTree(*child_node, child_dict); | 76 RecursiveBuildAccessibilityTree(*child_node, child_dict); |
| 77 } | 77 } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 if (attr.empty()) | 187 if (attr.empty()) |
| 188 return; | 188 return; |
| 189 if (!MatchesFilters(attr, include_by_default)) | 189 if (!MatchesFilters(attr, include_by_default)) |
| 190 return; | 190 return; |
| 191 if (!line->empty()) | 191 if (!line->empty()) |
| 192 *line += ASCIIToUTF16(" "); | 192 *line += ASCIIToUTF16(" "); |
| 193 *line += attr; | 193 *line += attr; |
| 194 } | 194 } |
| 195 | 195 |
| 196 } // namespace content | 196 } // namespace content |
| OLD | NEW |