OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_MESSAGE_CENTER_MESSAGE_CENTER_TRAY_H_ |
| 6 #define UI_MESSAGE_CENTER_MESSAGE_CENTER_TRAY_H_ |
| 7 |
| 8 #include "base/observer_list.h" |
| 9 #include "ui/message_center/message_center.h" |
| 10 #include "ui/message_center/message_center_export.h" |
| 11 #include "ui/message_center/message_center_tray_delegate.h" |
| 12 |
| 13 namespace message_center { |
| 14 |
| 15 class MessageBubbleBase; |
| 16 class MessagePopupBubble; |
| 17 class QuietModeBubble; |
| 18 |
| 19 // Implementation found with each supported platform's implementation of |
| 20 // MessageCenterTrayDelegate. |
| 21 MessageCenterTrayDelegate* CreateMessageCenterTray(); |
| 22 |
| 23 // Class that observes a MessageCenter. Manages the popup and message center |
| 24 // bubbles. Tells the MessageCenterTrayHost when the tray is changed, as well |
| 25 // as when bubbles are shown and hidden. |
| 26 class MESSAGE_CENTER_EXPORT MessageCenterTray |
| 27 : public message_center::MessageCenter::Observer { |
| 28 public: |
| 29 MessageCenterTray(MessageCenterTrayDelegate* delegate, |
| 30 message_center::MessageCenter* message_center); |
| 31 virtual ~MessageCenterTray(); |
| 32 |
| 33 // Shows or updates the message center bubble and hides the popup bubble. |
| 34 // Returns whether the message center is visible after the call, whether or |
| 35 // not it was visible before. |
| 36 bool ShowMessageCenterBubble(); |
| 37 |
| 38 // Returns whether the message center was visible before. |
| 39 bool HideMessageCenterBubble(); |
| 40 |
| 41 void ToggleMessageCenterBubble(); |
| 42 |
| 43 // Causes an update if the popup bubble is already shown. |
| 44 void ShowPopupBubble(); |
| 45 |
| 46 // Returns whether the popup was visible before. |
| 47 bool HidePopupBubble(); |
| 48 |
| 49 bool message_center_visible() { return message_center_visible_; } |
| 50 bool popups_visible() { return popups_visible_; } |
| 51 MessageCenterTrayDelegate* delegate() { return delegate_; } |
| 52 message_center::MessageCenter* message_center() { return message_center_; } |
| 53 |
| 54 // Overridden from message_center::MessageCenter::Observer. |
| 55 virtual void OnMessageCenterChanged(bool new_notification) OVERRIDE; |
| 56 |
| 57 private: |
| 58 void NotifyMessageCenterTrayChanged(); |
| 59 |
| 60 // |message_center_| is a weak pointer that must live longer than |
| 61 // MessageCenterTray. |
| 62 message_center::MessageCenter* message_center_; |
| 63 bool message_center_visible_; |
| 64 bool popups_visible_; |
| 65 // |delegate_| is a weak pointer that must live longer than MessageCenterTray. |
| 66 MessageCenterTrayDelegate* delegate_; |
| 67 |
| 68 DISALLOW_COPY_AND_ASSIGN(MessageCenterTray); |
| 69 }; |
| 70 |
| 71 } // namespace message_center |
| 72 |
| 73 #endif // UI_MESSAGE_CENTER_MESSAGE_CENTER_TRAY_H_ |
OLD | NEW |