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/browser_accessibility_win.h" | 5 #include "content/browser/accessibility/browser_accessibility_win.h" |
6 | 6 |
7 #include <UIAutomationClient.h> | 7 #include <UIAutomationClient.h> |
8 #include <UIAutomationCoreApi.h> | 8 #include <UIAutomationCoreApi.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 UMA_API_UNSELECT_ROW = 157, | 196 UMA_API_UNSELECT_ROW = 157, |
197 | 197 |
198 // This must always be the last enum. It's okay for its value to | 198 // This must always be the last enum. It's okay for its value to |
199 // increase, but none of the other enum values may change. | 199 // increase, but none of the other enum values may change. |
200 UMA_API_MAX | 200 UMA_API_MAX |
201 }; | 201 }; |
202 | 202 |
203 #define WIN_ACCESSIBILITY_API_HISTOGRAM(enum_value) \ | 203 #define WIN_ACCESSIBILITY_API_HISTOGRAM(enum_value) \ |
204 UMA_HISTOGRAM_ENUMERATION("Accessibility.WinAPIs", enum_value, UMA_API_MAX) | 204 UMA_HISTOGRAM_ENUMERATION("Accessibility.WinAPIs", enum_value, UMA_API_MAX) |
205 | 205 |
206 const WCHAR *const IA2_RELATION_DETAILS = L"details"; | |
207 const WCHAR *const IA2_RELATION_DETAILS_FOR = L"detailsFor"; | |
208 const WCHAR *const IA2_RELATION_ERROR_MESSAGE = L"errorMessage"; | |
209 | |
206 } // namespace | 210 } // namespace |
207 | 211 |
208 namespace content { | 212 namespace content { |
209 | 213 |
210 // These nonstandard GUIDs are taken directly from the Mozilla sources | 214 // These nonstandard GUIDs are taken directly from the Mozilla sources |
211 // (accessible/src/msaa/nsAccessNodeWrap.cpp); some documentation is here: | 215 // (accessible/src/msaa/nsAccessNodeWrap.cpp); some documentation is here: |
212 // http://developer.mozilla.org/en/Accessibility/AT-APIs/ImplementationFeatures/ MSAA | 216 // http://developer.mozilla.org/en/Accessibility/AT-APIs/ImplementationFeatures/ MSAA |
213 const GUID GUID_ISimpleDOM = {0x0c539790, | 217 const GUID GUID_ISimpleDOM = {0x0c539790, |
214 0x12e4, | 218 0x12e4, |
215 0x11cf, | 219 0x11cf, |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
648 if (!instance_active()) | 652 if (!instance_active()) |
649 return E_FAIL; | 653 return E_FAIL; |
650 | 654 |
651 if (!acc_key) | 655 if (!acc_key) |
652 return E_INVALIDARG; | 656 return E_INVALIDARG; |
653 | 657 |
654 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); | 658 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); |
655 if (!target) | 659 if (!target) |
656 return E_INVALIDARG; | 660 return E_INVALIDARG; |
657 | 661 |
662 if (target->HasStringAttribute(ui::AX_ATTR_KEY_SHORTCUTS)) { | |
aboxhall
2017/02/08 02:35:18
Should roledescription go in here somewhere as wel
dmazzoni
2017/02/09 18:22:42
Oh yeah, it should.
The spec says localizedExtend
| |
663 return target->GetStringAttributeAsBstr( | |
664 ui::AX_ATTR_KEY_SHORTCUTS, acc_key); | |
665 } | |
666 | |
658 return target->GetStringAttributeAsBstr( | 667 return target->GetStringAttributeAsBstr( |
659 ui::AX_ATTR_SHORTCUT, acc_key); | 668 ui::AX_ATTR_SHORTCUT, acc_key); |
660 } | 669 } |
661 | 670 |
662 STDMETHODIMP BrowserAccessibilityWin::get_accName(VARIANT var_id, BSTR* name) { | 671 STDMETHODIMP BrowserAccessibilityWin::get_accName(VARIANT var_id, BSTR* name) { |
663 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_NAME); | 672 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_NAME); |
664 if (!instance_active()) | 673 if (!instance_active()) |
665 return E_FAIL; | 674 return E_FAIL; |
666 | 675 |
667 if (!name) | 676 if (!name) |
(...skipping 3350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4018 AddBidirectionalRelations(IA2_RELATION_CONTROLLER_FOR, | 4027 AddBidirectionalRelations(IA2_RELATION_CONTROLLER_FOR, |
4019 IA2_RELATION_CONTROLLED_BY, | 4028 IA2_RELATION_CONTROLLED_BY, |
4020 ui::AX_ATTR_CONTROLS_IDS); | 4029 ui::AX_ATTR_CONTROLS_IDS); |
4021 AddBidirectionalRelations(IA2_RELATION_DESCRIBED_BY, | 4030 AddBidirectionalRelations(IA2_RELATION_DESCRIBED_BY, |
4022 IA2_RELATION_DESCRIPTION_FOR, | 4031 IA2_RELATION_DESCRIPTION_FOR, |
4023 ui::AX_ATTR_DESCRIBEDBY_IDS); | 4032 ui::AX_ATTR_DESCRIBEDBY_IDS); |
4024 AddBidirectionalRelations(IA2_RELATION_FLOWS_TO, IA2_RELATION_FLOWS_FROM, | 4033 AddBidirectionalRelations(IA2_RELATION_FLOWS_TO, IA2_RELATION_FLOWS_FROM, |
4025 ui::AX_ATTR_FLOWTO_IDS); | 4034 ui::AX_ATTR_FLOWTO_IDS); |
4026 AddBidirectionalRelations(IA2_RELATION_LABELLED_BY, IA2_RELATION_LABEL_FOR, | 4035 AddBidirectionalRelations(IA2_RELATION_LABELLED_BY, IA2_RELATION_LABEL_FOR, |
4027 ui::AX_ATTR_LABELLEDBY_IDS); | 4036 ui::AX_ATTR_LABELLEDBY_IDS); |
4037 AddBidirectionalRelations(IA2_RELATION_DETAILS, IA2_RELATION_DETAILS_FOR, | |
4038 ui::AX_ATTR_DETAILS_IDS); | |
4028 | 4039 |
4029 int member_of_id; | 4040 int member_of_id; |
4030 if (GetIntAttribute(ui::AX_ATTR_MEMBER_OF_ID, &member_of_id)) | 4041 if (GetIntAttribute(ui::AX_ATTR_MEMBER_OF_ID, &member_of_id)) |
4031 AddRelation(IA2_RELATION_MEMBER_OF, member_of_id); | 4042 AddRelation(IA2_RELATION_MEMBER_OF, member_of_id); |
4032 | 4043 |
4044 int error_message_id; | |
4045 if (GetIntAttribute(ui::AX_ATTR_ERRORMESSAGE_ID, &error_message_id)) | |
4046 AddRelation(IA2_RELATION_ERROR_MESSAGE, error_message_id); | |
4047 | |
4033 // Expose slider value. | 4048 // Expose slider value. |
4034 if (ia_role() == ROLE_SYSTEM_PROGRESSBAR || | 4049 if (ia_role() == ROLE_SYSTEM_PROGRESSBAR || |
4035 ia_role() == ROLE_SYSTEM_SCROLLBAR || | 4050 ia_role() == ROLE_SYSTEM_SCROLLBAR || |
4036 ia_role() == ROLE_SYSTEM_SLIDER) { | 4051 ia_role() == ROLE_SYSTEM_SLIDER) { |
4037 base::string16 value_text = GetValueText(); | 4052 base::string16 value_text = GetValueText(); |
4038 SanitizeStringAttributeForIA2(value_text, &value_text); | 4053 SanitizeStringAttributeForIA2(value_text, &value_text); |
4039 win_attributes_->ia2_attributes.push_back(L"valuetext:" + value_text); | 4054 win_attributes_->ia2_attributes.push_back(L"valuetext:" + value_text); |
4040 } | 4055 } |
4041 | 4056 |
4042 UpdateRequiredAttributes(); | 4057 UpdateRequiredAttributes(); |
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5198 | 5213 |
5199 if (GetBoolAttribute(ui::AX_ATTR_STATE_MIXED)) | 5214 if (GetBoolAttribute(ui::AX_ATTR_STATE_MIXED)) |
5200 ia_state |= STATE_SYSTEM_MIXED; | 5215 ia_state |= STATE_SYSTEM_MIXED; |
5201 | 5216 |
5202 if (GetBoolAttribute(ui::AX_ATTR_CAN_SET_VALUE)) | 5217 if (GetBoolAttribute(ui::AX_ATTR_CAN_SET_VALUE)) |
5203 ia2_state |= IA2_STATE_EDITABLE; | 5218 ia2_state |= IA2_STATE_EDITABLE; |
5204 | 5219 |
5205 if (!GetStringAttribute(ui::AX_ATTR_AUTO_COMPLETE).empty()) | 5220 if (!GetStringAttribute(ui::AX_ATTR_AUTO_COMPLETE).empty()) |
5206 ia2_state |= IA2_STATE_SUPPORTS_AUTOCOMPLETION; | 5221 ia2_state |= IA2_STATE_SUPPORTS_AUTOCOMPLETION; |
5207 | 5222 |
5223 if (GetBoolAttribute(ui::AX_ATTR_MODAL)) | |
5224 ia2_state |= IA2_STATE_MODAL; | |
5225 | |
5208 base::string16 html_tag = GetString16Attribute( | 5226 base::string16 html_tag = GetString16Attribute( |
5209 ui::AX_ATTR_HTML_TAG); | 5227 ui::AX_ATTR_HTML_TAG); |
5210 switch (GetRole()) { | 5228 switch (GetRole()) { |
5211 case ui::AX_ROLE_ALERT: | 5229 case ui::AX_ROLE_ALERT: |
5212 ia_role = ROLE_SYSTEM_ALERT; | 5230 ia_role = ROLE_SYSTEM_ALERT; |
5213 break; | 5231 break; |
5214 case ui::AX_ROLE_ALERT_DIALOG: | 5232 case ui::AX_ROLE_ALERT_DIALOG: |
5215 ia_role = ROLE_SYSTEM_DIALOG; | 5233 ia_role = ROLE_SYSTEM_DIALOG; |
5216 break; | 5234 break; |
5217 case ui::AX_ROLE_APPLICATION: | 5235 case ui::AX_ROLE_APPLICATION: |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5707 return static_cast<BrowserAccessibilityWin*>(obj); | 5725 return static_cast<BrowserAccessibilityWin*>(obj); |
5708 } | 5726 } |
5709 | 5727 |
5710 const BrowserAccessibilityWin* | 5728 const BrowserAccessibilityWin* |
5711 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { | 5729 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { |
5712 DCHECK(!obj || obj->IsNative()); | 5730 DCHECK(!obj || obj->IsNative()); |
5713 return static_cast<const BrowserAccessibilityWin*>(obj); | 5731 return static_cast<const BrowserAccessibilityWin*>(obj); |
5714 } | 5732 } |
5715 | 5733 |
5716 } // namespace content | 5734 } // namespace content |
OLD | NEW |