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> |
| 8 |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/pattern.h" | 11 #include "base/strings/pattern.h" |
10 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
11 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
12 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
13 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
14 #include "content/browser/accessibility/browser_accessibility_manager.h" | 16 #include "content/browser/accessibility/browser_accessibility_manager.h" |
15 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 17 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
16 #include "content/browser/web_contents/web_contents_impl.h" | 18 #include "content/browser/web_contents/web_contents_impl.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 children->GetDictionary(i, &child_dict); | 83 children->GetDictionary(i, &child_dict); |
82 RecursiveFormatAccessibilityTree(*child_dict, contents, depth + 1); | 84 RecursiveFormatAccessibilityTree(*child_dict, contents, depth + 1); |
83 } | 85 } |
84 } | 86 } |
85 | 87 |
86 void AccessibilityTreeFormatter::SetFilters( | 88 void AccessibilityTreeFormatter::SetFilters( |
87 const std::vector<Filter>& filters) { | 89 const std::vector<Filter>& filters) { |
88 filters_ = filters; | 90 filters_ = filters; |
89 } | 91 } |
90 | 92 |
91 uint32 AccessibilityTreeFormatter::ChildCount( | 93 uint32_t AccessibilityTreeFormatter::ChildCount( |
92 const BrowserAccessibility& node) const{ | 94 const BrowserAccessibility& node) const { |
93 return node.PlatformChildCount(); | 95 return node.PlatformChildCount(); |
94 } | 96 } |
95 | 97 |
96 BrowserAccessibility* AccessibilityTreeFormatter::GetChild( | 98 BrowserAccessibility* AccessibilityTreeFormatter::GetChild( |
97 const BrowserAccessibility& node, uint32 i) const { | 99 const BrowserAccessibility& node, |
| 100 uint32_t i) const { |
98 return node.PlatformGetChild(i); | 101 return node.PlatformGetChild(i); |
99 } | 102 } |
100 | 103 |
101 // static | 104 // static |
102 bool AccessibilityTreeFormatter::MatchesFilters( | 105 bool AccessibilityTreeFormatter::MatchesFilters( |
103 const std::vector<Filter>& filters, | 106 const std::vector<Filter>& filters, |
104 const base::string16& text, | 107 const base::string16& text, |
105 bool default_result) { | 108 bool default_result) { |
106 std::vector<Filter>::const_iterator iter = filters.begin(); | 109 std::vector<Filter>::const_iterator iter = filters.begin(); |
107 bool allow = default_result; | 110 bool allow = default_result; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 if (attr.empty()) | 147 if (attr.empty()) |
145 return; | 148 return; |
146 if (!MatchesFilters(attr, include_by_default)) | 149 if (!MatchesFilters(attr, include_by_default)) |
147 return; | 150 return; |
148 if (!line->empty()) | 151 if (!line->empty()) |
149 *line += base::ASCIIToUTF16(" "); | 152 *line += base::ASCIIToUTF16(" "); |
150 *line += attr; | 153 *line += attr; |
151 } | 154 } |
152 | 155 |
153 } // namespace content | 156 } // namespace content |
OLD | NEW |