| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_SYSTEM_TRAY_TRAY_NOTIFICATION_VIEW_H_ | 5 #ifndef ASH_SYSTEM_TRAY_TRAY_NOTIFICATION_VIEW_H_ |
| 6 #define ASH_SYSTEM_TRAY_TRAY_NOTIFICATION_VIEWS_H_ | 6 #define ASH_SYSTEM_TRAY_TRAY_NOTIFICATION_VIEWS_H_ |
| 7 | 7 |
| 8 #include "ui/views/controls/button/image_button.h" | 8 #include "ui/views/controls/button/image_button.h" |
| 9 #include "ui/views/controls/slide_out_view.h" | 9 #include "ui/views/controls/slide_out_view.h" |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // A view for closable notification views, laid out like: | 25 // A view for closable notification views, laid out like: |
| 26 // ------------------- | 26 // ------------------- |
| 27 // | icon contents x | | 27 // | icon contents x | |
| 28 // ----------------v-- | 28 // ----------------v-- |
| 29 // The close button will call OnClose() when clicked. | 29 // The close button will call OnClose() when clicked. |
| 30 class TrayNotificationView : public views::SlideOutView, | 30 class TrayNotificationView : public views::SlideOutView, |
| 31 public views::ButtonListener { | 31 public views::ButtonListener { |
| 32 public: | 32 public: |
| 33 // If icon_id is 0, no icon image will be set. SetIconImage can be called | 33 // If icon_id is 0, no icon image will be set. SetIconImage can be called |
| 34 // to later set the icon image. | 34 // to later set the icon image. |
| 35 TrayNotificationView(SystemTrayItem* tray, int icon_id); | 35 TrayNotificationView(SystemTrayItem* owner, int icon_id); |
| 36 virtual ~TrayNotificationView(); | 36 virtual ~TrayNotificationView(); |
| 37 | 37 |
| 38 // InitView must be called once with the contents to be displayed. | 38 // InitView must be called once with the contents to be displayed. |
| 39 void InitView(views::View* contents); | 39 void InitView(views::View* contents); |
| 40 | 40 |
| 41 // Sets/updates the icon image. | 41 // Sets/updates the icon image. |
| 42 void SetIconImage(const gfx::ImageSkia& image); | 42 void SetIconImage(const gfx::ImageSkia& image); |
| 43 | 43 |
| 44 // Gets the icons image. | 44 // Gets the icons image. |
| 45 const gfx::ImageSkia& GetIconImage() const; | 45 const gfx::ImageSkia& GetIconImage() const; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 63 | 63 |
| 64 protected: | 64 protected: |
| 65 // Called when the close button is pressed. Does nothing by default. | 65 // Called when the close button is pressed. Does nothing by default. |
| 66 virtual void OnClose(); | 66 virtual void OnClose(); |
| 67 // Called when the notification is clicked on. Does nothing by default. | 67 // Called when the notification is clicked on. Does nothing by default. |
| 68 virtual void OnClickAction(); | 68 virtual void OnClickAction(); |
| 69 | 69 |
| 70 // Overridden from views::SlideOutView. | 70 // Overridden from views::SlideOutView. |
| 71 virtual void OnSlideOut() OVERRIDE; | 71 virtual void OnSlideOut() OVERRIDE; |
| 72 | 72 |
| 73 SystemTrayItem* tray() { return tray_; } | 73 SystemTrayItem* owner() { return owner_; } |
| 74 | 74 |
| 75 private: | 75 private: |
| 76 void HandleClose(); | 76 void HandleClose(); |
| 77 void HandleClickAction(); | 77 void HandleClickAction(); |
| 78 | 78 |
| 79 SystemTrayItem* tray_; | 79 SystemTrayItem* owner_; |
| 80 int icon_id_; | 80 int icon_id_; |
| 81 views::ImageView* icon_; | 81 views::ImageView* icon_; |
| 82 | 82 |
| 83 DISALLOW_COPY_AND_ASSIGN(TrayNotificationView); | 83 DISALLOW_COPY_AND_ASSIGN(TrayNotificationView); |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 } // namespace internal | 86 } // namespace internal |
| 87 } // namespace ash | 87 } // namespace ash |
| 88 | 88 |
| 89 #endif // ASH_SYSTEM_TRAY_TRAY_NOTIFICATION_VIEWS_H_ | 89 #endif // ASH_SYSTEM_TRAY_TRAY_NOTIFICATION_VIEWS_H_ |
| OLD | NEW |