summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authormukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-08 03:46:48 +0000
committermukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-08 03:46:48 +0000
commitae4283cfc9ab67552a088ad25cdcbae422923f7b (patch)
tree1f349d64a81579b1b536f965ac63f17f31610c5d /ash
parent57dfa62076d4180beab56de85f7770f83e05bae7 (diff)
downloadchromium_src-ae4283cfc9ab67552a088ad25cdcbae422923f7b.zip
chromium_src-ae4283cfc9ab67552a088ad25cdcbae422923f7b.tar.gz
chromium_src-ae4283cfc9ab67552a088ad25cdcbae422923f7b.tar.bz2
Set "Hover" status during focus for accessibility.
Based on the discussion on crbug.com/120499, we'd better to set the "hover" status to the launcher items when focused. This CL keeps the dotted rectangle too. R=zork@chromium.org,davemoore@chromium.org BUG=120499 TEST=manually verified Review URL: https://chromiumcodereview.appspot.com/10449077 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141166 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/launcher/launcher_button.cc13
-rw-r--r--ash/launcher/launcher_button.h3
2 files changed, 14 insertions, 2 deletions
diff --git a/ash/launcher/launcher_button.cc b/ash/launcher/launcher_button.cc
index 95e6c77..1f4750b 100644
--- a/ash/launcher/launcher_button.cc
+++ b/ash/launcher/launcher_button.cc
@@ -42,7 +42,8 @@ const int kAttentionThrobDurationMS = 2000;
bool ShouldHop(int state) {
return state & ash::internal::LauncherButton::STATE_HOVERED ||
- state & ash::internal::LauncherButton::STATE_ACTIVE;
+ state & ash::internal::LauncherButton::STATE_ACTIVE ||
+ state & ash::internal::LauncherButton::STATE_FOCUSED;
}
} // namespace
@@ -397,6 +398,14 @@ bool LauncherButton::GetTooltipText(
return true;
}
+void LauncherButton::OnFocus() {
+ AddState(STATE_FOCUSED);
+}
+
+void LauncherButton::OnBlur() {
+ ClearState(STATE_FOCUSED);
+}
+
void LauncherButton::Init() {
icon_view_ = CreateIconView();
// TODO: refactor the layers so each button doesn't require 2.
@@ -427,7 +436,7 @@ void LauncherButton::UpdateState() {
if (state_ & STATE_ACTIVE || state_ & STATE_ATTENTION) {
bar_id = IsShelfHorizontal() ? IDR_AURA_LAUNCHER_UNDERLINE_ACTIVE :
IDR_AURA_LAUNCHER_UNDERLINE_VERTICAL_ACTIVE;
- } else if (state_ & STATE_HOVERED) {
+ } else if (state_ & STATE_HOVERED || state_ & STATE_FOCUSED) {
bar_id = IsShelfHorizontal() ? IDR_AURA_LAUNCHER_UNDERLINE_HOVER :
IDR_AURA_LAUNCHER_UNDERLINE_VERTICAL_HOVER;
} else {
diff --git a/ash/launcher/launcher_button.h b/ash/launcher/launcher_button.h
index acce224..234c8af 100644
--- a/ash/launcher/launcher_button.h
+++ b/ash/launcher/launcher_button.h
@@ -36,6 +36,7 @@ class LauncherButton : public views::CustomButton {
// e.g. A TYPE_APP_SHORTCUT item whose corresponding app is being
// installed.
STATE_PENDING = 1 << 4,
+ STATE_FOCUSED = 1 << 5,
};
virtual ~LauncherButton();
@@ -91,6 +92,8 @@ class LauncherButton : public views::CustomButton {
virtual void Layout() OVERRIDE;
virtual bool GetTooltipText(const gfx::Point& p,
string16* tooltip) const OVERRIDE;
+ virtual void OnFocus() OVERRIDE;
+ virtual void OnBlur() OVERRIDE;
// Sets the icon image with a shadow.
void SetShadowedImage(const SkBitmap& bitmap);