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

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

Issue 1654193002: Include a role description string in node info for Android accessibility. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update all Android test expectations Created 4 years, 10 months 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <string> 7 #include <string>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_string.h" 10 #include "base/android/jni_string.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 dict->SetBoolean("invisible", !android_node->IsVisibleToUser()); 120 dict->SetBoolean("invisible", !android_node->IsVisibleToUser());
121 dict->SetBoolean("link", android_node->IsLink()); 121 dict->SetBoolean("link", android_node->IsLink());
122 dict->SetBoolean("multiline", android_node->IsMultiLine()); 122 dict->SetBoolean("multiline", android_node->IsMultiLine());
123 dict->SetBoolean("range", android_node->IsRangeType()); 123 dict->SetBoolean("range", android_node->IsRangeType());
124 dict->SetBoolean("password", android_node->IsPassword()); 124 dict->SetBoolean("password", android_node->IsPassword());
125 dict->SetBoolean("scrollable", android_node->IsScrollable()); 125 dict->SetBoolean("scrollable", android_node->IsScrollable());
126 dict->SetBoolean("selected", android_node->IsSelected()); 126 dict->SetBoolean("selected", android_node->IsSelected());
127 127
128 // String attributes. 128 // String attributes.
129 dict->SetString("name", android_node->GetText()); 129 dict->SetString("name", android_node->GetText());
130 dict->SetString("role_description", android_node->GetRoleDescription());
130 131
131 // Int attributes. 132 // Int attributes.
132 dict->SetInteger("item_index", android_node->GetItemIndex()); 133 dict->SetInteger("item_index", android_node->GetItemIndex());
133 dict->SetInteger("item_count", android_node->GetItemCount()); 134 dict->SetInteger("item_count", android_node->GetItemCount());
134 dict->SetInteger("row_count", android_node->RowCount()); 135 dict->SetInteger("row_count", android_node->RowCount());
135 dict->SetInteger("column_count", android_node->ColumnCount()); 136 dict->SetInteger("column_count", android_node->ColumnCount());
136 dict->SetInteger("row_index", android_node->RowIndex()); 137 dict->SetInteger("row_index", android_node->RowIndex());
137 dict->SetInteger("row_span", android_node->RowSpan()); 138 dict->SetInteger("row_span", android_node->RowSpan());
138 dict->SetInteger("column_index", android_node->ColumnIndex()); 139 dict->SetInteger("column_index", android_node->ColumnIndex());
139 dict->SetInteger("column_span", android_node->ColumnSpan()); 140 dict->SetInteger("column_span", android_node->ColumnSpan());
(...skipping 24 matching lines...) Expand all
164 if (show_ids()) { 165 if (show_ids()) {
165 int id_value; 166 int id_value;
166 dict.GetInteger("id", &id_value); 167 dict.GetInteger("id", &id_value);
167 WriteAttribute(true, base::IntToString16(id_value), &line); 168 WriteAttribute(true, base::IntToString16(id_value), &line);
168 } 169 }
169 170
170 base::string16 class_value; 171 base::string16 class_value;
171 dict.GetString("class", &class_value); 172 dict.GetString("class", &class_value);
172 WriteAttribute(true, base::UTF16ToUTF8(class_value), &line); 173 WriteAttribute(true, base::UTF16ToUTF8(class_value), &line);
173 174
175 std::string role_description;
176 dict.GetString("role_description", &role_description);
177 if (!role_description.empty()) {
178 WriteAttribute(
179 true,
180 StringPrintf("role_description='%s'", role_description.c_str()),
181 &line);
182 }
183
174 for (unsigned i = 0; i < arraysize(BOOL_ATTRIBUTES); i++) { 184 for (unsigned i = 0; i < arraysize(BOOL_ATTRIBUTES); i++) {
175 const char* attribute_name = BOOL_ATTRIBUTES[i]; 185 const char* attribute_name = BOOL_ATTRIBUTES[i];
176 bool value; 186 bool value;
177 if (dict.GetBoolean(attribute_name, &value) && value) 187 if (dict.GetBoolean(attribute_name, &value) && value)
178 WriteAttribute(true, attribute_name, &line); 188 WriteAttribute(true, attribute_name, &line);
179 } 189 }
180 190
181 for (unsigned i = 0; i < arraysize(STRING_ATTRIBUTES); i++) { 191 for (unsigned i = 0; i < arraysize(STRING_ATTRIBUTES); i++) {
182 const char* attribute_name = STRING_ATTRIBUTES[i]; 192 const char* attribute_name = STRING_ATTRIBUTES[i];
183 std::string value; 193 std::string value;
(...skipping 28 matching lines...) Expand all
212 222
213 const std::string AccessibilityTreeFormatterAndroid::GetAllowString() { 223 const std::string AccessibilityTreeFormatterAndroid::GetAllowString() {
214 return "@ANDROID-ALLOW:"; 224 return "@ANDROID-ALLOW:";
215 } 225 }
216 226
217 const std::string AccessibilityTreeFormatterAndroid::GetDenyString() { 227 const std::string AccessibilityTreeFormatterAndroid::GetDenyString() {
218 return "@ANDROID-DENY:"; 228 return "@ANDROID-DENY:";
219 } 229 }
220 230
221 } // namespace content 231 } // namespace content
OLDNEW
« no previous file with comments | « content/app/strings/content_strings.grd ('k') | content/browser/accessibility/browser_accessibility_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698