summaryrefslogtreecommitdiffstats
path: root/views/accessibility/view_accessibility.cc
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/view_accessibility.cc
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/view_accessibility.cc')
-rw-r--r--views/accessibility/view_accessibility.cc41
1 files changed, 34 insertions, 7 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;