summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authordmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-30 18:44:53 +0000
committerdmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-30 18:44:53 +0000
commit983592e0fa0fb36f842cd98da028b3e2a4029d1c (patch)
tree92c786bc873ef61ca3182a7131086038bceefe78 /views
parent21103034ad3f39ca1b24a254e97ff91776ea9a9e (diff)
downloadchromium_src-983592e0fa0fb36f842cd98da028b3e2a4029d1c.zip
chromium_src-983592e0fa0fb36f842cd98da028b3e2a4029d1c.tar.gz
chromium_src-983592e0fa0fb36f842cd98da028b3e2a4029d1c.tar.bz2
Make the first-run search engine choice dialog accessible to
Windows screenreaders. BUG=none TEST=manual testing with and without JAWS and NVDA screenreaders. Review URL: http://codereview.chromium.org/3598003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61090 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/controls/button/native_button_win.cc19
-rw-r--r--views/controls/button/native_button_win.h1
-rw-r--r--views/controls/button/native_button_wrapper.h6
3 files changed, 25 insertions, 1 deletions
diff --git a/views/controls/button/native_button_win.cc b/views/controls/button/native_button_win.cc
index eae509c..45301f0 100644
--- a/views/controls/button/native_button_win.cc
+++ b/views/controls/button/native_button_win.cc
@@ -5,8 +5,10 @@
#include "views/controls/button/native_button_win.h"
#include <commctrl.h>
+#include <oleacc.h>
#include "base/logging.h"
+#include "base/scoped_comptr_win.h"
#include "base/win_util.h"
#include "views/controls/button/checkbox.h"
#include "views/controls/button/native_button.h"
@@ -67,6 +69,22 @@ void NativeButtonWin::UpdateDefault() {
}
}
+void NativeButtonWin::UpdateAccessibleName() {
+ std::wstring name;
+ if (native_button_->GetAccessibleName(&name)) {
+ ScopedComPtr<IAccPropServices> pAccPropServices;
+ HRESULT hr = CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER,
+ IID_IAccPropServices, reinterpret_cast<void**>(&pAccPropServices));
+ if (SUCCEEDED(hr)) {
+ VARIANT var;
+ var.vt = VT_BSTR;
+ var.bstrVal = SysAllocString(name.c_str());
+ hr = pAccPropServices->SetHwndProp(native_view(), OBJID_WINDOW,
+ CHILDID_SELF, PROPID_ACC_NAME, var);
+ }
+ }
+}
+
View* NativeButtonWin::GetView() {
return this;
}
@@ -138,6 +156,7 @@ void NativeButtonWin::NativeControlCreated(HWND control_hwnd) {
UpdateFont();
UpdateLabel();
UpdateDefault();
+ UpdateAccessibleName();
}
// We could obtain this from the theme, but that only works if themes are
diff --git a/views/controls/button/native_button_win.h b/views/controls/button/native_button_win.h
index d4aebbc2..ed19836 100644
--- a/views/controls/button/native_button_win.h
+++ b/views/controls/button/native_button_win.h
@@ -23,6 +23,7 @@ class NativeButtonWin : public NativeControlWin,
virtual void UpdateFont();
virtual void UpdateEnabled();
virtual void UpdateDefault();
+ virtual void UpdateAccessibleName();
virtual View* GetView();
virtual void SetFocus();
virtual bool UsesNativeLabel() const;
diff --git a/views/controls/button/native_button_wrapper.h b/views/controls/button/native_button_wrapper.h
index 01d9219..39202d4 100644
--- a/views/controls/button/native_button_wrapper.h
+++ b/views/controls/button/native_button_wrapper.h
@@ -38,8 +38,12 @@ class NativeButtonWrapper {
// associated NativeCheckbox. Valid only for checkboxes and radio buttons.
virtual void UpdateChecked() {}
+ // Update the native button's accessible name to the accessible name of
+ // the associated NativeButton.
+ virtual void UpdateAccessibleName() {}
+
// Shows the pushed state for the button if |pushed| is true.
- virtual void SetPushed(bool pushed) {};
+ virtual void SetPushed(bool pushed) {}
// Retrieves the views::View that hosts the native control.
virtual View* GetView() = 0;