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

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

Issue 2860473002: [Merge to M58] CrOS: Do not allow notifications to be added during shutdown. (Closed)
Patch Set: Created 3 years, 8 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 8f884617f7d1f518f6d38ccda4593ca94c355977..7856230847d04dc3c4d565c2aa791025b9d50807 100644
--- a/chrome/browser/notifications/message_center_notification_manager.cc
+++ b/chrome/browser/notifications/message_center_notification_manager.cc
@@ -82,6 +82,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;
@@ -259,6 +263,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