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 UI_MESSAGE_CENTER_MESSAGE_POPUP_BUBBLE_H_ | 5 #ifndef UI_MESSAGE_CENTER_MESSAGE_POPUP_BUBBLE_H_ |
6 #define UI_MESSAGE_CENTER_MESSAGE_POPUP_BUBBLE_H_ | 6 #define UI_MESSAGE_CENTER_MESSAGE_POPUP_BUBBLE_H_ |
7 | 7 |
| 8 #include <map> |
| 9 #include <set> |
| 10 #include <string> |
| 11 |
8 #include "base/timer.h" | 12 #include "base/timer.h" |
9 #include "ui/message_center/message_bubble_base.h" | 13 #include "ui/message_center/message_bubble_base.h" |
10 #include "ui/message_center/message_center_export.h" | 14 #include "ui/message_center/message_center_export.h" |
11 #include "ui/message_center/notification_list.h" | 15 #include "ui/message_center/notification_list.h" |
12 | 16 |
13 namespace message_center { | 17 namespace message_center { |
14 | 18 |
15 class PopupBubbleContentsView; | 19 class PopupBubbleContentsView; |
16 | 20 |
17 // Bubble for popup notifications. | 21 // Bubble for popup notifications. |
18 class MESSAGE_CENTER_EXPORT MessagePopupBubble : public MessageBubbleBase { | 22 class MESSAGE_CENTER_EXPORT MessagePopupBubble : public MessageBubbleBase { |
19 public: | 23 public: |
20 explicit MessagePopupBubble(NotificationList::Delegate* delegate); | 24 explicit MessagePopupBubble(NotificationList::Delegate* delegate); |
21 | 25 |
22 virtual ~MessagePopupBubble(); | 26 virtual ~MessagePopupBubble(); |
23 | 27 |
24 // Overridden from MessageBubbleBase. | 28 // Overridden from MessageBubbleBase. |
25 virtual views::TrayBubbleView::InitParams GetInitParams( | 29 virtual views::TrayBubbleView::InitParams GetInitParams( |
26 views::TrayBubbleView::AnchorAlignment anchor_alignment) OVERRIDE; | 30 views::TrayBubbleView::AnchorAlignment anchor_alignment) OVERRIDE; |
27 virtual void InitializeContents(views::TrayBubbleView* bubble_view) OVERRIDE; | 31 virtual void InitializeContents(views::TrayBubbleView* bubble_view) OVERRIDE; |
28 virtual void OnBubbleViewDestroyed() OVERRIDE; | 32 virtual void OnBubbleViewDestroyed() OVERRIDE; |
29 virtual void UpdateBubbleView() OVERRIDE; | 33 virtual void UpdateBubbleView() OVERRIDE; |
30 virtual void OnMouseEnteredView() OVERRIDE; | 34 virtual void OnMouseEnteredView() OVERRIDE; |
31 virtual void OnMouseExitedView() OVERRIDE; | 35 virtual void OnMouseExitedView() OVERRIDE; |
32 | 36 |
33 size_t NumMessageViewsForTest() const; | 37 size_t NumMessageViewsForTest() const; |
34 | 38 |
35 private: | 39 private: |
36 void StartAutoCloseTimer(int priority); | 40 class AutocloseTimer; |
37 void StopAutoCloseTimer(); | |
38 | 41 |
39 void OnAutoClose(int priority); | 42 void OnAutoClose(const std::string& id); |
40 | 43 |
41 base::OneShotTimer<MessagePopupBubble> autoclose_default_; | 44 void DeleteTimer(const std::string& id); |
42 base::OneShotTimer<MessagePopupBubble> autoclose_high_; | 45 |
| 46 std::map<std::string, AutocloseTimer*> autoclose_timers_; |
43 PopupBubbleContentsView* contents_view_; | 47 PopupBubbleContentsView* contents_view_; |
44 NotificationList::Notifications popup_notifications_; | 48 std::set<std::string> popup_ids_; |
45 bool should_run_default_timer_; | |
46 bool should_run_high_timer_; | |
47 | 49 |
48 DISALLOW_COPY_AND_ASSIGN(MessagePopupBubble); | 50 DISALLOW_COPY_AND_ASSIGN(MessagePopupBubble); |
49 }; | 51 }; |
50 | 52 |
51 } // namespace message_center | 53 } // namespace message_center |
52 | 54 |
53 #endif // UI_MESSAGE_CENTER_MESSAGE_POPUP_BUBBLE_H_ | 55 #endif // UI_MESSAGE_CENTER_MESSAGE_POPUP_BUBBLE_H_ |
OLD | NEW |