Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(947)

Unified Diff: ui/message_center/message_center_tray.h

Issue 11819048: Implement message center on Windows (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Now with more tests, and corrected copyright notices. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/message_center/message_center_tray.h
diff --git a/ui/message_center/message_center_tray.h b/ui/message_center/message_center_tray.h
new file mode 100644
index 0000000000000000000000000000000000000000..344056c908f350f0bc313b34222ebf016e68fcbb
--- /dev/null
+++ b/ui/message_center/message_center_tray.h
@@ -0,0 +1,102 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_MESSAGE_CENTER_MESSAGE_CENTER_TRAY_H_
+#define UI_MESSAGE_CENTER_MESSAGE_CENTER_TRAY_H_
+
+#include "base/observer_list.h"
+#include "ui/message_center/message_center.h"
+#include "ui/message_center/message_center_export.h"
+#include "ui/views/bubble/tray_bubble_view.h"
+
+template <typename T> struct DefaultSingletonTraits;
+
+namespace message_center {
+class MessageBubbleBase;
+class MessagePopupBubble;
+class QuietModeBubble;
+}
+
+namespace views {
+class Widget;
+}
+
+namespace ui {
+
+class MESSAGE_CENTER_EXPORT MessageCenterTrayObserver {
+ public:
+ virtual ~MessageCenterTrayObserver() {}
stevenjb 2013/01/18 23:11:46 destructor should be protected
dewittj 2013/01/20 19:02:06 Done.
+
+ virtual void OnMessageCenterTrayChanged() {}
stevenjb 2013/01/18 23:11:46 With just a single method, it should be a pure vir
dewittj 2013/01/20 19:02:06 Done.
+};
+
+class MESSAGE_CENTER_EXPORT MessageCenterTrayDelegate {
+ public:
+ virtual ~MessageCenterTrayDelegate () {}
+
+ virtual bool ShowPopups(message_center::MessageBubbleBase* bubble) = 0;
+ virtual void HidePopups() = 0;
+ virtual void UpdatePopups() {}
stevenjb 2013/01/18 23:11:46 Default implementations, even trivial ones, should
dewittj 2013/01/20 19:02:06 Done.
+ virtual bool ShowMessageCenter(message_center::MessageBubbleBase* bubble) = 0;
+ virtual void HideMessageCenter() = 0;
+ virtual void UpdateMessageCenter() {}
+};
+
+
stevenjb 2013/01/18 23:11:46 one blank line
dewittj 2013/01/20 19:02:06 Done.
+// Class that owns a MessageCenter and hosts it. Manages the popup and message
+// center bubbles. Tells the MessageCenterTrayHost when the tray is changed, as
+// well as when bubbles are shown and hidden.
+class MESSAGE_CENTER_EXPORT MessageCenterTray
+ : public message_center::MessageCenter::Observer {
+ public:
+ explicit MessageCenterTray(MessageCenterTrayDelegate* host);
+ virtual ~MessageCenterTray();
+
+ void AddObserver(MessageCenterTrayObserver* observer);
+ void RemoveObserver(MessageCenterTrayObserver* observer);
+
+ // Shows or updates the message center bubble and hides the popup bubble.
+ void ShowMessageCenterBubble();
+
+ // Hides the message center bubble if visible.
+ bool HideMessageCenterBubble();
+
+ void ToggleMessageCenterBubble();
+
+ // Shows or updates the popup notification bubble if appropriate. Calls
+ // MessageCenterTrayHost::CanShowPopups to determine if the system is in a
+ // good state for popups.
+ void ShowPopupBubble();
+
+ // Hides the notification bubble if visible.
+ bool HidePopupBubble();
+
+ bool IsMessageCenterVisible() { return message_center_visible_; }
stevenjb 2013/01/18 23:11:46 Should just be message_center_visible()
dewittj 2013/01/20 19:02:06 Done.
+
+ bool IsPopupVisible() { return popups_visible_; }
stevenjb 2013/01/18 23:11:46 popups_visible()
dewittj 2013/01/20 19:02:06 Done.
+
+ MessageCenterTrayDelegate* delegate() { return delegate_; }
+ message_center::MessageCenter* message_center() {
+ return message_center_;
+ }
+
+ // Overridden from message_center::MessageCenter::Observer.
+ virtual void OnMessageCenterChanged(bool new_notification) OVERRIDE;
+
+ private:
+ // Notify each observer of events.
+ void NotifyMessageCenterTrayChanged();
+
+ message_center::MessageCenter* message_center_;
+ bool message_center_visible_;
+ bool popups_visible_;
+ MessageCenterTrayDelegate* delegate_;
+ ObserverList<MessageCenterTrayObserver> observers_;
+
+ DISALLOW_COPY_AND_ASSIGN(MessageCenterTray);
+};
+
+} // namespace ui
+
+#endif // UI_MESSAGE_CENTER_MESSAGE_CENTER_TRAY_H_

Powered by Google App Engine
This is Rietveld 408576698