| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 AccessibilityTreeFormatter::~AccessibilityTreeFormatter() { | 34 AccessibilityTreeFormatter::~AccessibilityTreeFormatter() { |
| 35 } | 35 } |
| 36 | 36 |
| 37 scoped_ptr<base::DictionaryValue> | 37 scoped_ptr<base::DictionaryValue> |
| 38 AccessibilityTreeFormatter::BuildAccessibilityTree( | 38 AccessibilityTreeFormatter::BuildAccessibilityTree( |
| 39 BrowserAccessibility* root) { | 39 BrowserAccessibility* root) { |
| 40 CHECK(root); | 40 CHECK(root); |
| 41 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue); | 41 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue); |
| 42 RecursiveBuildAccessibilityTree(*root, dict.get()); | 42 RecursiveBuildAccessibilityTree(*root, dict.get()); |
| 43 return dict.Pass(); | 43 return dict; |
| 44 } | 44 } |
| 45 | 45 |
| 46 void AccessibilityTreeFormatter::FormatAccessibilityTree( | 46 void AccessibilityTreeFormatter::FormatAccessibilityTree( |
| 47 BrowserAccessibility* root, base::string16* contents) { | 47 BrowserAccessibility* root, base::string16* contents) { |
| 48 scoped_ptr<base::DictionaryValue> dict = BuildAccessibilityTree(root); | 48 scoped_ptr<base::DictionaryValue> dict = BuildAccessibilityTree(root); |
| 49 RecursiveFormatAccessibilityTree(*(dict.get()), contents); | 49 RecursiveFormatAccessibilityTree(*(dict.get()), contents); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void AccessibilityTreeFormatter::RecursiveBuildAccessibilityTree( | 52 void AccessibilityTreeFormatter::RecursiveBuildAccessibilityTree( |
| 53 const BrowserAccessibility& node, base::DictionaryValue* dict) { | 53 const BrowserAccessibility& node, base::DictionaryValue* dict) { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 if (attr.empty()) | 147 if (attr.empty()) |
| 148 return; | 148 return; |
| 149 if (!MatchesFilters(attr, include_by_default)) | 149 if (!MatchesFilters(attr, include_by_default)) |
| 150 return; | 150 return; |
| 151 if (!line->empty()) | 151 if (!line->empty()) |
| 152 *line += base::ASCIIToUTF16(" "); | 152 *line += base::ASCIIToUTF16(" "); |
| 153 *line += attr; | 153 *line += attr; |
| 154 } | 154 } |
| 155 | 155 |
| 156 } // namespace content | 156 } // namespace content |
| OLD | NEW |