summaryrefslogtreecommitdiffstats
path: root/chrome/browser/notifications/notification_ui_manager.cc
diff options
context:
space:
mode:
authorjohnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-12 03:28:01 +0000
committerjohnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-12 03:28:01 +0000
commitaaba38dc4f74a9e00232417e56bc4a8126aa3093 (patch)
treed8ca67d1dc1a6aedac4df8efff08f32c62ccb864 /chrome/browser/notifications/notification_ui_manager.cc
parenta358fd8076527132d37e0262823abe3807da16b8 (diff)
downloadchromium_src-aaba38dc4f74a9e00232417e56bc4a8126aa3093.zip
chromium_src-aaba38dc4f74a9e00232417e56bc4a8126aa3093.tar.gz
chromium_src-aaba38dc4f74a9e00232417e56bc4a8126aa3093.tar.bz2
Revert 65879 - When an extension is uninstalled, close all desktop notifications from that extension.
This change also refactors the balloon collection code to remove duplication between chrome and chromeos. Removes some gross removal code which was using fake notifications just to get the right ID. BUG=58266 TEST=open notifications from extension, uninstall extensions Review URL: http://codereview.chromium.org/4635007 TBR=johnnyg@chromium.org Review URL: http://codereview.chromium.org/4855002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65896 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/notifications/notification_ui_manager.cc')
-rw-r--r--chrome/browser/notifications/notification_ui_manager.cc27
1 files changed, 5 insertions, 22 deletions
diff --git a/chrome/browser/notifications/notification_ui_manager.cc b/chrome/browser/notifications/notification_ui_manager.cc
index 27f7626..adc44cf 100644
--- a/chrome/browser/notifications/notification_ui_manager.cc
+++ b/chrome/browser/notifications/notification_ui_manager.cc
@@ -66,34 +66,17 @@ void NotificationUIManager::Add(const Notification& notification,
CheckAndShowNotifications();
}
-bool NotificationUIManager::CancelById(const std::string& id) {
- // See if this ID hasn't been shown yet.
+bool NotificationUIManager::Cancel(const Notification& notification) {
+ // First look through the notifications that haven't been shown. If not
+ // found there, call to the active balloon collection to tear it down.
NotificationDeque::iterator iter;
for (iter = show_queue_.begin(); iter != show_queue_.end(); ++iter) {
- if ((*iter)->notification().notification_id() == id) {
+ if (notification.IsSame((*iter)->notification())) {
show_queue_.erase(iter);
return true;
}
}
- // If it has been shown, remove it from the balloon collections.
- return balloon_collection_->RemoveById(id);
-}
-
-bool NotificationUIManager::CancelAllBySourceOrigin(const GURL& source) {
- // Same pattern as CancelById, but more complicated than the above
- // because there may be multiple notifications from the same source.
- bool removed = false;
- NotificationDeque::iterator iter;
- for (iter = show_queue_.begin(); iter != show_queue_.end(); ++iter) {
- if ((*iter)->notification().origin_url() == source) {
- iter = show_queue_.erase(iter);
- removed = true;
- } else {
- ++iter;
- }
- }
-
- return balloon_collection_->RemoveBySourceOrigin(source) || removed;
+ return balloon_collection_->Remove(notification);
}
void NotificationUIManager::CheckAndShowNotifications() {