Index: ui/message_center/notification_list.cc |
diff --git a/ui/message_center/notification_list.cc b/ui/message_center/notification_list.cc |
index 0ac3b1cbb8b07d68ae42e5a5565bc5e8b11af0b1..14abd9b5c420b4a5994288acd9524248ec2a3ff5 100644 |
--- a/ui/message_center/notification_list.cc |
+++ b/ui/message_center/notification_list.cc |
@@ -12,7 +12,6 @@ |
#include "base/time/time.h" |
#include "base/values.h" |
#include "ui/gfx/image/image.h" |
-#include "ui/message_center/message_center.h" |
#include "ui/message_center/message_center_style.h" |
#include "ui/message_center/notification.h" |
#include "ui/message_center/notification_blocker.h" |
@@ -55,8 +54,8 @@ |
return false; |
} |
-NotificationList::NotificationList(MessageCenter* message_center) |
- : message_center_(message_center), |
+NotificationList::NotificationList() |
+ : message_center_visible_(false), |
quiet_mode_(false) { |
} |
@@ -64,12 +63,19 @@ |
STLDeleteContainerPointers(notifications_.begin(), notifications_.end()); |
} |
-void NotificationList::SetNotificationsShown( |
- const NotificationBlockers& blockers, |
+void NotificationList::SetMessageCenterVisible( |
+ bool visible, |
std::set<std::string>* updated_ids) { |
- Notifications notifications = GetVisibleNotifications(blockers); |
- |
- for (auto iter = notifications.begin(); iter != notifications.end(); ++iter) { |
+ if (message_center_visible_ == visible) |
+ return; |
+ |
+ message_center_visible_ = visible; |
+ |
+ if (!visible) |
+ return; |
+ |
+ for (Notifications::iterator iter = notifications_.begin(); |
+ iter != notifications_.end(); ++iter) { |
Notification* notification = *iter; |
bool was_popup = notification->shown_as_popup(); |
bool was_read = notification->IsRead(); |
@@ -340,7 +346,7 @@ |
// TODO(mukai): needs to distinguish if a notification is dismissed by |
// the quiet mode or user operation. |
notification->set_is_read(false); |
- notification->set_shown_as_popup(message_center_->IsMessageCenterVisible() |
+ notification->set_shown_as_popup(message_center_visible_ |
|| quiet_mode_ |
|| notification->shown_as_popup()); |
} |