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 "base/timer.h" |
8 #include "ui/views/controls/button/image_button.h" | 9 #include "ui/views/controls/button/image_button.h" |
9 #include "ui/views/controls/slide_out_view.h" | 10 #include "ui/views/controls/slide_out_view.h" |
10 | 11 |
11 namespace gfx { | 12 namespace gfx { |
12 class ImageSkia; | 13 class ImageSkia; |
13 } | 14 } |
14 | 15 |
15 namespace views { | 16 namespace views { |
16 class ImageView; | 17 class ImageView; |
17 } | 18 } |
(...skipping 26 matching lines...) Expand all Loading... |
44 // Gets the icons image. | 45 // Gets the icons image. |
45 const gfx::ImageSkia& GetIconImage() const; | 46 const gfx::ImageSkia& GetIconImage() const; |
46 | 47 |
47 // Replaces the contents view. | 48 // Replaces the contents view. |
48 void UpdateView(views::View* new_contents); | 49 void UpdateView(views::View* new_contents); |
49 | 50 |
50 // Replaces the contents view and updates the icon image. | 51 // Replaces the contents view and updates the icon image. |
51 void UpdateViewAndImage(views::View* new_contents, | 52 void UpdateViewAndImage(views::View* new_contents, |
52 const gfx::ImageSkia& image); | 53 const gfx::ImageSkia& image); |
53 | 54 |
| 55 // Autoclose timer operations. |
| 56 void StartAutoCloseTimer(int seconds); |
| 57 void StopAutoCloseTimer(); |
| 58 void RestartAutoCloseTimer(); |
| 59 |
54 // Overridden from ButtonListener. | 60 // Overridden from ButtonListener. |
55 virtual void ButtonPressed(views::Button* sender, | 61 virtual void ButtonPressed(views::Button* sender, |
56 const ui::Event& event) OVERRIDE; | 62 const ui::Event& event) OVERRIDE; |
57 | 63 |
58 // Overridden from views::View. | 64 // Overridden from views::View. |
59 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 65 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
60 | 66 |
61 // Overridden from ui::EventHandler. | 67 // Overridden from ui::EventHandler. |
62 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 68 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
63 | 69 |
64 protected: | 70 protected: |
65 // Called when the close button is pressed. Does nothing by default. | 71 // Called when the close button is pressed. Does nothing by default. |
66 virtual void OnClose(); | 72 virtual void OnClose(); |
67 // Called when the notification is clicked on. Does nothing by default. | 73 // Called when the notification is clicked on. Does nothing by default. |
68 virtual void OnClickAction(); | 74 virtual void OnClickAction(); |
69 | 75 |
70 // Overridden from views::SlideOutView. | 76 // Overridden from views::SlideOutView. |
71 virtual void OnSlideOut() OVERRIDE; | 77 virtual void OnSlideOut() OVERRIDE; |
72 | 78 |
73 SystemTrayItem* owner() { return owner_; } | 79 SystemTrayItem* owner() { return owner_; } |
74 | 80 |
75 private: | 81 private: |
76 void HandleClose(); | 82 void HandleClose(); |
77 void HandleClickAction(); | 83 void HandleClickAction(); |
78 | 84 |
79 SystemTrayItem* owner_; | 85 SystemTrayItem* owner_; |
80 int icon_id_; | 86 int icon_id_; |
81 views::ImageView* icon_; | 87 views::ImageView* icon_; |
82 | 88 |
| 89 int autoclose_delay_; |
| 90 base::OneShotTimer<TrayNotificationView> autoclose_; |
| 91 |
83 DISALLOW_COPY_AND_ASSIGN(TrayNotificationView); | 92 DISALLOW_COPY_AND_ASSIGN(TrayNotificationView); |
84 }; | 93 }; |
85 | 94 |
86 } // namespace internal | 95 } // namespace internal |
87 } // namespace ash | 96 } // namespace ash |
88 | 97 |
89 #endif // ASH_SYSTEM_TRAY_TRAY_NOTIFICATION_VIEWS_H_ | 98 #endif // ASH_SYSTEM_TRAY_TRAY_NOTIFICATION_VIEWS_H_ |
OLD | NEW |