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

Unified Diff: ui/message_center/notification_list.cc

Issue 11827010: Fixes the policy to choose the notifications for popups. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | « ui/message_center/notification_list.h ('k') | ui/message_center/notification_list_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/notification_list.cc
diff --git a/ui/message_center/notification_list.cc b/ui/message_center/notification_list.cc
index d92051a7ee1510a71dcd22d180636800d94637f7..9ff468b7cde06ceed5a0906a78ba35c42aceaa7a 100644
--- a/ui/message_center/notification_list.cc
+++ b/ui/message_center/notification_list.cc
@@ -234,7 +234,7 @@ void NotificationList::GetPopupNotifications(
for (int i = ui::notifications::DEFAULT_PRIORITY;
i <= ui::notifications::MAX_PRIORITY; ++i) {
Notifications::iterator first, last;
- GetPopupIterators(i, first, last);
+ GetPopupIterators(i, &first, &last);
if (first != last)
iters.push_back(make_pair(first, last));
}
@@ -256,7 +256,7 @@ void NotificationList::GetPopupNotifications(
void NotificationList::MarkPopupsAsShown(int priority) {
Notifications::iterator first, last;
- GetPopupIterators(priority, first, last);
+ GetPopupIterators(priority, &first, &last);
for (Notifications::iterator iter = first; iter != last; ++iter)
iter->shown_as_popup = true;
}
@@ -367,28 +367,32 @@ void NotificationList::PushNotification(Notification& notification) {
}
void NotificationList::GetPopupIterators(int priority,
- Notifications::iterator& first,
- Notifications::iterator& last) {
+ Notifications::iterator* first,
+ Notifications::iterator* last) {
Notifications& notifications = notifications_[priority];
// No popups for LOW/MIN priority.
if (priority < ui::notifications::DEFAULT_PRIORITY) {
- first = notifications.end();
- last = notifications.end();
+ *first = notifications.end();
+ *last = notifications.end();
return;
}
size_t popup_count = 0;
- first = notifications.begin();
- last = first;
- while (last != notifications.end()) {
- if (last->shown_as_popup)
+ *first = notifications.begin();
+ *last = *first;
+ while (*last != notifications.end()) {
+ if ((*last)->shown_as_popup)
break;
- ++last;
- popup_count++;
- // No limits for HIGH/MAX priority.
+ ++(*last);
+
+ // Checking limits. No limits for HIGH/MAX priority. DEFAULT priority
+ // will return at most kMaxVisiblePopupNotifications entries. If the
+ // popup entries are more, older entries are used. see crbug.com/165768
if (priority == ui::notifications::DEFAULT_PRIORITY &&
popup_count >= kMaxVisiblePopupNotifications) {
- break;
+ ++(*first);
+ } else {
+ ++popup_count;
}
}
}
« no previous file with comments | « ui/message_center/notification_list.h ('k') | ui/message_center/notification_list_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698