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/dump_accessibility_tree_helper.h" | 5 #include "content/browser/accessibility/dump_accessibility_tree_helper.h" |
6 | 6 |
7 #include <oleacc.h> | 7 #include <oleacc.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "content/browser/accessibility/browser_accessibility_manager.h" | |
15 #include "content/browser/accessibility/browser_accessibility_win.h" | 16 #include "content/browser/accessibility/browser_accessibility_win.h" |
16 #include "content/common/accessibility_node_data.h" | 17 #include "content/common/accessibility_node_data.h" |
17 #include "content/public/test/accessibility_test_utils_win.h" | 18 #include "content/public/test/accessibility_test_utils_win.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
19 #include "third_party/iaccessible2/ia2_api_all.h" | 20 #include "third_party/iaccessible2/ia2_api_all.h" |
20 #include "ui/base/win/atl_module.h" | 21 #include "ui/base/win/atl_module.h" |
21 | 22 |
22 namespace content { | 23 namespace content { |
23 | 24 |
24 void DumpAccessibilityTreeHelper::Initialize() { | 25 void DumpAccessibilityTreeHelper::Initialize() { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
93 Add(false, StringPrintf(L"currentValue=%.2f", V_R8(¤tValue))); | 94 Add(false, StringPrintf(L"currentValue=%.2f", V_R8(¤tValue))); |
94 VARIANT minimumValue; | 95 VARIANT minimumValue; |
95 if (acc_obj->get_minimumValue(&minimumValue) == S_OK) | 96 if (acc_obj->get_minimumValue(&minimumValue) == S_OK) |
96 Add(false, StringPrintf(L"minimumValue=%.2f", V_R8(&minimumValue))); | 97 Add(false, StringPrintf(L"minimumValue=%.2f", V_R8(&minimumValue))); |
97 VARIANT maximumValue; | 98 VARIANT maximumValue; |
98 if (acc_obj->get_maximumValue(&maximumValue) == S_OK) | 99 if (acc_obj->get_maximumValue(&maximumValue) == S_OK) |
99 Add(false, StringPrintf(L"maximumValue=%.2f", V_R8(&maximumValue))); | 100 Add(false, StringPrintf(L"maximumValue=%.2f", V_R8(&maximumValue))); |
100 Add(false, L"description='" + description + L"'"); | 101 Add(false, L"description='" + description + L"'"); |
101 Add(false, L"default_action='" + default_action + L"'"); | 102 Add(false, L"default_action='" + default_action + L"'"); |
102 Add(false, L"keyboard_shortcut='" + keyboard_shortcut + L"'"); | 103 Add(false, L"keyboard_shortcut='" + keyboard_shortcut + L"'"); |
103 LONG x_left, y_top, width, height; | 104 BrowserAccessibility* root = node->manager()->GetRoot(); |
104 if (acc_obj->accLocation(&x_left, &y_top, &width, &height, variant_self) != | 105 LONG left, top, width, height; |
105 S_FALSE) { | 106 LONG root_left, root_top, root_width, root_height; |
106 Add(false, StringPrintf(L"location=(%d, %d)", x_left, y_top)); | 107 if (S_FALSE != acc_obj->accLocation( |
aboxhall
2013/01/29 17:43:27
It always makes me sad when APIs force you to use
| |
108 &left, &top, &width, &height, variant_self) && | |
109 S_FALSE != root->ToBrowserAccessibilityWin()->accLocation( | |
110 &root_left, &root_top, &root_width, &root_height, variant_self)) { | |
111 Add(false, StringPrintf(L"location=(%d, %d)", | |
112 left - root_left, top - root_top)); | |
107 Add(false, StringPrintf(L"size=(%d, %d)", width, height)); | 113 Add(false, StringPrintf(L"size=(%d, %d)", width, height)); |
108 } | 114 } |
109 LONG index_in_parent; | 115 LONG index_in_parent; |
110 if (acc_obj->get_indexInParent(&index_in_parent) == S_OK) | 116 if (acc_obj->get_indexInParent(&index_in_parent) == S_OK) |
111 Add(false, StringPrintf(L"index_in_parent=%d", index_in_parent)); | 117 Add(false, StringPrintf(L"index_in_parent=%d", index_in_parent)); |
112 LONG n_relations; | 118 LONG n_relations; |
113 if (acc_obj->get_nRelations(&n_relations) == S_OK) | 119 if (acc_obj->get_nRelations(&n_relations) == S_OK) |
114 Add(false, StringPrintf(L"n_relations=%d", n_relations)); | 120 Add(false, StringPrintf(L"n_relations=%d", n_relations)); |
115 LONG group_level, similar_items_in_group, position_in_group; | 121 LONG group_level, similar_items_in_group, position_in_group; |
116 if (acc_obj->get_groupPosition(&group_level, | 122 if (acc_obj->get_groupPosition(&group_level, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 | 176 |
171 const std::string DumpAccessibilityTreeHelper::GetAllowString() const { | 177 const std::string DumpAccessibilityTreeHelper::GetAllowString() const { |
172 return "@WIN-ALLOW:"; | 178 return "@WIN-ALLOW:"; |
173 } | 179 } |
174 | 180 |
175 const std::string DumpAccessibilityTreeHelper::GetDenyString() const { | 181 const std::string DumpAccessibilityTreeHelper::GetDenyString() const { |
176 return "@WIN-DENY:"; | 182 return "@WIN-DENY:"; |
177 } | 183 } |
178 | 184 |
179 } // namespace content | 185 } // namespace content |
OLD | NEW |