OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/one_shot_accessibility_tree_search.h" | 5 #include "content/browser/accessibility/one_shot_accessibility_tree_search.h" |
6 | 6 |
7 #include "base/i18n/case_conversion.h" | 7 #include "base/i18n/case_conversion.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "content/browser/accessibility/browser_accessibility.h" | 10 #include "content/browser/accessibility/browser_accessibility.h" |
11 #include "content/browser/accessibility/browser_accessibility_manager.h" | 11 #include "content/browser/accessibility/browser_accessibility_manager.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 // Given a node, populate a vector with all of the strings from that node's | 15 // Given a node, populate a vector with all of the strings from that node's |
16 // attributes that might be relevant for a text search. | 16 // attributes that might be relevant for a text search. |
17 void GetNodeStrings(BrowserAccessibility* node, | 17 void GetNodeStrings(BrowserAccessibility* node, |
18 std::vector<base::string16>* strings) { | 18 std::vector<base::string16>* strings) { |
19 if (node->HasStringAttribute(ui::AX_ATTR_NAME)) | 19 if (node->HasStringAttribute(ui::AX_ATTR_NAME)) |
20 strings->push_back(node->GetString16Attribute(ui::AX_ATTR_NAME)); | 20 strings->push_back(node->GetString16Attribute(ui::AX_ATTR_NAME)); |
21 if (node->HasStringAttribute(ui::AX_ATTR_DESCRIPTION)) | 21 if (node->HasStringAttribute(ui::AX_ATTR_DESCRIPTION)) |
22 strings->push_back(node->GetString16Attribute(ui::AX_ATTR_DESCRIPTION)); | 22 strings->push_back(node->GetString16Attribute(ui::AX_ATTR_DESCRIPTION)); |
23 if (node->HasStringAttribute(ui::AX_ATTR_HELP)) | |
24 strings->push_back(node->GetString16Attribute(ui::AX_ATTR_HELP)); | |
25 if (node->HasStringAttribute(ui::AX_ATTR_VALUE)) | 23 if (node->HasStringAttribute(ui::AX_ATTR_VALUE)) |
26 strings->push_back(node->GetString16Attribute(ui::AX_ATTR_VALUE)); | 24 strings->push_back(node->GetString16Attribute(ui::AX_ATTR_VALUE)); |
27 if (node->HasStringAttribute(ui::AX_ATTR_PLACEHOLDER)) | 25 if (node->HasStringAttribute(ui::AX_ATTR_PLACEHOLDER)) |
28 strings->push_back(node->GetString16Attribute(ui::AX_ATTR_PLACEHOLDER)); | 26 strings->push_back(node->GetString16Attribute(ui::AX_ATTR_PLACEHOLDER)); |
29 } | 27 } |
30 | 28 |
31 OneShotAccessibilityTreeSearch::OneShotAccessibilityTreeSearch( | 29 OneShotAccessibilityTreeSearch::OneShotAccessibilityTreeSearch( |
32 BrowserAccessibility* scope) | 30 BrowserAccessibility* scope) |
33 : tree_(scope->manager()), | 31 : tree_(scope->manager()), |
34 scope_node_(scope), | 32 scope_node_(scope), |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 } | 202 } |
205 } | 203 } |
206 if (!found_text_match) | 204 if (!found_text_match) |
207 return false; | 205 return false; |
208 } | 206 } |
209 | 207 |
210 return true; | 208 return true; |
211 } | 209 } |
212 | 210 |
213 } // namespace content | 211 } // namespace content |
OLD | NEW |