summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);