Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: content/browser/accessibility/browser_accessibility_win.cc

Issue 23531055: Use IAccessible2 to detect screen reader in Win Aura (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/views/accessibility/native_view_accessibility_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_split.h" 11 #include "base/strings/string_split.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "base/win/enum_variant.h" 14 #include "base/win/enum_variant.h"
15 #include "base/win/scoped_comptr.h" 15 #include "base/win/scoped_comptr.h"
16 #include "base/win/windows_version.h" 16 #include "base/win/windows_version.h"
17 #include "content/browser/accessibility/browser_accessibility_manager_win.h" 17 #include "content/browser/accessibility/browser_accessibility_manager_win.h"
18 #include "content/browser/accessibility/browser_accessibility_state_impl.h"
18 #include "content/common/accessibility_messages.h" 19 #include "content/common/accessibility_messages.h"
19 #include "content/public/common/content_client.h" 20 #include "content/public/common/content_client.h"
20 #include "ui/base/accessibility/accessible_text_utils.h" 21 #include "ui/base/accessibility/accessible_text_utils.h"
21 #include "ui/base/win/accessibility_ids_win.h" 22 #include "ui/base/win/accessibility_ids_win.h"
22 #include "ui/base/win/accessibility_misc_utils.h" 23 #include "ui/base/win/accessibility_misc_utils.h"
23 24
24 namespace content { 25 namespace content {
25 26
26 // These nonstandard GUIDs are taken directly from the Mozilla sources 27 // These nonstandard GUIDs are taken directly from the Mozilla sources
27 // (accessible/src/msaa/nsAccessNodeWrap.cpp); some documentation is here: 28 // (accessible/src/msaa/nsAccessNodeWrap.cpp); some documentation is here:
(...skipping 2616 matching lines...) Expand 10 before | Expand all | Expand 10 after
2644 // 2645 //
2645 // IServiceProvider methods. 2646 // IServiceProvider methods.
2646 // 2647 //
2647 2648
2648 STDMETHODIMP BrowserAccessibilityWin::QueryService(REFGUID guidService, 2649 STDMETHODIMP BrowserAccessibilityWin::QueryService(REFGUID guidService,
2649 REFIID riid, 2650 REFIID riid,
2650 void** object) { 2651 void** object) {
2651 if (!instance_active_) 2652 if (!instance_active_)
2652 return E_FAIL; 2653 return E_FAIL;
2653 2654
2655 // The system uses IAccessible APIs for many purposes, but only
2656 // assistive technology like screen readers uses IAccessible2.
2657 // Enable full accessibility support when IAccessible2 APIs are queried.
2658 if (riid == IID_IAccessible2)
2659 BrowserAccessibilityStateImpl::GetInstance()->EnableAccessibility();
2660
2654 if (guidService == GUID_IAccessibleContentDocument) { 2661 if (guidService == GUID_IAccessibleContentDocument) {
2655 // Special Mozilla extension: return the accessible for the root document. 2662 // Special Mozilla extension: return the accessible for the root document.
2656 // Screen readers use this to distinguish between a document loaded event 2663 // Screen readers use this to distinguish between a document loaded event
2657 // on the root document vs on an iframe. 2664 // on the root document vs on an iframe.
2658 return manager_->GetRoot()->ToBrowserAccessibilityWin()->QueryInterface( 2665 return manager_->GetRoot()->ToBrowserAccessibilityWin()->QueryInterface(
2659 IID_IAccessible2, object); 2666 IID_IAccessible2, object);
2660 } 2667 }
2661 2668
2662 if (guidService == IID_IAccessible || 2669 if (guidService == IID_IAccessible ||
2663 guidService == IID_IAccessible2 || 2670 guidService == IID_IAccessible2 ||
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after
3654 // The role should always be set. 3661 // The role should always be set.
3655 DCHECK(!role_name_.empty() || ia_role_); 3662 DCHECK(!role_name_.empty() || ia_role_);
3656 3663
3657 // If we didn't explicitly set the IAccessible2 role, make it the same 3664 // If we didn't explicitly set the IAccessible2 role, make it the same
3658 // as the MSAA role. 3665 // as the MSAA role.
3659 if (!ia2_role_) 3666 if (!ia2_role_)
3660 ia2_role_ = ia_role_; 3667 ia2_role_ = ia_role_;
3661 } 3668 }
3662 3669
3663 } // namespace content 3670 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ui/views/accessibility/native_view_accessibility_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698