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 3605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3616 // IServiceProvider methods. | 3616 // IServiceProvider methods. |
3617 // | 3617 // |
3618 | 3618 |
3619 STDMETHODIMP BrowserAccessibilityWin::QueryService(REFGUID guid_service, | 3619 STDMETHODIMP BrowserAccessibilityWin::QueryService(REFGUID guid_service, |
3620 REFIID riid, | 3620 REFIID riid, |
3621 void** object) { | 3621 void** object) { |
3622 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_QUERY_SERVICE); | 3622 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_QUERY_SERVICE); |
3623 if (!instance_active()) | 3623 if (!instance_active()) |
3624 return E_FAIL; | 3624 return E_FAIL; |
3625 | 3625 |
3626 // The system uses IAccessible APIs for many purposes, but only | |
3627 // assistive technology like screen readers uses IAccessible2. | |
3628 // Enable full accessibility support when IAccessible2 APIs are queried. | |
3629 if (riid == IID_IAccessible2) | |
3630 BrowserAccessibilityStateImpl::GetInstance()->EnableAccessibility(); | |
3631 | |
3632 if (guid_service == GUID_IAccessibleContentDocument) { | 3626 if (guid_service == GUID_IAccessibleContentDocument) { |
3633 // Special Mozilla extension: return the accessible for the root document. | 3627 // Special Mozilla extension: return the accessible for the root document. |
3634 // Screen readers use this to distinguish between a document loaded event | 3628 // Screen readers use this to distinguish between a document loaded event |
3635 // on the root document vs on an iframe. | 3629 // on the root document vs on an iframe. |
3636 BrowserAccessibility* node = this; | 3630 BrowserAccessibility* node = this; |
3637 while (node->GetParent()) | 3631 while (node->GetParent()) |
3638 node = node->GetParent()->manager()->GetRoot(); | 3632 node = node->GetParent()->manager()->GetRoot(); |
3639 return ToBrowserAccessibilityWin(node)->QueryInterface( | 3633 return ToBrowserAccessibilityWin(node)->QueryInterface( |
3640 IID_IAccessible2, object); | 3634 IID_IAccessible2, object); |
3641 } | 3635 } |
(...skipping 2071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5713 return static_cast<BrowserAccessibilityWin*>(obj); | 5707 return static_cast<BrowserAccessibilityWin*>(obj); |
5714 } | 5708 } |
5715 | 5709 |
5716 const BrowserAccessibilityWin* | 5710 const BrowserAccessibilityWin* |
5717 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { | 5711 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { |
5718 DCHECK(!obj || obj->IsNative()); | 5712 DCHECK(!obj || obj->IsNative()); |
5719 return static_cast<const BrowserAccessibilityWin*>(obj); | 5713 return static_cast<const BrowserAccessibilityWin*>(obj); |
5720 } | 5714 } |
5721 | 5715 |
5722 } // namespace content | 5716 } // namespace content |
OLD | NEW |