Chromium Code Reviews| Index: ui/message_center/notification_list.cc |
| diff --git a/ui/message_center/notification_list.cc b/ui/message_center/notification_list.cc |
| index 8634394bd79e233de8f83e2e9d26d0ea63c68856..8c51bd26bdd3e82d9aac46b6ecce822b227ce3c0 100644 |
| --- a/ui/message_center/notification_list.cc |
| +++ b/ui/message_center/notification_list.cc |
| @@ -48,22 +48,35 @@ NotificationList::~NotificationList() { |
| STLDeleteContainerPointers(notifications_.begin(), notifications_.end()); |
| } |
| -void NotificationList::SetMessageCenterVisible(bool visible) { |
| +void NotificationList::SetMessageCenterVisible( |
| + bool visible, |
| + std::set<std::string>* updated_ids) { |
| if (message_center_visible_ == visible) |
| return; |
| + |
| + std::set<std::string> dummy_ids; |
|
dewittj
2013/04/16 23:59:13
I don't love keeping a dummy data structure around
Jun Mukai
2013/04/17 01:04:43
Done.
|
| + if (!updated_ids) |
| + updated_ids = &dummy_ids; |
| + |
| message_center_visible_ = visible; |
| // When the center appears, mark all notifications as shown, and |
| // when the center is hidden, clear the unread count, and mark all |
| // notifications as read. |
| - if (!visible) |
| + if (!visible) { |
|
dewittj
2013/04/16 23:59:13
no braces
Jun Mukai
2013/04/17 01:04:43
Done.
|
| unread_count_ = 0; |
| + } |
| for (Notifications::iterator iter = notifications_.begin(); |
| iter != notifications_.end(); ++iter) { |
| - if (visible) |
| + if (visible) { |
| + if (!(*iter)->shown_as_popup()) |
| + updated_ids->insert((*iter)->id()); |
| (*iter)->set_shown_as_popup(true); |
| - else |
| + } else { |
| + if (!(*iter)->is_read()) |
| + updated_ids->insert((*iter)->id()); |
| (*iter)->set_is_read(true); |
| + } |
| } |
| } |