Chromium Code Reviews| 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 void DumpAccessibilityTreeHelper::DumpAccessibilityTree( | |
| 10 BrowserAccessibility* node, string16* contents) { | |
| 11 RecursiveDumpAccessibilityTree(node, contents, 0); | |
| 12 } | |
| 13 | |
|
David Tseng
2012/03/06 23:49:05
nit: extra line.
dmazzoni
2012/03/08 07:10:37
Done.
| |
| 14 | |
| 15 void DumpAccessibilityTreeHelper::RecursiveDumpAccessibilityTree( | |
| 16 BrowserAccessibility* node, string16* contents, int indent) { | |
| 17 scoped_array<char> prefix(new char(indent + 1)); | |
| 18 for (int i = 0; i < indent; i++) | |
|
David Tseng
2012/03/06 23:49:05
nit: ++i
dmazzoni
2012/03/08 07:10:37
Done.
| |
| 19 prefix[i] = ' '; | |
| 20 prefix[indent] = 0; | |
|
David Tseng
2012/03/06 23:49:05
nit: 0 -> NULL for clearity?
dmazzoni
2012/03/08 07:10:37
I think NULL is only supposed to be for pointers.
| |
| 21 | |
| 22 *contents += ToString(node, prefix.get()); | |
| 23 for (size_t i = 0; i < node->children().size(); ++i) { | |
| 24 RecursiveDumpAccessibilityTree(node->children()[i], contents, indent + 4); | |
|
David Tseng
2012/03/06 23:49:05
nit: define the indent step as a constant somewher
dmazzoni
2012/03/08 07:10:37
Done.
| |
| 25 } | |
| 26 } | |
| OLD | NEW |