summaryrefslogtreecommitdiffstats
path: root/views/controls/button
diff options
context:
space:
mode:
authorctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-10 18:34:03 +0000
committerctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-10 18:34:03 +0000
commit4abaee203b9d0dfe8c2fb84682a564fe995b3c79 (patch)
tree7cc0237dfa00cbc87e6d769449c0e073cdc64a62 /views/controls/button
parent6e64343accab0d5b5436645e40a36f5ff20d17ec (diff)
downloadchromium_src-4abaee203b9d0dfe8c2fb84682a564fe995b3c79.zip
chromium_src-4abaee203b9d0dfe8c2fb84682a564fe995b3c79.tar.gz
chromium_src-4abaee203b9d0dfe8c2fb84682a564fe995b3c79.tar.bz2
Landing tfarina CL.
Original patch by thiago.farina@gmail.com See original review at: http://codereview.chromium.org/668225/show BUG=9616 TEST=opens AccExplorer2, opens clear browsing data, select the a checkbox+label with the AccExplorer2 tool, see if the role for this control is checkbox. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41178 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/button')
-rw-r--r--views/controls/button/checkbox.cc14
-rw-r--r--views/controls/button/checkbox.h10
2 files changed, 22 insertions, 2 deletions
diff --git a/views/controls/button/checkbox.cc b/views/controls/button/checkbox.cc
index f4594be..1dcb80a 100644
--- a/views/controls/button/checkbox.cc
+++ b/views/controls/button/checkbox.cc
@@ -5,6 +5,7 @@
#include "views/controls/button/checkbox.h"
#include "app/gfx/canvas.h"
+#include "base/logging.h"
#include "views/controls/label.h"
namespace views {
@@ -152,6 +153,19 @@ void Checkbox::WillLoseFocus() {
label_->set_paint_as_focused(false);
}
+bool Checkbox::GetAccessibleRole(AccessibilityTypes::Role* role) {
+ DCHECK(role);
+
+ *role = AccessibilityTypes::ROLE_CHECKBUTTON;
+ 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 8274070..dc58117 100644
--- a/views/controls/button/checkbox.h
+++ b/views/controls/button/checkbox.h
@@ -5,6 +5,8 @@
#ifndef VIEWS_CONTROLS_BUTTON_CHECKBOX_H_
#define VIEWS_CONTROLS_BUTTON_CHECKBOX_H_
+#include <string>
+
#include "views/controls/button/native_button.h"
namespace views {
@@ -18,7 +20,7 @@ class Checkbox : public NativeButton {
static const char kViewClassName[];
Checkbox();
- Checkbox(const std::wstring& label);
+ explicit Checkbox(const std::wstring& label);
virtual ~Checkbox();
// Sets a listener for this checkbox. Checkboxes aren't required to have them
@@ -55,6 +57,10 @@ class Checkbox : public NativeButton {
virtual void WillGainFocus();
virtual void WillLoseFocus();
+ // 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);
@@ -85,4 +91,4 @@ class Checkbox : public NativeButton {
} // namespace views
-#endif // #ifndef VIEWS_CONTROLS_BUTTON_CHECKBOX_H_
+#endif // VIEWS_CONTROLS_BUTTON_CHECKBOX_H_