#include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/tray_event_filter.h"
#include "ash/wm/window_animations.h"
+#include "base/command_line.h"
#include "grit/ash_resources.h"
#include "ui/accessibility/ax_view_state.h"
#include "ui/aura/window.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animation_element.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
+#include "ui/events/event_constants.h"
#include "ui/gfx/animation/tween.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/image/image_skia.h"
kTrayBackgroundHoverAlpha - kTrayBackgroundAlpha),
hovered_(false),
draw_background_as_active_(false),
+ touch_feedback_enabled_(false),
widget_observer_(new TrayWidgetObserver(this)) {
set_notify_enter_exit_on_child(true);
SetFillsBoundsOpaquely(false);
// Start the tray items not visible, because visibility changes are animated.
views::View::SetVisible(false);
+
+ if (CommandLine::ForCurrentProcess()->
+ HasSwitch(switches::kAshEnableTouchViewTouchFeedback)) {
+ touch_feedback_enabled_ = true;
+ }
}
TrayBackgroundView::~TrayBackgroundView() {
return GetContentsBounds();
}
+void TrayBackgroundView::OnGestureEvent(ui::GestureEvent* event) {
+ if (touch_feedback_enabled_) {
+ if (event->type() == ui::ET_GESTURE_TAP_DOWN) {
+ SetDrawBackgroundAsActive(true);
+ } else if (event->type() == ui::ET_GESTURE_SCROLL_BEGIN ||
+ event->type() == ui::ET_GESTURE_TAP_CANCEL) {
+ SetDrawBackgroundAsActive(false);
+ }
+ }
+ ActionableView::OnGestureEvent(event);
+}
+
void TrayBackgroundView::UpdateBackground(int alpha) {
// The animator should never fire when the alternate shelf layout is used.
if (!background_ || draw_background_as_active_)
}
void TrayBackgroundView::SetDrawBackgroundAsActive(bool visible) {
+ if (draw_background_as_active_ == visible)
+ return;
draw_background_as_active_ = visible;
if (!background_)
return;