summaryrefslogtreecommitdiffstats
path: root/chrome/browser/notifications/notification_ui_manager.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/notifications/notification_ui_manager.h')
-rw-r--r--chrome/browser/notifications/notification_ui_manager.h28
1 files changed, 25 insertions, 3 deletions
diff --git a/chrome/browser/notifications/notification_ui_manager.h b/chrome/browser/notifications/notification_ui_manager.h
index 10687a9..de429db 100644
--- a/chrome/browser/notifications/notification_ui_manager.h
+++ b/chrome/browser/notifications/notification_ui_manager.h
@@ -7,11 +7,14 @@
#pragma once
#include <deque>
+#include <string>
#include "base/id_map.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/notifications/balloon.h"
#include "chrome/browser/notifications/balloon_collection.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
class Notification;
class Profile;
@@ -21,7 +24,8 @@ class SiteInstance;
// The notification manager manages use of the desktop for notifications.
// It maintains a queue of pending notifications when space becomes constrained.
class NotificationUIManager
- : public BalloonCollection::BalloonSpaceChangeListener {
+ : public BalloonCollection::BalloonSpaceChangeListener,
+ public NotificationObserver {
public:
NotificationUIManager();
virtual ~NotificationUIManager();
@@ -43,14 +47,29 @@ class NotificationUIManager
virtual void Add(const Notification& notification,
Profile* profile);
- // Removes a notification.
- virtual bool Cancel(const Notification& notification);
+ // Removes any notifications matching the supplied ID, either currently
+ // displayed or in the queue. Returns true if anything was removed.
+ virtual bool CancelById(const std::string& notification_id);
+
+ // Removes any notifications matching the supplied source origin
+ // (which could be an extension ID), either currently displayed or in the
+ // queue. Returns true if anything was removed.
+ virtual bool CancelAllBySourceOrigin(const GURL& source_origin);
+
+ // Cancels all pending notifications and closes anything currently showing.
+ // Used when the app is terminating.
+ void CancelAll();
// Returns balloon collection.
BalloonCollection* balloon_collection() {
return balloon_collection_.get();
}
+ // NotificationObserver interface (the event signaling kind of notifications)
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
private:
// Attempts to display notifications from the show_queue if the user
// is active.
@@ -73,6 +92,9 @@ class NotificationUIManager
typedef std::deque<QueuedNotification*> NotificationDeque;
NotificationDeque show_queue_;
+ // Registrar for the other kind of notifications (event signaling).
+ NotificationRegistrar registrar_;
+
DISALLOW_COPY_AND_ASSIGN(NotificationUIManager);
};