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

Unified Diff: ash/system/tray/tray_background_view.cc

Issue 515573002: Use active state on touch start for tray icons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove Maximize Mode Dependency Created 6 years, 3 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
Index: ash/system/tray/tray_background_view.cc
diff --git a/ash/system/tray/tray_background_view.cc b/ash/system/tray/tray_background_view.cc
index b19b137cfe596d95c38b415745a76a77af585508..d8140008fb13848e11110c6669a5278825f39175 100644
--- a/ash/system/tray/tray_background_view.cc
+++ b/ash/system/tray/tray_background_view.cc
@@ -17,6 +17,7 @@
#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"
@@ -25,6 +26,7 @@
#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"
@@ -308,6 +310,7 @@ TrayBackgroundView::TrayBackgroundView(StatusAreaWidget* status_area_widget)
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);
@@ -325,6 +328,11 @@ TrayBackgroundView::TrayBackgroundView(StatusAreaWidget* status_area_widget)
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;
flackr 2014/09/03 13:42:07 It would be better / cleaner to just check the fla
jonross 2014/09/03 15:48:21 Done.
+ }
}
TrayBackgroundView::~TrayBackgroundView() {
@@ -426,6 +434,18 @@ gfx::Rect TrayBackgroundView::GetFocusBounds() {
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_)
@@ -628,6 +648,8 @@ TrayBubbleView::AnchorAlignment TrayBackgroundView::GetAnchorAlignment() const {
}
void TrayBackgroundView::SetDrawBackgroundAsActive(bool visible) {
+ if (draw_background_as_active_ == visible)
+ return;
draw_background_as_active_ = visible;
if (!background_)
return;

Powered by Google App Engine
This is Rietveld 408576698