summaryrefslogtreecommitdiffstats
path: root/views/accessibility
diff options
context:
space:
mode:
authorctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-26 21:51:04 +0000
committerctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-26 21:51:04 +0000
commita9d59460c07913177e8bf149276a433403783c88 (patch)
treee661ac21a58003c4e5a1ddd0afb550258ace59ee /views/accessibility
parent78d36a2f101aaa7dea9820b7001672c8f5f78f4f (diff)
downloadchromium_src-a9d59460c07913177e8bf149276a433403783c88.zip
chromium_src-a9d59460c07913177e8bf149276a433403783c88.tar.gz
chromium_src-a9d59460c07913177e8bf149276a433403783c88.tar.bz2
views: [accessibility] Add support for Accessibility Value.
BUG=9604 TEST=point AccExplorer to Edit Bookmark dialog, see if everything has a MSAA information, like: Name, Role, State, Value. Patch from Thiago Farina <thiago.farina@gmail.com> Review URL: http://codereview.chromium.org/928001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42831 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/accessibility')
-rw-r--r--views/accessibility/view_accessibility.cc41
-rw-r--r--views/accessibility/view_accessibility.h6
2 files changed, 37 insertions, 10 deletions
diff --git a/views/accessibility/view_accessibility.cc b/views/accessibility/view_accessibility.cc
index f8bf516..32239d1 100644
--- a/views/accessibility/view_accessibility.cc
+++ b/views/accessibility/view_accessibility.cc
@@ -479,7 +479,7 @@ STDMETHODIMP ViewAccessibility::get_accName(VARIANT var_id, BSTR* name) {
std::wstring temp_name;
if (var_id.lVal == CHILDID_SELF) {
- // Retrieve the parent view's name.
+ // Retrieve the current view's name.
view_->GetAccessibleName(&temp_name);
} else {
if (!IsValidChild((var_id.lVal - 1), view_)) {
@@ -600,6 +600,39 @@ STDMETHODIMP ViewAccessibility::get_accState(VARIANT var_id, VARIANT* state) {
return S_OK;
}
+STDMETHODIMP ViewAccessibility::get_accValue(VARIANT var_id, BSTR* value) {
+ if (var_id.vt != VT_I4 || !value) {
+ return E_INVALIDARG;
+ }
+
+ if (!view_) {
+ return E_FAIL;
+ }
+
+ std::wstring temp_value;
+
+ if (var_id.lVal == CHILDID_SELF) {
+ // Retrieve the current view's value.
+ view_->GetAccessibleValue(&temp_value);
+ } else {
+ if (!IsValidChild((var_id.lVal - 1), view_)) {
+ return E_INVALIDARG;
+ }
+ // Retrieve the child view's value.
+ view_->GetChildViewAt(var_id.lVal - 1)->GetAccessibleValue(&temp_value);
+ }
+ if (!temp_value.empty()) {
+ // Return value retrieved.
+ *value = SysAllocString(temp_value.c_str());
+ } else {
+ // If view has no value, fall back into the default implementation.
+ *value = NULL;
+ return E_NOTIMPL;
+ }
+
+ return S_OK;
+}
+
// Helper functions.
bool ViewAccessibility::IsValidChild(int child_id, views::View* view) const {
@@ -725,12 +758,6 @@ HRESULT ViewAccessibility::accDoDefaultAction(VARIANT var_id) {
return E_NOTIMPL;
}
-STDMETHODIMP ViewAccessibility::get_accValue(VARIANT var_id, BSTR* value) {
- if (value)
- *value = NULL;
- return E_NOTIMPL;
-}
-
STDMETHODIMP ViewAccessibility::get_accSelection(VARIANT* selected) {
if (selected)
selected->vt = VT_EMPTY;
diff --git a/views/accessibility/view_accessibility.h b/views/accessibility/view_accessibility.h
index 003ce7a..7d95794 100644
--- a/views/accessibility/view_accessibility.h
+++ b/views/accessibility/view_accessibility.h
@@ -81,14 +81,14 @@ class ATL_NO_VTABLE ViewAccessibility
// Retrieves the current state of the specified object.
STDMETHODIMP get_accState(VARIANT var_id, VARIANT* state);
+ // Retrieves the current value associated with the specified object.
+ STDMETHODIMP get_accValue(VARIANT var_id, BSTR* value);
+
// Non-supported IAccessible methods.
// Out-dated and can be safely said to be very rarely used.
STDMETHODIMP accDoDefaultAction(VARIANT var_id);
- // No value associated with views.
- STDMETHODIMP get_accValue(VARIANT var_id, BSTR* value);
-
// Selections not applicable to views.
STDMETHODIMP get_accSelection(VARIANT* selected);
STDMETHODIMP accSelect(LONG flags_sel, VARIANT var_id);