| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef ASH_COMMON_SYSTEM_TRAY_TRAY_POPUP_ITEM_CONTAINER_H_ | |
| 6 #define ASH_COMMON_SYSTEM_TRAY_TRAY_POPUP_ITEM_CONTAINER_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "ui/views/view.h" | |
| 10 | |
| 11 namespace ash { | |
| 12 | |
| 13 // A view which can optionally change the background color when a mouse is | |
| 14 // hovering or a user is interacting via touch. | |
| 15 class TrayPopupItemContainer : public views::View { | |
| 16 public: | |
| 17 TrayPopupItemContainer(views::View* view, bool change_background); | |
| 18 | |
| 19 ~TrayPopupItemContainer() override; | |
| 20 | |
| 21 bool active() { return active_; } | |
| 22 | |
| 23 private: | |
| 24 // Sets whether the active background is to be used, and triggers a paint. | |
| 25 void SetActive(bool active); | |
| 26 | |
| 27 // views::View: | |
| 28 void ChildVisibilityChanged(views::View* child) override; | |
| 29 void ChildPreferredSizeChanged(views::View* child) override; | |
| 30 void OnMouseEntered(const ui::MouseEvent& event) override; | |
| 31 void OnMouseExited(const ui::MouseEvent& event) override; | |
| 32 void OnGestureEvent(ui::GestureEvent* event) override; | |
| 33 void OnPaintBackground(gfx::Canvas* canvas) override; | |
| 34 | |
| 35 // True if either a mouse is hovering over this view, or if a user has touched | |
| 36 // down. | |
| 37 bool active_; | |
| 38 | |
| 39 // True if mouse hover and touch feedback can alter the background color of | |
| 40 // the container. | |
| 41 bool change_background_; | |
| 42 | |
| 43 DISALLOW_COPY_AND_ASSIGN(TrayPopupItemContainer); | |
| 44 }; | |
| 45 | |
| 46 } // namespace ash | |
| 47 | |
| 48 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_POPUP_ITEM_CONTAINER_H_ | |
| OLD | NEW |