OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <oleacc.h> | 7 #include <oleacc.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 Add(false, *it); | 83 Add(false, *it); |
84 } | 84 } |
85 for (std::vector<string16>::const_iterator it = ia2_attributes.begin(); | 85 for (std::vector<string16>::const_iterator it = ia2_attributes.begin(); |
86 it != ia2_attributes.end(); | 86 it != ia2_attributes.end(); |
87 ++it) { | 87 ++it) { |
88 Add(false, *it); | 88 Add(false, *it); |
89 } | 89 } |
90 Add(false, L"role_name='" + acc_obj->role_name() + L"'"); | 90 Add(false, L"role_name='" + acc_obj->role_name() + L"'"); |
91 VARIANT currentValue; | 91 VARIANT currentValue; |
92 if (acc_obj->get_currentValue(¤tValue) == S_OK) | 92 if (acc_obj->get_currentValue(¤tValue) == S_OK) |
93 Add(false, StringPrintf(L"currentValue=%.2f", V_R8(¤tValue))); | 93 Add(false, base::StringPrintf(L"currentValue=%.2f", V_R8(¤tValue))); |
94 VARIANT minimumValue; | 94 VARIANT minimumValue; |
95 if (acc_obj->get_minimumValue(&minimumValue) == S_OK) | 95 if (acc_obj->get_minimumValue(&minimumValue) == S_OK) |
96 Add(false, StringPrintf(L"minimumValue=%.2f", V_R8(&minimumValue))); | 96 Add(false, base::StringPrintf(L"minimumValue=%.2f", V_R8(&minimumValue))); |
97 VARIANT maximumValue; | 97 VARIANT maximumValue; |
98 if (acc_obj->get_maximumValue(&maximumValue) == S_OK) | 98 if (acc_obj->get_maximumValue(&maximumValue) == S_OK) |
99 Add(false, StringPrintf(L"maximumValue=%.2f", V_R8(&maximumValue))); | 99 Add(false, base::StringPrintf(L"maximumValue=%.2f", V_R8(&maximumValue))); |
100 Add(false, L"description='" + description + L"'"); | 100 Add(false, L"description='" + description + L"'"); |
101 Add(false, L"default_action='" + default_action + L"'"); | 101 Add(false, L"default_action='" + default_action + L"'"); |
102 Add(false, L"keyboard_shortcut='" + keyboard_shortcut + L"'"); | 102 Add(false, L"keyboard_shortcut='" + keyboard_shortcut + L"'"); |
103 BrowserAccessibility* root = node->manager()->GetRoot(); | 103 BrowserAccessibility* root = node->manager()->GetRoot(); |
104 LONG left, top, width, height; | 104 LONG left, top, width, height; |
105 LONG root_left, root_top, root_width, root_height; | 105 LONG root_left, root_top, root_width, root_height; |
106 if (S_FALSE != acc_obj->accLocation( | 106 if (S_FALSE != acc_obj->accLocation( |
107 &left, &top, &width, &height, variant_self) && | 107 &left, &top, &width, &height, variant_self) && |
108 S_FALSE != root->ToBrowserAccessibilityWin()->accLocation( | 108 S_FALSE != root->ToBrowserAccessibilityWin()->accLocation( |
109 &root_left, &root_top, &root_width, &root_height, variant_self)) { | 109 &root_left, &root_top, &root_width, &root_height, variant_self)) { |
110 Add(false, StringPrintf(L"location=(%d, %d)", | 110 Add(false, base::StringPrintf(L"location=(%d, %d)", |
111 left - root_left, top - root_top)); | 111 left - root_left, top - root_top)); |
112 Add(false, StringPrintf(L"size=(%d, %d)", width, height)); | 112 Add(false, base::StringPrintf(L"size=(%d, %d)", width, height)); |
113 } | 113 } |
114 LONG index_in_parent; | 114 LONG index_in_parent; |
115 if (acc_obj->get_indexInParent(&index_in_parent) == S_OK) | 115 if (acc_obj->get_indexInParent(&index_in_parent) == S_OK) |
116 Add(false, StringPrintf(L"index_in_parent=%d", index_in_parent)); | 116 Add(false, base::StringPrintf(L"index_in_parent=%d", index_in_parent)); |
117 LONG n_relations; | 117 LONG n_relations; |
118 if (acc_obj->get_nRelations(&n_relations) == S_OK) | 118 if (acc_obj->get_nRelations(&n_relations) == S_OK) |
119 Add(false, StringPrintf(L"n_relations=%d", n_relations)); | 119 Add(false, base::StringPrintf(L"n_relations=%d", n_relations)); |
120 LONG group_level, similar_items_in_group, position_in_group; | 120 LONG group_level, similar_items_in_group, position_in_group; |
121 if (acc_obj->get_groupPosition(&group_level, | 121 if (acc_obj->get_groupPosition(&group_level, |
122 &similar_items_in_group, | 122 &similar_items_in_group, |
123 &position_in_group) == S_OK) { | 123 &position_in_group) == S_OK) { |
124 Add(false, StringPrintf(L"group_level=%d", group_level)); | 124 Add(false, base::StringPrintf(L"group_level=%d", group_level)); |
125 Add(false, StringPrintf(L"similar_items_in_group=%d", | 125 Add(false, base::StringPrintf(L"similar_items_in_group=%d", |
126 similar_items_in_group)); | 126 similar_items_in_group)); |
127 Add(false, StringPrintf(L"position_in_group=%d", position_in_group)); | 127 Add(false, base::StringPrintf(L"position_in_group=%d", position_in_group)); |
128 } | 128 } |
129 LONG table_rows; | 129 LONG table_rows; |
130 if (acc_obj->get_nRows(&table_rows) == S_OK) | 130 if (acc_obj->get_nRows(&table_rows) == S_OK) |
131 Add(false, StringPrintf(L"table_rows=%d", table_rows)); | 131 Add(false, base::StringPrintf(L"table_rows=%d", table_rows)); |
132 LONG table_columns; | 132 LONG table_columns; |
133 if (acc_obj->get_nRows(&table_columns) == S_OK) | 133 if (acc_obj->get_nRows(&table_columns) == S_OK) |
134 Add(false, StringPrintf(L"table_columns=%d", table_columns)); | 134 Add(false, base::StringPrintf(L"table_columns=%d", table_columns)); |
135 LONG row_index; | 135 LONG row_index; |
136 if (acc_obj->get_rowIndex(&row_index) == S_OK) | 136 if (acc_obj->get_rowIndex(&row_index) == S_OK) |
137 Add(false, StringPrintf(L"row_index=%d", row_index)); | 137 Add(false, base::StringPrintf(L"row_index=%d", row_index)); |
138 LONG column_index; | 138 LONG column_index; |
139 if (acc_obj->get_columnIndex(&column_index) == S_OK) | 139 if (acc_obj->get_columnIndex(&column_index) == S_OK) |
140 Add(false, StringPrintf(L"column_index=%d", column_index)); | 140 Add(false, base::StringPrintf(L"column_index=%d", column_index)); |
141 LONG n_characters; | 141 LONG n_characters; |
142 if (acc_obj->get_nCharacters(&n_characters) == S_OK) | 142 if (acc_obj->get_nCharacters(&n_characters) == S_OK) |
143 Add(false, StringPrintf(L"n_characters=%d", n_characters)); | 143 Add(false, base::StringPrintf(L"n_characters=%d", n_characters)); |
144 LONG caret_offset; | 144 LONG caret_offset; |
145 if (acc_obj->get_caretOffset(&caret_offset) == S_OK) | 145 if (acc_obj->get_caretOffset(&caret_offset) == S_OK) |
146 Add(false, StringPrintf(L"caret_offset=%d", caret_offset)); | 146 Add(false, base::StringPrintf(L"caret_offset=%d", caret_offset)); |
147 LONG n_selections; | 147 LONG n_selections; |
148 if (acc_obj->get_nSelections(&n_selections) == S_OK) { | 148 if (acc_obj->get_nSelections(&n_selections) == S_OK) { |
149 Add(false, StringPrintf(L"n_selections=%d", n_selections)); | 149 Add(false, base::StringPrintf(L"n_selections=%d", n_selections)); |
150 if (n_selections > 0) { | 150 if (n_selections > 0) { |
151 LONG start, end; | 151 LONG start, end; |
152 if (acc_obj->get_selection(0, &start, &end) == S_OK) { | 152 if (acc_obj->get_selection(0, &start, &end) == S_OK) { |
153 Add(false, StringPrintf(L"selection_start=%d", start)); | 153 Add(false, base::StringPrintf(L"selection_start=%d", start)); |
154 Add(false, StringPrintf(L"selection_end=%d", end)); | 154 Add(false, base::StringPrintf(L"selection_end=%d", end)); |
155 } | 155 } |
156 } | 156 } |
157 } | 157 } |
158 | 158 |
159 return UTF8ToUTF16(prefix) + FinishLine() + ASCIIToUTF16("\n"); | 159 return UTF8ToUTF16(prefix) + FinishLine() + ASCIIToUTF16("\n"); |
160 } | 160 } |
161 | 161 |
162 // static | 162 // static |
163 const base::FilePath::StringType | 163 const base::FilePath::StringType |
164 AccessibilityTreeFormatter::GetActualFileSuffix() { | 164 AccessibilityTreeFormatter::GetActualFileSuffix() { |
(...skipping 15 matching lines...) Expand all Loading... |
180 const std::string AccessibilityTreeFormatter::GetAllowString() { | 180 const std::string AccessibilityTreeFormatter::GetAllowString() { |
181 return "@WIN-ALLOW:"; | 181 return "@WIN-ALLOW:"; |
182 } | 182 } |
183 | 183 |
184 // static | 184 // static |
185 const std::string AccessibilityTreeFormatter::GetDenyString() { | 185 const std::string AccessibilityTreeFormatter::GetDenyString() { |
186 return "@WIN-DENY:"; | 186 return "@WIN-DENY:"; |
187 } | 187 } |
188 | 188 |
189 } // namespace content | 189 } // namespace content |
OLD | NEW |