diff options
author | dmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-03 23:13:49 +0000 |
---|---|---|
committer | dmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-03 23:13:49 +0000 |
commit | c45dde3c15cddbca7795cab1c28fa472148b01b1 (patch) | |
tree | 74f32f6537b87946703839e7e2dfde2f2a2f9063 /views/controls/button/custom_button.cc | |
parent | 7c8f18ab4383e497f0ba3663156abf81ea5af3e6 (diff) | |
download | chromium_src-c45dde3c15cddbca7795cab1c28fa472148b01b1.zip chromium_src-c45dde3c15cddbca7795cab1c28fa472148b01b1.tar.gz chromium_src-c45dde3c15cddbca7795cab1c28fa472148b01b1.tar.bz2 |
Refactor Views accessibility.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6581010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76825 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/button/custom_button.cc')
-rw-r--r-- | views/controls/button/custom_button.cc | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/views/controls/button/custom_button.cc b/views/controls/button/custom_button.cc index 1696d14..fc349a2 100644 --- a/views/controls/button/custom_button.cc +++ b/views/controls/button/custom_button.cc @@ -4,9 +4,11 @@ #include "views/controls/button/custom_button.h" +#include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/animation/throb_animation.h" #include "ui/base/keycodes/keyboard_codes.h" #include "views/screen.h" +#include "views/widget/widget.h" namespace views { @@ -57,24 +59,23 @@ void CustomButton::SetAnimationDuration(int duration) { //////////////////////////////////////////////////////////////////////////////// // CustomButton, View overrides: -AccessibilityTypes::State CustomButton::GetAccessibleState() { - int state = 0; +void CustomButton::GetAccessibleState(ui::AccessibleViewState* state) { + Button::GetAccessibleState(state); switch (state_) { case BS_HOT: - state = AccessibilityTypes::STATE_HOTTRACKED; + state->state = ui::AccessibilityTypes::STATE_HOTTRACKED; break; case BS_PUSHED: - state = AccessibilityTypes::STATE_PRESSED; + state->state = ui::AccessibilityTypes::STATE_PRESSED; break; case BS_DISABLED: - state = AccessibilityTypes::STATE_UNAVAILABLE; + state->state = ui::AccessibilityTypes::STATE_UNAVAILABLE; break; case BS_NORMAL: case BS_COUNT: // No additional accessibility state set for this button state. break; } - return state; } void CustomButton::SetEnabled(bool enabled) { @@ -248,8 +249,10 @@ void CustomButton::SetHotTracked(bool flag) { if (state_ != BS_DISABLED) SetState(flag ? BS_HOT : BS_NORMAL); - if (flag) - NotifyAccessibilityEvent(AccessibilityTypes::EVENT_FOCUS); + if (flag) { + GetWidget()->NotifyAccessibilityEvent( + this, ui::AccessibilityTypes::EVENT_FOCUS, true); + } } bool CustomButton::IsHotTracked() const { |