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

Unified Diff: ash/system/tray/tray_popup_item_container.h

Issue 556383002: Status Panel Touch Feedback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use new switch 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_popup_item_container.h
diff --git a/ash/system/tray/tray_popup_item_container.h b/ash/system/tray/tray_popup_item_container.h
new file mode 100644
index 0000000000000000000000000000000000000000..f3b8480c98b24a452e2690b82ebcec389418a645
--- /dev/null
+++ b/ash/system/tray/tray_popup_item_container.h
@@ -0,0 +1,51 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_SYSTEM_TRAY_TRAY_POPUP_ITEM_CONTAINER_H_
+#define ASH_SYSTEM_TRAY_TRAY_POPUP_ITEM_CONTAINER_H_
+
+#include "ui/views/view.h"
+
+namespace ash {
+
+// A view which can optionally change the background color when a mouse is
+// hovering or a user is interacting via touch.
+class TrayPopupItemContainer : public views::View {
+ public:
+ TrayPopupItemContainer(views::View* view,
+ bool change_background,
+ bool draw_border);
+
+ virtual ~TrayPopupItemContainer();
+
+ bool active() {
+ return active_;
+ }
+
+ private:
+ // Sets whether the active background is to be used, and triggers a paint.
+ void SetActive(bool active);
+
+ // views::View:
+ virtual void ChildVisibilityChanged(views::View* child) OVERRIDE;
+ virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE;
+ virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE;
+ virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE;
+ virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
+ virtual void OnPaintBackground(gfx::Canvas* canvas) OVERRIDE;
+
+ // True if either a mouse is hovering over this view, or if a user has touched
+ // down.
+ bool active_;
+
+ // True if mouse hover and touch feedback can alter the background color of
+ // the container.
+ bool change_background_;
+
+ DISALLOW_COPY_AND_ASSIGN(TrayPopupItemContainer);
+};
+
+} // namespace ash
+
+#endif // ASH_SYSTEM_TRAY_TRAY_POPUP_ITEM_CONTAINER_H_

Powered by Google App Engine
This is Rietveld 408576698