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

Side by Side Diff: ui/message_center/popup_timers_controller.cc

Issue 2126433002: Use container::back() and container::pop_back() in ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pre-increment Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/message_center/popup_timers_controller.h" 5 #include "ui/message_center/popup_timers_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "ui/message_center/message_center_style.h" 10 #include "ui/message_center/message_center_style.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 void PopupTimersController::OnNotificationDisplayed( 89 void PopupTimersController::OnNotificationDisplayed(
90 const std::string& id, 90 const std::string& id,
91 const DisplaySource source) { 91 const DisplaySource source) {
92 OnNotificationUpdated(id); 92 OnNotificationUpdated(id);
93 } 93 }
94 94
95 void PopupTimersController::OnNotificationUpdated(const std::string& id) { 95 void PopupTimersController::OnNotificationUpdated(const std::string& id) {
96 NotificationList::PopupNotifications popup_notifications = 96 NotificationList::PopupNotifications popup_notifications =
97 message_center_->GetPopupNotifications(); 97 message_center_->GetPopupNotifications();
98 98
99 if (!popup_notifications.size()) { 99 if (popup_notifications.empty()) {
100 CancelAll(); 100 CancelAll();
101 return; 101 return;
102 } 102 }
103 103
104 NotificationList::PopupNotifications::const_iterator iter = 104 NotificationList::PopupNotifications::const_iterator iter =
105 popup_notifications.begin(); 105 popup_notifications.begin();
106 for (; iter != popup_notifications.end(); ++iter) { 106 for (; iter != popup_notifications.end(); ++iter) {
107 if ((*iter)->id() == id) 107 if ((*iter)->id() == id)
108 break; 108 break;
109 } 109 }
110 110
111 if (iter == popup_notifications.end() || (*iter)->never_timeout()) { 111 if (iter == popup_notifications.end() || (*iter)->never_timeout()) {
112 CancelTimer(id); 112 CancelTimer(id);
113 return; 113 return;
114 } 114 }
115 115
116 // Start the timer if not yet. 116 // Start the timer if not yet.
117 if (popup_timers_.find(id) == popup_timers_.end()) 117 if (popup_timers_.find(id) == popup_timers_.end())
118 StartTimer(id, GetTimeoutForNotification(*iter)); 118 StartTimer(id, GetTimeoutForNotification(*iter));
119 } 119 }
120 120
121 void PopupTimersController::OnNotificationRemoved(const std::string& id, 121 void PopupTimersController::OnNotificationRemoved(const std::string& id,
122 bool by_user) { 122 bool by_user) {
123 CancelTimer(id); 123 CancelTimer(id);
124 } 124 }
125 125
126 } // namespace message_center 126 } // namespace message_center
OLDNEW
« no previous file with comments | « ui/message_center/notification_list_unittest.cc ('k') | ui/message_center/views/notification_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698