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

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: 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..a2f602d0a0ced1e207a2a8ce2583e3b1c9ff2992 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"
@@ -426,6 +428,20 @@ gfx::Rect TrayBackgroundView::GetFocusBounds() {
return GetContentsBounds();
}
+void TrayBackgroundView::OnGestureEvent(ui::GestureEvent* event) {
+ if (event->type() == ui::ET_GESTURE_TAP_DOWN &&
+ CommandLine::ForCurrentProcess()->
+ HasSwitch(switches::kAshEnableTouchViewTouchFeedback)) {
+ SetDrawBackgroundAsActive(true);
+ } else if ((event->type() == ui::ET_GESTURE_SCROLL_BEGIN ||
+ event->type() == ui::ET_GESTURE_TAP_CANCEL) &&
+ CommandLine::ForCurrentProcess()->
+ HasSwitch(switches::kAshEnableTouchViewTouchFeedback)) {
Mr4D (OOO till 08-26) 2014/09/04 19:58:35 CommandLine::ForCurrentProcess()-> HasSwitch(s
jonross 2014/09/05 16:31:49 Done.
+ 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 +644,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