Index: chrome/browser/extensions/app_notification_manager.cc |
=================================================================== |
--- chrome/browser/extensions/app_notification_manager.cc (revision 106777) |
+++ chrome/browser/extensions/app_notification_manager.cc (working copy) |
@@ -110,6 +110,12 @@ |
base::Bind(&AppNotificationManager::SaveOnFileThread, |
this, extension_id, CopyAppNotificationList(list))); |
} |
+ |
+ content::NotificationService::current()->Notify( |
+ chrome::NOTIFICATION_APP_NOTIFICATION_STATE_CHANGED, |
+ content::Source<Profile>(profile_), |
+ content::Details<const std::string>(&extension_id)); |
+ |
return true; |
} |
@@ -141,6 +147,8 @@ |
if (found == notifications_->end()) |
return NULL; |
const AppNotificationList& list = found->second; |
+ if (list.empty()) |
+ return NULL; |
return list.rbegin()->get(); |
} |
@@ -160,6 +168,11 @@ |
base::Bind(&AppNotificationManager::DeleteOnFileThread, |
this, extension_id)); |
} |
+ |
+ content::NotificationService::current()->Notify( |
+ chrome::NOTIFICATION_APP_NOTIFICATION_STATE_CHANGED, |
+ content::Source<Profile>(profile_), |
+ content::Details<const std::string>(&extension_id)); |
} |
void AppNotificationManager::Observe( |
@@ -201,19 +214,6 @@ |
DCHECK(!loaded()); |
notifications_.reset(map); |
- // Generate STATE_CHAGNED notifications for extensions that have at |
- // least one notification loaded. |
- NotificationMap::const_iterator i; |
- for (i = map->begin(); i != map->end(); ++i) { |
- const std::string& id = i->first; |
- if (i->second.empty()) |
- continue; |
- content::NotificationService::current()->Notify( |
- chrome::NOTIFICATION_APP_NOTIFICATION_STATE_CHANGED, |
asargent_no_longer_on_chrome
2011/10/24 19:09:17
I think removing this code block means that in the
Munjal (Google)
2011/10/24 21:44:11
I thought that since Add now generates STATE_CHANG
Munjal (Google)
2011/10/24 21:46:25
Actually, you are right. We do not call Add in thi
Munjal (Google)
2011/10/24 21:55:22
Done.
|
- content::Source<Profile>(profile_), |
- content::Details<const std::string>(&id)); |
- } |
- |
// Generate MANAGER_LOADED notification. |
content::NotificationService::current()->Notify( |
chrome::NOTIFICATION_APP_NOTIFICATION_MANAGER_LOADED, |
@@ -439,6 +439,11 @@ |
base::Bind(&AppNotificationManager::SaveOnFileThread, |
this, extension_id, CopyAppNotificationList(list))); |
} |
+ |
+ content::NotificationService::current()->Notify( |
+ chrome::NOTIFICATION_APP_NOTIFICATION_STATE_CHANGED, |
+ content::Source<Profile>(profile_), |
+ content::Details<const std::string>(&extension_id)); |
} |
// static |