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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 "range_min", | 61 "range_min", |
62 "range_max", | 62 "range_max", |
63 "range_current_value", | 63 "range_current_value", |
64 }; | 64 }; |
65 } | 65 } |
66 | 66 |
67 void AccessibilityTreeFormatter::Initialize() { | 67 void AccessibilityTreeFormatter::Initialize() { |
68 } | 68 } |
69 | 69 |
70 void AccessibilityTreeFormatter::AddProperties( | 70 void AccessibilityTreeFormatter::AddProperties( |
71 const BrowserAccessibility& node, DictionaryValue* dict) { | 71 const BrowserAccessibility& node, base::DictionaryValue* dict) { |
72 const BrowserAccessibilityAndroid* android_node = | 72 const BrowserAccessibilityAndroid* android_node = |
73 static_cast<const BrowserAccessibilityAndroid*>(&node); | 73 static_cast<const BrowserAccessibilityAndroid*>(&node); |
74 | 74 |
75 // Class name. | 75 // Class name. |
76 dict->SetString("class", android_node->GetClassName()); | 76 dict->SetString("class", android_node->GetClassName()); |
77 | 77 |
78 // Bool attributes. | 78 // Bool attributes. |
79 dict->SetBoolean("checkable", android_node->IsCheckable()); | 79 dict->SetBoolean("checkable", android_node->IsCheckable()); |
80 dict->SetBoolean("checked", android_node->IsChecked()); | 80 dict->SetBoolean("checked", android_node->IsChecked()); |
81 dict->SetBoolean("clickable", android_node->IsClickable()); | 81 dict->SetBoolean("clickable", android_node->IsClickable()); |
(...skipping 27 matching lines...) Expand all Loading... |
109 dict->SetInteger("column_span", android_node->ColumnSpan()); | 109 dict->SetInteger("column_span", android_node->ColumnSpan()); |
110 dict->SetInteger("input_type", android_node->AndroidInputType()); | 110 dict->SetInteger("input_type", android_node->AndroidInputType()); |
111 dict->SetInteger("live_region_type", android_node->AndroidLiveRegionType()); | 111 dict->SetInteger("live_region_type", android_node->AndroidLiveRegionType()); |
112 dict->SetInteger("range_min", static_cast<int>(android_node->RangeMin())); | 112 dict->SetInteger("range_min", static_cast<int>(android_node->RangeMin())); |
113 dict->SetInteger("range_max", static_cast<int>(android_node->RangeMax())); | 113 dict->SetInteger("range_max", static_cast<int>(android_node->RangeMax())); |
114 dict->SetInteger("range_current_value", | 114 dict->SetInteger("range_current_value", |
115 static_cast<int>(android_node->RangeCurrentValue())); | 115 static_cast<int>(android_node->RangeCurrentValue())); |
116 } | 116 } |
117 | 117 |
118 base::string16 AccessibilityTreeFormatter::ToString( | 118 base::string16 AccessibilityTreeFormatter::ToString( |
119 const DictionaryValue& dict, | 119 const base::DictionaryValue& dict, |
120 const base::string16& indent) { | 120 const base::string16& indent) { |
121 base::string16 line; | 121 base::string16 line; |
122 | 122 |
123 base::string16 class_value; | 123 base::string16 class_value; |
124 dict.GetString("class", &class_value); | 124 dict.GetString("class", &class_value); |
125 WriteAttribute(true, UTF16ToUTF8(class_value), &line); | 125 WriteAttribute(true, UTF16ToUTF8(class_value), &line); |
126 | 126 |
127 for (unsigned i = 0; i < arraysize(BOOL_ATTRIBUTES); i++) { | 127 for (unsigned i = 0; i < arraysize(BOOL_ATTRIBUTES); i++) { |
128 const char* attribute_name = BOOL_ATTRIBUTES[i]; | 128 const char* attribute_name = BOOL_ATTRIBUTES[i]; |
129 bool value; | 129 bool value; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 const std::string AccessibilityTreeFormatter::GetAllowString() { | 175 const std::string AccessibilityTreeFormatter::GetAllowString() { |
176 return "@ANDROID-ALLOW:"; | 176 return "@ANDROID-ALLOW:"; |
177 } | 177 } |
178 | 178 |
179 // static | 179 // static |
180 const std::string AccessibilityTreeFormatter::GetDenyString() { | 180 const std::string AccessibilityTreeFormatter::GetDenyString() { |
181 return "@ANDROID-DENY:"; | 181 return "@ANDROID-DENY:"; |
182 } | 182 } |
183 | 183 |
184 } // namespace content | 184 } // namespace content |
OLD | NEW |