Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: content/browser/accessibility/one_shot_accessibility_tree_search.cc

Issue 1435113003: Make use of new AX name calc in Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix issue with ariaTextAlternative Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698