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

Side by Side Diff: chrome/browser/notifications/notification_system_observer.cc

Issue 2776933006: CrOS: Do not allow notifications to be added during shutdown. (Closed)
Patch Set: Trybots. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/notifications/notification_system_observer.h" 5 #include "chrome/browser/notifications/notification_system_observer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/notifications/notification_ui_manager.h" 9 #include "chrome/browser/notifications/notification_ui_manager.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 14 matching lines...) Expand all
25 } 25 }
26 26
27 NotificationSystemObserver::~NotificationSystemObserver() { 27 NotificationSystemObserver::~NotificationSystemObserver() {
28 } 28 }
29 29
30 void NotificationSystemObserver::Observe( 30 void NotificationSystemObserver::Observe(
31 int type, 31 int type,
32 const content::NotificationSource& source, 32 const content::NotificationSource& source,
33 const content::NotificationDetails& details) { 33 const content::NotificationDetails& details) {
34 if (type == chrome::NOTIFICATION_APP_TERMINATING) { 34 if (type == chrome::NOTIFICATION_APP_TERMINATING) {
35 ui_manager_->CancelAll(); 35 ui_manager_->StartShutdown();
36 } else if (type == extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED) { 36 } else if (type == extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED) {
37 if (!content::Source<Profile>(source)->IsOffTheRecord()) { 37 if (!content::Source<Profile>(source)->IsOffTheRecord()) {
38 extensions::UnloadedExtensionInfo* extension_info = 38 extensions::UnloadedExtensionInfo* extension_info =
39 content::Details<extensions::UnloadedExtensionInfo>(details).ptr(); 39 content::Details<extensions::UnloadedExtensionInfo>(details).ptr();
40 const extensions::Extension* extension = extension_info->extension; 40 const extensions::Extension* extension = extension_info->extension;
41 ui_manager_->CancelAllBySourceOrigin(extension->url()); 41 ui_manager_->CancelAllBySourceOrigin(extension->url());
42 } 42 }
43 } else if (type == chrome::NOTIFICATION_PROFILE_DESTROYED) { 43 } else if (type == chrome::NOTIFICATION_PROFILE_DESTROYED) {
44 // We only want to remove the incognito notifications. 44 // We only want to remove the incognito notifications.
45 if (content::Source<Profile>(source)->IsOffTheRecord()) 45 if (content::Source<Profile>(source)->IsOffTheRecord())
46 ui_manager_->CancelAllByProfile(NotificationUIManager::GetProfileID( 46 ui_manager_->CancelAllByProfile(NotificationUIManager::GetProfileID(
47 content::Source<Profile>(source).ptr())); 47 content::Source<Profile>(source).ptr()));
48 } else { 48 } else {
49 NOTREACHED(); 49 NOTREACHED();
50 } 50 }
51 } 51 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698