OLD | NEW |
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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 | 347 |
348 void PopupTimersController::TimerFinished(const std::string& id) { | 348 void PopupTimersController::TimerFinished(const std::string& id) { |
349 PopupTimerCollection::iterator iter = popup_timers_.find(id); | 349 PopupTimerCollection::iterator iter = popup_timers_.find(id); |
350 if (iter == popup_timers_.end()) | 350 if (iter == popup_timers_.end()) |
351 return; | 351 return; |
352 | 352 |
353 CancelTimer(id); | 353 CancelTimer(id); |
354 message_center_->MarkSinglePopupAsShown(id, false); | 354 message_center_->MarkSinglePopupAsShown(id, false); |
355 } | 355 } |
356 | 356 |
357 void PopupTimersController::OnNotificationDisplayed(const std::string& id) { | 357 void PopupTimersController::OnNotificationDisplayed( |
| 358 const std::string& id, |
| 359 const DisplaySource source) { |
358 OnNotificationUpdated(id); | 360 OnNotificationUpdated(id); |
359 } | 361 } |
360 | 362 |
361 void PopupTimersController::OnNotificationUpdated(const std::string& id) { | 363 void PopupTimersController::OnNotificationUpdated(const std::string& id) { |
362 NotificationList::PopupNotifications popup_notifications = | 364 NotificationList::PopupNotifications popup_notifications = |
363 message_center_->GetPopupNotifications(); | 365 message_center_->GetPopupNotifications(); |
364 | 366 |
365 if (!popup_notifications.size()) { | 367 if (!popup_notifications.size()) { |
366 CancelAll(); | 368 CancelAll(); |
367 return; | 369 return; |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 void MessageCenterImpl::MarkSinglePopupAsShown(const std::string& id, | 799 void MessageCenterImpl::MarkSinglePopupAsShown(const std::string& id, |
798 bool mark_notification_as_read) { | 800 bool mark_notification_as_read) { |
799 if (!HasNotification(id)) | 801 if (!HasNotification(id)) |
800 return; | 802 return; |
801 notification_list_->MarkSinglePopupAsShown(id, mark_notification_as_read); | 803 notification_list_->MarkSinglePopupAsShown(id, mark_notification_as_read); |
802 notification_cache_.RecountUnread(); | 804 notification_cache_.RecountUnread(); |
803 FOR_EACH_OBSERVER( | 805 FOR_EACH_OBSERVER( |
804 MessageCenterObserver, observer_list_, OnNotificationUpdated(id)); | 806 MessageCenterObserver, observer_list_, OnNotificationUpdated(id)); |
805 } | 807 } |
806 | 808 |
807 void MessageCenterImpl::DisplayedNotification(const std::string& id) { | 809 void MessageCenterImpl::DisplayedNotification( |
| 810 const std::string& id, |
| 811 const DisplaySource source) { |
808 if (!HasNotification(id)) | 812 if (!HasNotification(id)) |
809 return; | 813 return; |
810 | 814 |
811 if (HasPopupNotifications()) | 815 if (HasPopupNotifications()) |
812 notification_list_->MarkSinglePopupAsDisplayed(id); | 816 notification_list_->MarkSinglePopupAsDisplayed(id); |
813 notification_cache_.RecountUnread(); | 817 notification_cache_.RecountUnread(); |
814 scoped_refptr<NotificationDelegate> delegate = | 818 scoped_refptr<NotificationDelegate> delegate = |
815 notification_list_->GetNotificationDelegate(id); | 819 notification_list_->GetNotificationDelegate(id); |
816 if (delegate.get()) | 820 if (delegate.get()) |
817 delegate->Display(); | 821 delegate->Display(); |
818 FOR_EACH_OBSERVER( | 822 FOR_EACH_OBSERVER( |
819 MessageCenterObserver, observer_list_, OnNotificationDisplayed(id)); | 823 MessageCenterObserver, |
| 824 observer_list_, |
| 825 OnNotificationDisplayed(id, source)); |
820 } | 826 } |
821 | 827 |
822 void MessageCenterImpl::SetNotifierSettingsProvider( | 828 void MessageCenterImpl::SetNotifierSettingsProvider( |
823 NotifierSettingsProvider* provider) { | 829 NotifierSettingsProvider* provider) { |
824 settings_provider_ = provider; | 830 settings_provider_ = provider; |
825 } | 831 } |
826 | 832 |
827 NotifierSettingsProvider* MessageCenterImpl::GetNotifierSettingsProvider() { | 833 NotifierSettingsProvider* MessageCenterImpl::GetNotifierSettingsProvider() { |
828 return settings_provider_; | 834 return settings_provider_; |
829 } | 835 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 void MessageCenterImpl::PausePopupTimers() { | 872 void MessageCenterImpl::PausePopupTimers() { |
867 if (popup_timers_controller_.get()) | 873 if (popup_timers_controller_.get()) |
868 popup_timers_controller_->PauseAll(); | 874 popup_timers_controller_->PauseAll(); |
869 } | 875 } |
870 | 876 |
871 void MessageCenterImpl::DisableTimersForTest() { | 877 void MessageCenterImpl::DisableTimersForTest() { |
872 popup_timers_controller_.reset(); | 878 popup_timers_controller_.reset(); |
873 } | 879 } |
874 | 880 |
875 } // namespace message_center | 881 } // namespace message_center |
OLD | NEW |