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