| 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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 | 635 |
| 636 return AXPlatformNodeWin::get_accRole(var_id, role); | 636 return AXPlatformNodeWin::get_accRole(var_id, role); |
| 637 } | 637 } |
| 638 | 638 |
| 639 STDMETHODIMP BrowserAccessibilityComWin::get_accState(VARIANT var_id, | 639 STDMETHODIMP BrowserAccessibilityComWin::get_accState(VARIANT var_id, |
| 640 VARIANT* state) { | 640 VARIANT* state) { |
| 641 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_STATE); | 641 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_STATE); |
| 642 if (!owner()) | 642 if (!owner()) |
| 643 return E_FAIL; | 643 return E_FAIL; |
| 644 | 644 |
| 645 return AXPlatformNodeWin::get_accState(var_id, state); | 645 auto* manager = Manager(); |
| 646 if (!manager) |
| 647 return E_FAIL; |
| 648 |
| 649 if (!state) |
| 650 return E_INVALIDARG; |
| 651 |
| 652 BrowserAccessibilityComWin* target = GetTargetFromChildID(var_id); |
| 653 if (!target) |
| 654 return E_INVALIDARG; |
| 655 |
| 656 state->vt = VT_I4; |
| 657 state->lVal = target->ia_state(); |
| 658 if (manager->GetFocus() == owner()) |
| 659 state->lVal |= STATE_SYSTEM_FOCUSED; |
| 660 |
| 661 return S_OK; |
| 646 } | 662 } |
| 647 | 663 |
| 648 bool BrowserAccessibilityComWin::IsRangeValueSupported() { | 664 bool BrowserAccessibilityComWin::IsRangeValueSupported() { |
| 649 switch (ia_role()) { | 665 switch (ia_role()) { |
| 650 case ROLE_SYSTEM_PROGRESSBAR: | 666 case ROLE_SYSTEM_PROGRESSBAR: |
| 651 case ROLE_SYSTEM_SLIDER: | 667 case ROLE_SYSTEM_SLIDER: |
| 652 case ROLE_SYSTEM_SPINBUTTON: | 668 case ROLE_SYSTEM_SPINBUTTON: |
| 653 case ROLE_SYSTEM_SCROLLBAR: | 669 case ROLE_SYSTEM_SCROLLBAR: |
| 654 return true; | 670 return true; |
| 655 case ROLE_SYSTEM_SEPARATOR: | 671 case ROLE_SYSTEM_SEPARATOR: |
| (...skipping 4935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5591 | 5607 |
| 5592 BrowserAccessibilityComWin* ToBrowserAccessibilityComWin( | 5608 BrowserAccessibilityComWin* ToBrowserAccessibilityComWin( |
| 5593 BrowserAccessibility* obj) { | 5609 BrowserAccessibility* obj) { |
| 5594 if (!obj || !obj->IsNative()) | 5610 if (!obj || !obj->IsNative()) |
| 5595 return nullptr; | 5611 return nullptr; |
| 5596 auto* result = static_cast<BrowserAccessibilityWin*>(obj)->GetCOM(); | 5612 auto* result = static_cast<BrowserAccessibilityWin*>(obj)->GetCOM(); |
| 5597 return result; | 5613 return result; |
| 5598 } | 5614 } |
| 5599 | 5615 |
| 5600 } // namespace content | 5616 } // namespace content |
| OLD | NEW |