| Index: ash/shelf/app_list_button.cc
|
| diff --git a/ash/shelf/app_list_button.cc b/ash/shelf/app_list_button.cc
|
| index 9ba833254e3e93274058c2a435da2d5ae3e24790..cc379c51dde905071e929fe2c0858db51e605077 100644
|
| --- a/ash/shelf/app_list_button.cc
|
| +++ b/ash/shelf/app_list_button.cc
|
| @@ -12,6 +12,7 @@
|
| #include "ash/shelf/shelf_layout_manager.h"
|
| #include "ash/shelf/shelf_widget.h"
|
| #include "ash/shell.h"
|
| +#include "base/command_line.h"
|
| #include "grit/ash_resources.h"
|
| #include "grit/ash_strings.h"
|
| #include "ui/accessibility/ax_view_state.h"
|
| @@ -35,6 +36,9 @@ AppListButton::AppListButton(views::ButtonListener* listener,
|
| ShelfButtonHost* host,
|
| ShelfWidget* shelf_widget)
|
| : views::ImageButton(listener),
|
| + draw_background_as_active_(false),
|
| + touch_feedback_enabled_(CommandLine::ForCurrentProcess()->
|
| + HasSwitch(switches::kAshEnableTouchViewTouchFeedback)),
|
| host_(host),
|
| shelf_widget_(shelf_widget) {
|
| SetAccessibleName(l10n_util::GetStringUTF16(IDS_ASH_SHELF_APP_LIST_TITLE));
|
| @@ -86,6 +90,8 @@ void AppListButton::OnMouseExited(const ui::MouseEvent& event) {
|
| void AppListButton::OnGestureEvent(ui::GestureEvent* event) {
|
| switch (event->type()) {
|
| case ui::ET_GESTURE_SCROLL_BEGIN:
|
| + if (touch_feedback_enabled_)
|
| + SetDrawBackgroundAsActive(false);
|
| host_->PointerPressedOnButton(this, ShelfButtonHost::TOUCH, *event);
|
| event->SetHandled();
|
| return;
|
| @@ -98,6 +104,17 @@ void AppListButton::OnGestureEvent(ui::GestureEvent* event) {
|
| host_->PointerReleasedOnButton(this, ShelfButtonHost::TOUCH, false);
|
| event->SetHandled();
|
| return;
|
| + case ui::ET_GESTURE_TAP_DOWN:
|
| + if (touch_feedback_enabled_)
|
| + SetDrawBackgroundAsActive(true);
|
| + ImageButton::OnGestureEvent(event);
|
| + break;
|
| + case ui::ET_GESTURE_TAP_CANCEL:
|
| + case ui::ET_GESTURE_TAP:
|
| + if (touch_feedback_enabled_)
|
| + SetDrawBackgroundAsActive(false);
|
| + ImageButton::OnGestureEvent(event);
|
| + break;
|
| default:
|
| ImageButton::OnGestureEvent(event);
|
| return;
|
| @@ -109,7 +126,8 @@ void AppListButton::OnPaint(gfx::Canvas* canvas) {
|
| View::OnPaint(canvas);
|
|
|
| int background_image_id = 0;
|
| - if (Shell::GetInstance()->GetAppListTargetVisibility()) {
|
| + if (Shell::GetInstance()->GetAppListTargetVisibility() ||
|
| + draw_background_as_active_) {
|
| background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_PRESSED;
|
| } else {
|
| if (shelf_widget_->GetDimsShelf())
|
| @@ -166,4 +184,12 @@ void AppListButton::GetAccessibleState(ui::AXViewState* state) {
|
| state->name = host_->GetAccessibleName(this);
|
| }
|
|
|
| +void AppListButton::SetDrawBackgroundAsActive(
|
| + bool draw_background_as_active) {
|
| + if (draw_background_as_active_ == draw_background_as_active)
|
| + return;
|
| + draw_background_as_active_ = draw_background_as_active;
|
| + SchedulePaint();
|
| +}
|
| +
|
| } // namespace ash
|
|
|