OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_CENTER_TRAY_H_ | 5 #ifndef UI_MESSAGE_CENTER_MESSAGE_CENTER_TRAY_H_ |
6 #define UI_MESSAGE_CENTER_MESSAGE_CENTER_TRAY_H_ | 6 #define UI_MESSAGE_CENTER_MESSAGE_CENTER_TRAY_H_ |
7 | 7 |
8 #include "base/observer_list.h" | 8 #include "base/observer_list.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "ui/message_center/message_center_export.h" | 10 #include "ui/message_center/message_center_export.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 // MessageCenterTrayDelegate. | 27 // MessageCenterTrayDelegate. |
28 MessageCenterTrayDelegate* CreateMessageCenterTray(); | 28 MessageCenterTrayDelegate* CreateMessageCenterTray(); |
29 | 29 |
30 // Class that observes a MessageCenter. Manages the popup and message center | 30 // Class that observes a MessageCenter. Manages the popup and message center |
31 // bubbles. Tells the MessageCenterTrayHost when the tray is changed, as well | 31 // bubbles. Tells the MessageCenterTrayHost when the tray is changed, as well |
32 // as when bubbles are shown and hidden. | 32 // as when bubbles are shown and hidden. |
33 class MESSAGE_CENTER_EXPORT MessageCenterTray : public MessageCenterObserver { | 33 class MESSAGE_CENTER_EXPORT MessageCenterTray : public MessageCenterObserver { |
34 public: | 34 public: |
35 MessageCenterTray(MessageCenterTrayDelegate* delegate, | 35 MessageCenterTray(MessageCenterTrayDelegate* delegate, |
36 message_center::MessageCenter* message_center); | 36 message_center::MessageCenter* message_center); |
37 virtual ~MessageCenterTray(); | 37 ~MessageCenterTray() override; |
38 | 38 |
39 // Shows or updates the message center bubble and hides the popup bubble. | 39 // Shows or updates the message center bubble and hides the popup bubble. |
40 // Returns whether the message center is visible after the call, whether or | 40 // Returns whether the message center is visible after the call, whether or |
41 // not it was visible before. | 41 // not it was visible before. |
42 bool ShowMessageCenterBubble(); | 42 bool ShowMessageCenterBubble(); |
43 | 43 |
44 // Hides the message center if visible and returns whether the message center | 44 // Hides the message center if visible and returns whether the message center |
45 // was visible before. | 45 // was visible before. |
46 bool HideMessageCenterBubble(); | 46 bool HideMessageCenterBubble(); |
47 | 47 |
(...skipping 19 matching lines...) Expand all Loading... |
67 | 67 |
68 bool message_center_visible() { return message_center_visible_; } | 68 bool message_center_visible() { return message_center_visible_; } |
69 bool popups_visible() { return popups_visible_; } | 69 bool popups_visible() { return popups_visible_; } |
70 MessageCenterTrayDelegate* delegate() { return delegate_; } | 70 MessageCenterTrayDelegate* delegate() { return delegate_; } |
71 const message_center::MessageCenter* message_center() const { | 71 const message_center::MessageCenter* message_center() const { |
72 return message_center_; | 72 return message_center_; |
73 } | 73 } |
74 message_center::MessageCenter* message_center() { return message_center_; } | 74 message_center::MessageCenter* message_center() { return message_center_; } |
75 | 75 |
76 // Overridden from MessageCenterObserver: | 76 // Overridden from MessageCenterObserver: |
77 virtual void OnNotificationAdded(const std::string& notification_id) override; | 77 void OnNotificationAdded(const std::string& notification_id) override; |
78 virtual void OnNotificationRemoved(const std::string& notification_id, | 78 void OnNotificationRemoved(const std::string& notification_id, |
79 bool by_user) override; | 79 bool by_user) override; |
80 virtual void OnNotificationUpdated( | 80 void OnNotificationUpdated(const std::string& notification_id) override; |
81 const std::string& notification_id) override; | 81 void OnNotificationClicked(const std::string& notification_id) override; |
82 virtual void OnNotificationClicked( | 82 void OnNotificationButtonClicked(const std::string& notification_id, |
83 const std::string& notification_id) override; | 83 int button_index) override; |
84 virtual void OnNotificationButtonClicked( | 84 void OnNotificationDisplayed(const std::string& notification_id, |
85 const std::string& notification_id, | 85 const DisplaySource source) override; |
86 int button_index) override; | 86 void OnQuietModeChanged(bool in_quiet_mode) override; |
87 virtual void OnNotificationDisplayed( | 87 void OnBlockingStateChanged(NotificationBlocker* blocker) override; |
88 const std::string& notification_id, | |
89 const DisplaySource source) override; | |
90 virtual void OnQuietModeChanged(bool in_quiet_mode) override; | |
91 virtual void OnBlockingStateChanged(NotificationBlocker* blocker) override; | |
92 | 88 |
93 private: | 89 private: |
94 void OnMessageCenterChanged(); | 90 void OnMessageCenterChanged(); |
95 void NotifyMessageCenterTrayChanged(); | 91 void NotifyMessageCenterTrayChanged(); |
96 void HidePopupBubbleInternal(); | 92 void HidePopupBubbleInternal(); |
97 | 93 |
98 // |message_center_| is a weak pointer that must live longer than | 94 // |message_center_| is a weak pointer that must live longer than |
99 // MessageCenterTray. | 95 // MessageCenterTray. |
100 message_center::MessageCenter* message_center_; | 96 message_center::MessageCenter* message_center_; |
101 bool message_center_visible_; | 97 bool message_center_visible_; |
102 bool popups_visible_; | 98 bool popups_visible_; |
103 // |delegate_| is a weak pointer that must live longer than MessageCenterTray. | 99 // |delegate_| is a weak pointer that must live longer than MessageCenterTray. |
104 MessageCenterTrayDelegate* delegate_; | 100 MessageCenterTrayDelegate* delegate_; |
105 | 101 |
106 DISALLOW_COPY_AND_ASSIGN(MessageCenterTray); | 102 DISALLOW_COPY_AND_ASSIGN(MessageCenterTray); |
107 }; | 103 }; |
108 | 104 |
109 } // namespace message_center | 105 } // namespace message_center |
110 | 106 |
111 #endif // UI_MESSAGE_CENTER_MESSAGE_CENTER_TRAY_H_ | 107 #endif // UI_MESSAGE_CENTER_MESSAGE_CENTER_TRAY_H_ |
OLD | NEW |