From 475b996b15bd1010869876e6d70e4c79bc1fea05 Mon Sep 17 00:00:00 2001 From: "mhm@chromium.org" Date: Tue, 23 Mar 2010 23:36:14 +0000 Subject: Add Accessibility name for native buttons. Remove the accessible name from Checkbox since it inherits from NativeButton. Dialogs with autogenerated buttons now have MSAA name attached to it, as well as all the checkboxes. BUG=38987 TEST=Ran it in AccExplorer Review URL: http://codereview.chromium.org/1102006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42401 0039d316-1c4b-4281-b951-d872f2087c98 --- views/controls/button/checkbox.cc | 6 ------ views/controls/button/checkbox.h | 1 - views/controls/button/native_button.cc | 3 +++ 3 files changed, 3 insertions(+), 7 deletions(-) (limited to 'views/controls/button') diff --git a/views/controls/button/checkbox.cc b/views/controls/button/checkbox.cc index f1ae320..65981a4 100644 --- a/views/controls/button/checkbox.cc +++ b/views/controls/button/checkbox.cc @@ -160,12 +160,6 @@ bool Checkbox::GetAccessibleRole(AccessibilityTypes::Role* role) { return true; } -bool Checkbox::GetAccessibleName(std::wstring* name) { - DCHECK(name); - *name = label_->GetText(); - return !name->empty(); -} - std::string Checkbox::GetClassName() const { return kViewClassName; } diff --git a/views/controls/button/checkbox.h b/views/controls/button/checkbox.h index dc58117..a579628 100644 --- a/views/controls/button/checkbox.h +++ b/views/controls/button/checkbox.h @@ -59,7 +59,6 @@ class Checkbox : public NativeButton { // Accessibility accessors, overridden from View. virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); - virtual bool GetAccessibleName(std::wstring* name); // Overridden from NativeButton: virtual void SetLabel(const std::wstring& label); diff --git a/views/controls/button/native_button.cc b/views/controls/button/native_button.cc index 7086008..5ff98e8 100644 --- a/views/controls/button/native_button.cc +++ b/views/controls/button/native_button.cc @@ -79,6 +79,9 @@ void NativeButton::SetLabel(const std::wstring& label) { if (native_wrapper_) native_wrapper_->UpdateLabel(); + + // Update the accessible name whenever the label changes. + SetAccessibleName(label); } void NativeButton::SetIsDefault(bool is_default) { -- cgit v1.1