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

Unified Diff: chrome/browser/extensions/app_notification_manager.cc

Issue 8382010: Some fixups for app notifications: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/extensions/app_notification_manager_sync_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | chrome/browser/extensions/app_notification_manager_sync_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698