OLD | NEW |
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 dict->SetBoolean("invisible", !android_node->IsVisibleToUser()); | 70 dict->SetBoolean("invisible", !android_node->IsVisibleToUser()); |
71 | 71 |
72 // String attributes. | 72 // String attributes. |
73 dict->SetString("name", android_node->GetText()); | 73 dict->SetString("name", android_node->GetText()); |
74 | 74 |
75 // Int attributes. | 75 // Int attributes. |
76 dict->SetInteger("item_index", android_node->GetItemIndex()); | 76 dict->SetInteger("item_index", android_node->GetItemIndex()); |
77 dict->SetInteger("item_count", android_node->GetItemCount()); | 77 dict->SetInteger("item_count", android_node->GetItemCount()); |
78 } | 78 } |
79 | 79 |
80 bool AccessibilityTreeFormatter::IncludeChildren( | |
81 const BrowserAccessibility& node) { | |
82 const BrowserAccessibilityAndroid* android_node = | |
83 static_cast<const BrowserAccessibilityAndroid*>(&node); | |
84 return !android_node->IsLeaf(); | |
85 } | |
86 | |
87 string16 AccessibilityTreeFormatter::ToString(const DictionaryValue& dict, | 80 string16 AccessibilityTreeFormatter::ToString(const DictionaryValue& dict, |
88 const string16& indent) { | 81 const string16& indent) { |
89 string16 line; | 82 string16 line; |
90 | 83 |
91 string16 class_value; | 84 string16 class_value; |
92 dict.GetString("class", &class_value); | 85 dict.GetString("class", &class_value); |
93 WriteAttribute(true, UTF16ToUTF8(class_value), &line); | 86 WriteAttribute(true, UTF16ToUTF8(class_value), &line); |
94 | 87 |
95 for (unsigned i = 0; i < arraysize(BOOL_ATTRIBUTES); i++) { | 88 for (unsigned i = 0; i < arraysize(BOOL_ATTRIBUTES); i++) { |
96 const char* attribute_name = BOOL_ATTRIBUTES[i]; | 89 const char* attribute_name = BOOL_ATTRIBUTES[i]; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 const std::string AccessibilityTreeFormatter::GetAllowString() { | 136 const std::string AccessibilityTreeFormatter::GetAllowString() { |
144 return "@ANDROID-ALLOW:"; | 137 return "@ANDROID-ALLOW:"; |
145 } | 138 } |
146 | 139 |
147 // static | 140 // static |
148 const std::string AccessibilityTreeFormatter::GetDenyString() { | 141 const std::string AccessibilityTreeFormatter::GetDenyString() { |
149 return "@ANDROID-DENY:"; | 142 return "@ANDROID-DENY:"; |
150 } | 143 } |
151 | 144 |
152 } // namespace content | 145 } // namespace content |
OLD | NEW |