OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/browser/accessibility/dump_accessibility_tree_helper.h" |
| 6 |
| 7 #include "base/memory/scoped_ptr.h" |
| 8 |
| 9 namespace { |
| 10 const int kIndentSpaces = 4; |
| 11 } |
| 12 |
| 13 void DumpAccessibilityTreeHelper::DumpAccessibilityTree( |
| 14 BrowserAccessibility* node, string16* contents) { |
| 15 RecursiveDumpAccessibilityTree(node, contents, 0); |
| 16 } |
| 17 |
| 18 void DumpAccessibilityTreeHelper::RecursiveDumpAccessibilityTree( |
| 19 BrowserAccessibility* node, string16* contents, int indent) { |
| 20 scoped_array<char> prefix(new char[indent + 1]); |
| 21 for (int i = 0; i < indent; ++i) |
| 22 prefix[i] = ' '; |
| 23 prefix[indent] = '\0'; |
| 24 |
| 25 *contents += ToString(node, prefix.get()); |
| 26 for (size_t i = 0; i < node->children().size(); ++i) { |
| 27 RecursiveDumpAccessibilityTree(node->children()[i], contents, |
| 28 indent + kIndentSpaces); |
| 29 } |
| 30 } |
OLD | NEW |