diff options
author | ctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-17 21:09:13 +0000 |
---|---|---|
committer | ctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-17 21:09:13 +0000 |
commit | 6a04ac2239221e2b64fe256507f136533cd541d3 (patch) | |
tree | 2fcc7d3e1f028b0278e43e9b0618861e870577f7 /views/accessibility | |
parent | 8ec7bcff01381b7555f4dd1acc7184623dff5fd9 (diff) | |
download | chromium_src-6a04ac2239221e2b64fe256507f136533cd541d3.zip chromium_src-6a04ac2239221e2b64fe256507f136533cd541d3.tar.gz chromium_src-6a04ac2239221e2b64fe256507f136533cd541d3.tar.bz2 |
Provide accessibility support for Window_win.
TEST=Ensure that the About Chrome dialog has proper accessibility role.
BUG=none
Review URL: http://codereview.chromium.org/1838002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47454 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/accessibility')
-rw-r--r-- | views/accessibility/accessibility_types.h | 4 | ||||
-rw-r--r-- | views/accessibility/view_accessibility.cc | 102 | ||||
-rw-r--r-- | views/accessibility/view_accessibility.h | 18 | ||||
-rw-r--r-- | views/accessibility/view_accessibility_wrapper.h | 2 |
4 files changed, 66 insertions, 60 deletions
diff --git a/views/accessibility/accessibility_types.h b/views/accessibility/accessibility_types.h index 83c7aa7..882b8a1 100644 --- a/views/accessibility/accessibility_types.h +++ b/views/accessibility/accessibility_types.h @@ -5,6 +5,8 @@ #ifndef VIEWS_ACCESSIBILITY_ACCESSIBILITY_TYPES_H_ #define VIEWS_ACCESSIBILITY_ACCESSIBILITY_TYPES_H_ +#include "base/basictypes.h" + //////////////////////////////////////////////////////////////////////////////// // // AccessibilityTypes @@ -15,7 +17,6 @@ //////////////////////////////////////////////////////////////////////////////// class AccessibilityTypes { public: - // This defines states of the supported accessibility roles in our // Views (e.g. used in View::GetAccessibleState). Any interface using roles @@ -41,6 +42,7 @@ class AccessibilityTypes { ROLE_CHECKBUTTON, ROLE_CLIENT, ROLE_COMBOBOX, + ROLE_DIALOG, ROLE_GRAPHIC, ROLE_GROUPING, ROLE_LINK, diff --git a/views/accessibility/view_accessibility.cc b/views/accessibility/view_accessibility.cc index 2854c15..c440e53 100644 --- a/views/accessibility/view_accessibility.cc +++ b/views/accessibility/view_accessibility.cc @@ -702,6 +702,56 @@ void ViewAccessibility::SetState(VARIANT* msaa_state, views::View* view) { msaa_state->lVal |= MSAAState(state); } +// IAccessible functions not supported. + +HRESULT ViewAccessibility::accDoDefaultAction(VARIANT var_id) { + return E_NOTIMPL; +} + +STDMETHODIMP ViewAccessibility::get_accSelection(VARIANT* selected) { + if (selected) + selected->vt = VT_EMPTY; + return E_NOTIMPL; +} + +STDMETHODIMP ViewAccessibility::accSelect(LONG flagsSelect, VARIANT var_id) { + return E_NOTIMPL; +} + +STDMETHODIMP ViewAccessibility::get_accHelp(VARIANT var_id, BSTR* help) { + if (help) + *help = NULL; + return E_NOTIMPL; +} + +STDMETHODIMP ViewAccessibility::get_accHelpTopic(BSTR* help_file, + VARIANT var_id, + LONG* topic_id) { + if (help_file) { + *help_file = NULL; + } + if (topic_id) { + *topic_id = static_cast<LONG>(-1); + } + return E_NOTIMPL; +} + +STDMETHODIMP ViewAccessibility::put_accName(VARIANT var_id, BSTR put_name) { + // Deprecated. + return E_NOTIMPL; +} + +STDMETHODIMP ViewAccessibility::put_accValue(VARIANT var_id, BSTR put_val) { + if (V_VT(&var_id) == VT_BSTR) { + if (!lstrcmpi(var_id.bstrVal, kViewsUninitializeAccessibilityInstance)) { + view_ = NULL; + return S_OK; + } + } + // Deprecated. + return E_NOTIMPL; +} + int32 ViewAccessibility::MSAARole(AccessibilityTypes::Role role) { switch (role) { case AccessibilityTypes::ROLE_APPLICATION: @@ -714,6 +764,8 @@ int32 ViewAccessibility::MSAARole(AccessibilityTypes::Role role) { return ROLE_SYSTEM_CHECKBUTTON; case AccessibilityTypes::ROLE_COMBOBOX: return ROLE_SYSTEM_COMBOBOX; + case AccessibilityTypes::ROLE_DIALOG: + return ROLE_SYSTEM_DIALOG; case AccessibilityTypes::ROLE_GRAPHIC: return ROLE_SYSTEM_GRAPHIC; case AccessibilityTypes::ROLE_GROUPING: @@ -774,56 +826,6 @@ int32 ViewAccessibility::MSAAState(AccessibilityTypes::State state) { return msaa_state; } -// IAccessible functions not supported. - -HRESULT ViewAccessibility::accDoDefaultAction(VARIANT var_id) { - return E_NOTIMPL; -} - -STDMETHODIMP ViewAccessibility::get_accSelection(VARIANT* selected) { - if (selected) - selected->vt = VT_EMPTY; - return E_NOTIMPL; -} - -STDMETHODIMP ViewAccessibility::accSelect(LONG flagsSelect, VARIANT var_id) { - return E_NOTIMPL; -} - -STDMETHODIMP ViewAccessibility::get_accHelp(VARIANT var_id, BSTR* help) { - if (help) - *help = NULL; - return E_NOTIMPL; -} - -STDMETHODIMP ViewAccessibility::get_accHelpTopic(BSTR* help_file, - VARIANT var_id, - LONG* topic_id) { - if (help_file) { - *help_file = NULL; - } - if (topic_id) { - *topic_id = static_cast<LONG>(-1); - } - return E_NOTIMPL; -} - -STDMETHODIMP ViewAccessibility::put_accName(VARIANT var_id, BSTR put_name) { - // Deprecated. - return E_NOTIMPL; -} - -STDMETHODIMP ViewAccessibility::put_accValue(VARIANT var_id, BSTR put_val) { - if (V_VT(&var_id) == VT_BSTR) { - if (!lstrcmpi(var_id.bstrVal, kViewsUninitializeAccessibilityInstance)) { - view_ = NULL; - return S_OK; - } - } - // Deprecated. - return E_NOTIMPL; -} - HRESULT ViewAccessibility::GetNativeIAccessibleInterface( views::NativeViewHost* native_host, IDispatch** disp_child) { if (!native_host || !disp_child) { diff --git a/views/accessibility/view_accessibility.h b/views/accessibility/view_accessibility.h index b7a6dad..0224dfa07 100644 --- a/views/accessibility/view_accessibility.h +++ b/views/accessibility/view_accessibility.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -103,6 +103,14 @@ class ATL_NO_VTABLE ViewAccessibility STDMETHODIMP put_accName(VARIANT var_id, BSTR put_name); STDMETHODIMP put_accValue(VARIANT var_id, BSTR put_val); + // Returns a conversion from the Role (as defined in accessibility_types.h) + // to an MSAA role. + static int32 MSAARole(AccessibilityTypes::Role role); + + // Returns a conversion from the State (as defined in accessibility_types.h) + // to MSAA states set. + static int32 MSAAState(AccessibilityTypes::State state); + private: // Checks to see if child_id is within the child bounds of view. Returns true // if the child is within the bounds, false otherwise. @@ -128,14 +136,6 @@ class ATL_NO_VTABLE ViewAccessibility // Helper function which sets applicable states of view. void SetState(VARIANT* msaa_state, views::View* view); - // Returns a conversion from the Role (as defined in accessibility_types.h) - // to an MSAA role. - int32 MSAARole(AccessibilityTypes::Role role); - - // Returns a conversion from the State (as defined in accessibility_types.h) - // to MSAA states set. - int32 MSAAState(AccessibilityTypes::State state); - // Returns the IAccessible interface for a native view if applicable. // Returns S_OK on success. HRESULT GetNativeIAccessibleInterface(views::NativeViewHost* native_host, diff --git a/views/accessibility/view_accessibility_wrapper.h b/views/accessibility/view_accessibility_wrapper.h index 619c91d..c6aa08e 100644 --- a/views/accessibility/view_accessibility_wrapper.h +++ b/views/accessibility/view_accessibility_wrapper.h @@ -6,6 +6,8 @@ #define VIEWS_ACCESSIBILITY_VIEW_ACCESSIBILITY_WRAPPER_H_ #include <atlcomcli.h> +// Necessary to define OleAcc GUID's used in window_win.cc. +#include <initguid.h> #include <oleacc.h> #include "base/basictypes.h" |