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

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

Issue 22724002: Invokes NotificationDelegate::Close in message center. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 | « chrome/browser/notifications/message_center_notification_manager.cc ('k') | no next file » | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/message_center_impl.h" 5 #include "ui/message_center/message_center_impl.h"
6 6
7 #include "base/observer_list.h" 7 #include "base/observer_list.h"
8 #include "ui/message_center/message_center_style.h" 8 #include "ui/message_center/message_center_style.h"
9 #include "ui/message_center/notification.h" 9 #include "ui/message_center/notification.h"
10 #include "ui/message_center/notification_list.h" 10 #include "ui/message_center/notification_list.h"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 FOR_EACH_OBSERVER(MessageCenterObserver, observer_list_, 306 FOR_EACH_OBSERVER(MessageCenterObserver, observer_list_,
307 OnNotificationAdded(new_id)); 307 OnNotificationAdded(new_id));
308 } 308 }
309 } 309 }
310 310
311 void MessageCenterImpl::RemoveNotification(const std::string& id, 311 void MessageCenterImpl::RemoveNotification(const std::string& id,
312 bool by_user) { 312 bool by_user) {
313 if (!HasNotification(id)) 313 if (!HasNotification(id))
314 return; 314 return;
315 315
316 NotificationDelegate* delegate =
317 notification_list_->GetNotificationDelegate(id);
318 if (delegate)
319 delegate->Close(by_user);
320
316 // In many cases |id| is a reference to an existing notification instance 321 // In many cases |id| is a reference to an existing notification instance
317 // but the instance can be destructed in RemoveNotification(). Hence 322 // but the instance can be destructed in RemoveNotification(). Hence
318 // copies the id explicitly here. 323 // copies the id explicitly here.
319 std::string copied_id(id); 324 std::string copied_id(id);
320 notification_list_->RemoveNotification(copied_id); 325 notification_list_->RemoveNotification(copied_id);
321 FOR_EACH_OBSERVER(MessageCenterObserver, 326 FOR_EACH_OBSERVER(MessageCenterObserver,
322 observer_list_, 327 observer_list_,
323 OnNotificationRemoved(copied_id, by_user)); 328 OnNotificationRemoved(copied_id, by_user));
324 } 329 }
325 330
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 void MessageCenterImpl::PausePopupTimers() { 493 void MessageCenterImpl::PausePopupTimers() {
489 if (popup_timers_controller_.get()) 494 if (popup_timers_controller_.get())
490 popup_timers_controller_->PauseAll(); 495 popup_timers_controller_->PauseAll();
491 } 496 }
492 497
493 void MessageCenterImpl::DisableTimersForTest() { 498 void MessageCenterImpl::DisableTimersForTest() {
494 popup_timers_controller_.reset(); 499 popup_timers_controller_.reset();
495 } 500 }
496 501
497 } // namespace message_center 502 } // namespace message_center
OLDNEW
« no previous file with comments | « chrome/browser/notifications/message_center_notification_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698