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

Unified Diff: ui/views/accessibility/native_view_accessibility_win.cc

Issue 9958139: Add support for UIA accessibility interfaces like IAccessibleEx and IRawElementProviderSimple. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/accessibility/native_view_accessibility_win.cc
===================================================================
--- ui/views/accessibility/native_view_accessibility_win.cc (revision 130412)
+++ ui/views/accessibility/native_view_accessibility_win.cc (working copy)
@@ -2,13 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#define _ATL_DEBUG_QI
dmazzoni 2012/04/04 06:02:00 Delete this before checking in?
ananta 2012/04/04 19:23:00 Done.
#include "ui/views/accessibility/native_view_accessibility_win.h"
#include <atlbase.h>
#include <atlcom.h>
+#include <UIAutomationClient.h>
dmazzoni 2012/04/04 06:02:00 Nit: group above
ananta 2012/04/04 19:23:00 Done.
#include <vector>
+#include "base/win/windows_version.h"
#include "third_party/iaccessible2/ia2_api_all.h"
#include "ui/base/accessibility/accessible_text_utils.h"
#include "ui/base/accessibility/accessible_view_state.h"
@@ -784,16 +787,69 @@
if (!view_)
return E_FAIL;
- if (guidService == IID_IAccessible ||
- guidService == IID_IAccessible2 ||
- guidService == IID_IAccessibleText) {
+ if (riid == IID_IAccessible ||
+ riid == IID_IAccessible2 ||
+ riid == IID_IAccessibleText) {
return QueryInterface(riid, object);
}
+ // We only support the IAccessibleEx interface on Windows 8 and above. This
+ // is needed for the On screen Keyboard to show up in metro mode, when the
+ // user taps an editable region in the window.
+ // All methods in the IAccessibleEx interface are unimplemented.
+ if (riid == IID_IAccessibleEx &&
+ base::win::GetVersion() >= base::win::VERSION_WIN8) {
+ return QueryInterface(riid, object);
+ }
+
*object = NULL;
return E_FAIL;
}
+STDMETHODIMP NativeViewAccessibilityWin::GetPatternProvider(
+ PATTERNID id, IUnknown** provider) {
+ DVLOG(1) << "In Function: "
+ << __FUNCTION__
+ << " for pattern id: "
+ << id;
+ if (id == UIA_ValuePatternId || id == UIA_TextPatternId) {
+ ui::AccessibleViewState state;
+ view_->GetAccessibleState(&state);
+ long role = MSAARole(state.role);
+
+ if (role == ROLE_SYSTEM_TEXT) {
+ DVLOG(1) << "Returning UIA text provider";
+ ui::UIATextProvider::CreateTextProvider(true, provider);
+ return S_OK;
+ }
+ }
+ return E_NOTIMPL;
+}
+
+STDMETHODIMP NativeViewAccessibilityWin::GetPropertyValue(PROPERTYID id,
+ VARIANT* ret) {
+ DVLOG(1) << "In Function: "
+ << __FUNCTION__
+ << " for property id: "
+ << id;
+ if (id == UIA_ControlTypePropertyId) {
+ ui::AccessibleViewState state;
+ view_->GetAccessibleState(&state);
+ long role = MSAARole(state.role);
+ if (role == ROLE_SYSTEM_TEXT) {
+ V_VT(ret) = VT_I4;
+ ret->lVal = UIA_EditControlTypeId;
+ DVLOG(1) << "Returning Edit control type";
+ } else {
+ DVLOG(1) << "Returning empty control type";
+ V_VT(ret) = VT_EMPTY;
+ }
+ } else {
+ V_VT(ret) = VT_EMPTY;
+ }
+ return S_OK;
+}
+
//
// Static methods.
//

Powered by Google App Engine
This is Rietveld 408576698