Get foreground tab on Android
[chromium-blink-merge.git] / ui / message_center / message_center_tray.h
blob444bb2f4ecbd1ab388681e998e4f632b74437eaa
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.
5 #ifndef UI_MESSAGE_CENTER_MESSAGE_CENTER_TRAY_H_
6 #define UI_MESSAGE_CENTER_MESSAGE_CENTER_TRAY_H_
8 #include "base/observer_list.h"
9 #include "ui/message_center/message_center_export.h"
10 #include "ui/message_center/message_center_observer.h"
11 #include "ui/message_center/message_center_tray_delegate.h"
13 namespace message_center {
15 class MessageCenter;
16 class MessageBubbleBase;
17 class MessagePopupBubble;
18 class QuietModeBubble;
20 // Implementation found with each supported platform's implementation of
21 // MessageCenterTrayDelegate.
22 MessageCenterTrayDelegate* CreateMessageCenterTray();
24 // Class that observes a MessageCenter. Manages the popup and message center
25 // bubbles. Tells the MessageCenterTrayHost when the tray is changed, as well
26 // as when bubbles are shown and hidden.
27 class MESSAGE_CENTER_EXPORT MessageCenterTray : public MessageCenterObserver {
28 public:
29 MessageCenterTray(MessageCenterTrayDelegate* delegate,
30 message_center::MessageCenter* message_center);
31 virtual ~MessageCenterTray();
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();
38 // Hides the message center if visible and returns whether the message center
39 // was visible before.
40 bool HideMessageCenterBubble();
42 // Marks the message center as "not visible" (this method will not hide the
43 // message center).
44 void MarkMessageCenterHidden();
46 void ToggleMessageCenterBubble();
48 // Causes an update if the popup bubble is already shown.
49 void ShowPopupBubble();
51 // Returns whether the popup was visible before.
52 bool HidePopupBubble();
54 // Toggles the visibility of the settings view in the message center bubble.
55 void ShowNotifierSettingsBubble();
57 bool message_center_visible() { return message_center_visible_; }
58 bool popups_visible() { return popups_visible_; }
59 MessageCenterTrayDelegate* delegate() { return delegate_; }
60 const message_center::MessageCenter* message_center() const {
61 return message_center_;
63 message_center::MessageCenter* message_center() { return message_center_; }
65 // Overridden from MessageCenterObserver:
66 virtual void OnNotificationAdded(const std::string& notification_id) OVERRIDE;
67 virtual void OnNotificationRemoved(const std::string& notification_id,
68 bool by_user) OVERRIDE;
69 virtual void OnNotificationUpdated(
70 const std::string& notification_id) OVERRIDE;
71 virtual void OnNotificationClicked(
72 const std::string& notification_id) OVERRIDE;
73 virtual void OnNotificationButtonClicked(
74 const std::string& notification_id,
75 int button_index) OVERRIDE;
76 virtual void OnNotificationDisplayed(
77 const std::string& notification_id) OVERRIDE;
78 virtual void OnQuietModeChanged(bool in_quiet_mode) OVERRIDE;
80 private:
81 void OnMessageCenterChanged();
82 void NotifyMessageCenterTrayChanged();
83 void HidePopupBubbleInternal();
85 // |message_center_| is a weak pointer that must live longer than
86 // MessageCenterTray.
87 message_center::MessageCenter* message_center_;
88 bool message_center_visible_;
89 bool popups_visible_;
90 // |delegate_| is a weak pointer that must live longer than MessageCenterTray.
91 MessageCenterTrayDelegate* delegate_;
93 DISALLOW_COPY_AND_ASSIGN(MessageCenterTray);
96 } // namespace message_center
98 #endif // UI_MESSAGE_CENTER_MESSAGE_CENTER_TRAY_H_