Index: chrome/browser/notifications/notification_ui_manager.h |
diff --git a/chrome/browser/notifications/notification_ui_manager.h b/chrome/browser/notifications/notification_ui_manager.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b76d8ab8aa04a75f9f1ece935c164a049fd4ee84 |
--- /dev/null |
+++ b/chrome/browser/notifications/notification_ui_manager.h |
@@ -0,0 +1,61 @@ |
+// Copyright (c) 2009 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 CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ |
+#define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ |
+ |
+#include <deque> |
+ |
+#include "base/id_map.h" |
+#include "base/scoped_ptr.h" |
+#include "chrome/browser/notifications/balloons.h" |
+ |
+class Notification; |
+class Profile; |
+class QueuedNotification; |
+class SiteInstance; |
+ |
+typedef std::deque<QueuedNotification*> NotificationDeque; |
+ |
+// The notification manager is a singleton class which manages |
+// all aspects of using the desktop for notifications. It maintains |
+// a queue of pending notifications when space becomes constrained. |
+class NotificationUIManager : public BalloonCollectionObserver { |
+ public: |
+ ~NotificationUIManager(); |
+ |
+ static NotificationUIManager* Create(); |
+ |
+ void Initialize(BalloonCollectionInterface* balloon_collection); |
+ |
+ // Adds a notification to be displayed. |
+ void Add(const Notification& notification, |
+ Profile* profile, SiteInstance* site_instance); |
+ |
+ // BalloonCollectionObserver implementation. |
+ virtual void OnBalloonSpaceChanged(); |
+ |
+ private: |
+ NotificationUIManager() |
+ : balloons_observer_(NULL), |
+ balloon_collection_(NULL) { |
+ } |
+ |
+ // Attempts to display notifications from the show_queue if the user |
+ // is active. |
+ void CheckAndShowNotifications(); |
+ |
+ // Attempts to display notifications from the show_queue. |
+ void ShowNotifications(); |
+ |
+ BalloonCollectionObserver* balloons_observer_; |
+ scoped_ptr<BalloonCollectionInterface> balloon_collection_; |
+ NotificationDeque show_queue_; |
+ |
+ IDMap<NotificationObjectProxy> proxy_map_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(NotificationUIManager); |
+}; |
+ |
+#endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_MANAGER_H_ |