Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2959)

Unified Diff: ash/launcher/app_list_button.cc

Issue 13993027: ash: Update app list button. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for #1 Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/launcher/app_list_button.h ('k') | ash/launcher/launcher_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/launcher/app_list_button.cc
diff --git a/ash/launcher/app_list_button.cc b/ash/launcher/app_list_button.cc
index 8879a387cc1746d94a57cbc157de07e7540a6d30..bd7bfcf9152f7f34169b4fae6a93171f4a76ef95 100644
--- a/ash/launcher/app_list_button.cc
+++ b/ash/launcher/app_list_button.cc
@@ -8,8 +8,11 @@
#include "ash/launcher/launcher_button_host.h"
#include "ash/launcher/launcher_types.h"
+#include "ash/shell.h"
+#include "ash/wm/app_list_controller.h"
#include "grit/ash_resources.h"
#include "grit/ash_strings.h"
+#include "ui/aura/window.h"
#include "ui/base/accessibility/accessible_view_state.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
@@ -17,6 +20,7 @@
#include "ui/compositor/layer_animation_element.h"
#include "ui/compositor/layer_animation_sequence.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
+#include "ui/views/widget/widget.h"
namespace ash {
namespace internal {
@@ -30,7 +34,7 @@ const int kBorderSize = 9;
AppListButton::AppListButton(views::ButtonListener* listener,
LauncherButtonHost* host)
- : views::ImageButton(listener),
+ : views::ToggleImageButton(listener),
host_(host) {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
SetImage(
@@ -44,12 +48,23 @@ AppListButton::AppListButton(views::ButtonListener* listener,
views::CustomButton::STATE_PRESSED,
rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST_PUSHED).
ToImageSkia());
+
+ const gfx::ImageSkia* toggled_image =
+ rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST_PUSHED).
+ ToImageSkia();
+ SetToggledImage(views::CustomButton::STATE_NORMAL, toggled_image);
+ SetToggledImage(views::CustomButton::STATE_HOVERED, toggled_image);
+ SetToggledImage(views::CustomButton::STATE_PRESSED, toggled_image);
+
SetAccessibleName(l10n_util::GetStringUTF16(IDS_AURA_APP_LIST_TITLE));
SetSize(gfx::Size(kLauncherPreferredSize, kLauncherPreferredSize));
- SetImageAlignment(ImageButton::ALIGN_CENTER, ImageButton::ALIGN_TOP);
+ SetImageAlignment(ImageButton::ALIGN_CENTER, ImageButton::ALIGN_MIDDLE);
+
+ Shell::GetInstance()->app_list_controller()->AddObserver(this);
}
AppListButton::~AppListButton() {
+ Shell::GetInstance()->app_list_controller()->RemoveObserver(this);
}
void AppListButton::StartLoadingAnimation() {
@@ -130,5 +145,15 @@ void AppListButton::GetAccessibleState(ui::AccessibleViewState* state) {
state->name = host_->GetAccessibleName(this);
}
+void AppListButton::OnAppLauncherVisibilityChanged(
+ bool visible, const aura::RootWindow* root_window) {
+ if (!GetWidget() ||
+ GetWidget()->GetNativeView()->GetRootWindow() != root_window) {
+ return;
+ }
+
+ SetToggled(visible);
+}
+
} // namespace internal
} // namespace ash
« no previous file with comments | « ash/launcher/app_list_button.h ('k') | ash/launcher/launcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698