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

Unified Diff: ui/message_center/views/message_popup_collection.cc

Issue 14017014: Sends updated event for click on notifications. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add tests Created 7 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: ui/message_center/views/message_popup_collection.cc
diff --git a/ui/message_center/views/message_popup_collection.cc b/ui/message_center/views/message_popup_collection.cc
index 1dbcd193ca81304a18494d3756b85f1391296efe..cda9eaa37502aca5efbefc806eb2c4eab47d25dc 100644
--- a/ui/message_center/views/message_popup_collection.cc
+++ b/ui/message_center/views/message_popup_collection.cc
@@ -387,10 +387,10 @@ void MessagePopupCollection::OnNotificationUpdated(
if (toast_iter == toasts_.end())
return;
- NotificationList::Notifications notifications =
- message_center_->GetNotifications();
+ NotificationList::PopupNotifications notifications =
+ message_center_->GetPopupNotifications();
bool updated = false;
- for (NotificationList::Notifications::iterator iter =
+ for (NotificationList::PopupNotifications::iterator iter =
notifications.begin(); iter != notifications.end(); ++iter) {
if ((*iter)->id() != notification_id)
continue;
@@ -403,15 +403,29 @@ void MessagePopupCollection::OnNotificationUpdated(
updated = true;
}
- if (updated) {
- RepositionWidgets();
- // Reposition could create extra space which allows additional widgets.
- UpdateWidgets();
+ // Updated() can be called when a notification is excluded from the popup
dewittj 2013/04/18 17:40:51 nit: OnNotificationUpdated() - it made me wonder i
Jun Mukai 2013/04/18 20:22:12 Done.
+ // notification list but still remains in the full notification list.
+ // In that case the widget for the notification has to be closed here.
+ if (!updated) {
+ views::Widget* widget = toast_iter->second->GetWidget();
+ widget->RemoveObserver(this);
+ widgets_.erase(std::find(widgets_.begin(), widgets_.end(), widget));
+ widget->Close();
+ toasts_.erase(toast_iter);
}
+
+ RepositionWidgets();
+ // Reposition could create extra space which allows additional widgets.
+ UpdateWidgets();
}
void MessagePopupCollection::SetWorkAreaForTest(const gfx::Rect& work_area) {
work_area_ = work_area;
}
+views::Widget* MessagePopupCollection::GetWidgetForId(const std::string& id) {
+ ToastContainer::const_iterator iter = toasts_.find(id);
+ return (iter == toasts_.end()) ? NULL : iter->second->GetWidget();
+}
+
} // namespace message_center
« no previous file with comments | « ui/message_center/views/message_popup_collection.h ('k') | ui/message_center/views/message_popup_collection_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698