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

Unified Diff: chrome/browser/notifications/notification_ui_manager.cc

Issue 5319011: Listen for APP_TERMINATING in notification ui; close windows earlier in the p... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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
« no previous file with comments | « chrome/browser/notifications/notification_ui_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/notifications/notification_ui_manager.cc
===================================================================
--- chrome/browser/notifications/notification_ui_manager.cc (revision 67750)
+++ chrome/browser/notifications/notification_ui_manager.cc (working copy)
@@ -10,6 +10,8 @@
#include "chrome/browser/notifications/balloon_collection.h"
#include "chrome/browser/notifications/notification.h"
#include "chrome/browser/renderer_host/site_instance.h"
+#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_type.h"
// A class which represents a notification waiting to be shown.
class QueuedNotification {
@@ -38,6 +40,8 @@
NotificationUIManager::NotificationUIManager()
: balloon_collection_(NULL) {
+ registrar_.Add(this, NotificationType::APP_TERMINATING,
+ NotificationService::AllSources());
}
NotificationUIManager::~NotificationUIManager() {
@@ -96,6 +100,11 @@
return balloon_collection_->RemoveBySourceOrigin(source) || removed;
}
+void NotificationUIManager::CancelAll() {
+ STLDeleteElements(&show_queue_);
+ balloon_collection_->RemoveAll();
+}
+
void NotificationUIManager::CheckAndShowNotifications() {
// TODO(johnnyg): http://crbug.com/25061 - Check for user idle/presentation.
ShowNotifications();
@@ -147,3 +156,12 @@
return false;
}
+
+void NotificationUIManager::Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ if (type == NotificationType::APP_TERMINATING)
+ CancelAll();
Andrew T Wilson (Slow) 2010/12/01 01:55:56 Could also be CHECK(type == NotificationType::APP_
+ else
+ NOTREACHED();
+}
« no previous file with comments | « chrome/browser/notifications/notification_ui_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698