OLD | NEW |
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2017 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_com_win.h" | 5 #include "content/browser/accessibility/browser_accessibility_com_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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 | 626 |
627 return AXPlatformNodeWin::get_accParent(disp_parent); | 627 return AXPlatformNodeWin::get_accParent(disp_parent); |
628 } | 628 } |
629 | 629 |
630 STDMETHODIMP BrowserAccessibilityComWin::get_accRole(VARIANT var_id, | 630 STDMETHODIMP BrowserAccessibilityComWin::get_accRole(VARIANT var_id, |
631 VARIANT* role) { | 631 VARIANT* role) { |
632 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_ROLE); | 632 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_ROLE); |
633 if (!owner()) | 633 if (!owner()) |
634 return E_FAIL; | 634 return E_FAIL; |
635 | 635 |
636 if (!role) | 636 return AXPlatformNodeWin::get_accRole(var_id, role); |
637 return E_INVALIDARG; | |
638 | |
639 BrowserAccessibilityComWin* target = GetTargetFromChildID(var_id); | |
640 if (!target) | |
641 return E_INVALIDARG; | |
642 | |
643 if (!target->role_name().empty()) { | |
644 role->vt = VT_BSTR; | |
645 role->bstrVal = SysAllocString(target->role_name().c_str()); | |
646 } else { | |
647 role->vt = VT_I4; | |
648 role->lVal = target->ia_role(); | |
649 } | |
650 return S_OK; | |
651 } | 637 } |
652 | 638 |
653 STDMETHODIMP BrowserAccessibilityComWin::get_accState(VARIANT var_id, | 639 STDMETHODIMP BrowserAccessibilityComWin::get_accState(VARIANT var_id, |
654 VARIANT* state) { | 640 VARIANT* state) { |
655 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_STATE); | 641 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_STATE); |
656 if (!owner()) | 642 if (!owner()) |
657 return E_FAIL; | 643 return E_FAIL; |
658 | 644 |
659 auto* manager = Manager(); | 645 auto* manager = Manager(); |
660 if (!manager) | 646 if (!manager) |
(...skipping 4973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5634 | 5620 |
5635 BrowserAccessibilityComWin* ToBrowserAccessibilityComWin( | 5621 BrowserAccessibilityComWin* ToBrowserAccessibilityComWin( |
5636 BrowserAccessibility* obj) { | 5622 BrowserAccessibility* obj) { |
5637 if (!obj || !obj->IsNative()) | 5623 if (!obj || !obj->IsNative()) |
5638 return nullptr; | 5624 return nullptr; |
5639 auto* result = static_cast<BrowserAccessibilityWin*>(obj)->GetCOM(); | 5625 auto* result = static_cast<BrowserAccessibilityWin*>(obj)->GetCOM(); |
5640 return result; | 5626 return result; |
5641 } | 5627 } |
5642 | 5628 |
5643 } // namespace content | 5629 } // namespace content |
OLD | NEW |