summaryrefslogtreecommitdiffstats
path: root/views/controls
diff options
context:
space:
mode:
authordtseng@chromium.org <dtseng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-07 18:55:50 +0000
committerdtseng@chromium.org <dtseng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-07 18:55:50 +0000
commit751474c928649f8477194797e903d469c3ff6e2a (patch)
tree62ded683a3f35f77ff18171cc202cf5e64e61b01 /views/controls
parent0a2d3da9994ecd911670a9fd74733fb8a1cd0dd1 (diff)
downloadchromium_src-751474c928649f8477194797e903d469c3ff6e2a.zip
chromium_src-751474c928649f8477194797e903d469c3ff6e2a.tar.gz
chromium_src-751474c928649f8477194797e903d469c3ff6e2a.tar.bz2
Fire focus events when CustomButtons are hottracked.
BUG=47585 TEST=none Review URL: http://codereview.chromium.org/2867040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51753 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls')
-rw-r--r--views/controls/button/custom_button.cc22
-rw-r--r--views/controls/button/custom_button.h1
2 files changed, 23 insertions, 0 deletions
diff --git a/views/controls/button/custom_button.cc b/views/controls/button/custom_button.cc
index 8bf68b2..7b203de 100644
--- a/views/controls/button/custom_button.cc
+++ b/views/controls/button/custom_button.cc
@@ -51,6 +51,25 @@ void CustomButton::SetAnimationDuration(int duration) {
////////////////////////////////////////////////////////////////////////////////
// CustomButton, View overrides:
+bool CustomButton::GetAccessibleState(AccessibilityTypes::State* state) {
+ *state = 0;
+ switch (state_) {
+ case BS_NORMAL:
+ *state = 0;
+ case BS_HOT:
+ *state = AccessibilityTypes::STATE_HOTTRACKED;
+ case BS_PUSHED:
+ *state = AccessibilityTypes::STATE_PRESSED;
+ case BS_DISABLED:
+ *state = AccessibilityTypes::STATE_UNAVAILABLE;
+ case BS_COUNT:
+ // No additional accessibility state set for this button state.
+ break;
+ }
+
+ return true;
+}
+
void CustomButton::SetEnabled(bool enabled) {
if (enabled && state_ == BS_DISABLED) {
SetState(BS_NORMAL);
@@ -214,6 +233,9 @@ void CustomButton::ViewHierarchyChanged(bool is_add, View *parent,
void CustomButton::SetHotTracked(bool flag) {
if (state_ != BS_DISABLED)
SetState(flag ? BS_HOT : BS_NORMAL);
+
+ if (flag)
+ NotifyAccessibilityEvent(AccessibilityTypes::EVENT_FOCUS);
}
bool CustomButton::IsHotTracked() const {
diff --git a/views/controls/button/custom_button.h b/views/controls/button/custom_button.h
index 5801401..9cfdc54 100644
--- a/views/controls/button/custom_button.h
+++ b/views/controls/button/custom_button.h
@@ -42,6 +42,7 @@ class CustomButton : public Button,
void SetAnimationDuration(int duration);
// Overridden from View:
+ virtual bool GetAccessibleState(AccessibilityTypes::State* state);
virtual void SetEnabled(bool enabled);
virtual bool IsEnabled() const;
virtual bool IsFocusable() const;