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

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

Issue 2776933006: CrOS: Do not allow notifications to be added during shutdown. (Closed)
Patch Set: Trybots. Created 3 years, 9 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: chrome/browser/notifications/message_center_notification_manager.cc
diff --git a/chrome/browser/notifications/message_center_notification_manager.cc b/chrome/browser/notifications/message_center_notification_manager.cc
index e60cdd6f8c11a0a9b8e80ab4bde751eb77425501..9376d91c85f4f3bf6f0bd5f304b4cdee6c76b2ed 100644
--- a/chrome/browser/notifications/message_center_notification_manager.cc
+++ b/chrome/browser/notifications/message_center_notification_manager.cc
@@ -80,6 +80,10 @@ MessageCenterNotificationManager::~MessageCenterNotificationManager() {
void MessageCenterNotificationManager::Add(const Notification& notification,
Profile* profile) {
+ // We won't have time to process and act on this notification.
+ if (is_shutdown_started_)
+ return;
+
if (Update(notification, profile))
return;
@@ -257,6 +261,11 @@ void MessageCenterNotificationManager::CancelAll() {
false /* by_user */, message_center::MessageCenter::RemoveType::ALL);
}
+void MessageCenterNotificationManager::StartShutdown() {
+ is_shutdown_started_ = true;
+ CancelAll();
+}
+
////////////////////////////////////////////////////////////////////////////////
// MessageCenter::Observer
void MessageCenterNotificationManager::OnNotificationRemoved(

Powered by Google App Engine
This is Rietveld 408576698