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

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: Use notification manager instead of balloon view, remove singleton-ness from MessageCenterTray. 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..3ffb42d2d07f495ce1a037149c3bb133e5221510
--- /dev/null
+++ b/ui/message_center/message_center_tray.h
@@ -0,0 +1,98 @@
+// 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;
Jun Mukai 2013/01/22 18:55:34 No one looks singleton in this file. Can we remove
dewittj 2013/01/22 20:49:21 Done.
+
+namespace message_center {
+class MessageBubbleBase;
+class MessagePopupBubble;
+class QuietModeBubble;
+}
+
+namespace views {
+class Widget;
+}
+
+namespace ui {
+
+class MessageCenterTrayObserver {
+ public:
+ virtual void OnMessageCenterTrayChanged() = 0;
+
+ protected:
+ virtual ~MessageCenterTrayObserver() {}
+};
+
+class MessageCenterTrayDelegate {
+ public:
+ static MessageCenterTrayDelegate* CreateForPlatform();
+ virtual ~MessageCenterTrayDelegate() {};
+
+ virtual bool ShowPopups(message_center::MessageBubbleBase* bubble) = 0;
+ virtual void HidePopups() = 0;
+ virtual void UpdatePopups() = 0;
+ virtual bool ShowMessageCenter(message_center::MessageBubbleBase* bubble) = 0;
+ virtual void HideMessageCenter() = 0;
+ virtual void UpdateMessageCenter() = 0;
+};
+
+// Class that owns a MessageCenter and hosts it. Manages the popup and message
Jun Mukai 2013/01/22 18:55:34 This class doesn't own MessageCenter but only has
dewittj 2013/01/22 20:49:21 Fixed comment.
+// 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:
+ MessageCenterTray(MessageCenterTrayDelegate* delegate,
+ message_center::MessageCenter* message_center);
+ virtual ~MessageCenterTray();
+
+ void AddObserver(MessageCenterTrayObserver* observer);
+ void RemoveObserver(MessageCenterTrayObserver* observer);
+
+ // Shows or updates the message center bubble and hides the popup bubble.
+ void ShowMessageCenterBubble();
+
+ // Returns whether the message center was visible before.
+ bool HideMessageCenterBubble();
+
+ void ToggleMessageCenterBubble();
+
+ // Causes an update if the popup bubble is already shown.
+ void ShowPopupBubble();
+
+ // Returns whether the popup was visible before.
+ bool HidePopupBubble();
+
+ bool message_center_visible() { return message_center_visible_; }
+ bool popups_visible() { return popups_visible_; }
+ 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