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

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

Issue 11778012: Changes the OnClick behavior in message center. (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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/notification_list.h" 5 #include "ui/message_center/notification_list.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 } 254 }
255 } 255 }
256 256
257 void NotificationList::MarkPopupsAsShown(int priority) { 257 void NotificationList::MarkPopupsAsShown(int priority) {
258 Notifications::iterator first, last; 258 Notifications::iterator first, last;
259 GetPopupIterators(priority, first, last); 259 GetPopupIterators(priority, first, last);
260 for (Notifications::iterator iter = first; iter != last; ++iter) 260 for (Notifications::iterator iter = first; iter != last; ++iter)
261 iter->shown_as_popup = true; 261 iter->shown_as_popup = true;
262 } 262 }
263 263
264 void NotificationList::MarkSinglePopupAsShown(const std::string& id) {
265 Notifications::iterator iter;
266 if (!GetNotification(id, &iter))
267 return;
268
269 if (iter->shown_as_popup)
270 return;
271
272 // Moves the item to the beginning of the already-shown items.
273 Notification notification = *iter;
274 notification.shown_as_popup = true;
275 notifications_[notification.priority].erase(iter);
276 for (Notifications::iterator iter2 =
277 notifications_[notification.priority].begin();
278 iter2 != notifications_[notification.priority].end(); iter2++) {
279 if (iter2->shown_as_popup) {
280 notifications_[notification.priority].insert(iter2, notification);
281 return;
282 }
283 }
284
285 // No notifications are already shown as popup, so just re-adding at the end
286 // of the list.
287 notifications_[notification.priority].push_back(notification);
288 }
289
264 void NotificationList::SetQuietMode(bool quiet_mode) { 290 void NotificationList::SetQuietMode(bool quiet_mode) {
265 SetQuietModeInternal(quiet_mode); 291 SetQuietModeInternal(quiet_mode);
266 quiet_mode_timer_.reset(); 292 quiet_mode_timer_.reset();
267 } 293 }
268 294
269 void NotificationList::EnterQuietModeWithExpire( 295 void NotificationList::EnterQuietModeWithExpire(
270 const base::TimeDelta& expires_in) { 296 const base::TimeDelta& expires_in) {
271 if (quiet_mode_timer_.get()) { 297 if (quiet_mode_timer_.get()) {
272 // Note that the capital Reset() is the method to restart the timer, not 298 // Note that the capital Reset() is the method to restart the timer, not
273 // scoped_ptr::reset(). 299 // scoped_ptr::reset().
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 popup_count++; 413 popup_count++;
388 // No limits for HIGH/MAX priority. 414 // No limits for HIGH/MAX priority.
389 if (priority == ui::notifications::DEFAULT_PRIORITY && 415 if (priority == ui::notifications::DEFAULT_PRIORITY &&
390 popup_count >= kMaxVisiblePopupNotifications) { 416 popup_count >= kMaxVisiblePopupNotifications) {
391 break; 417 break;
392 } 418 }
393 } 419 }
394 } 420 }
395 421
396 } // namespace message_center 422 } // namespace message_center
OLDNEW
« 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