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

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

Issue 149433005: Adds a small icon to notifications, and connects it to synced notifications. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add testing. Created 6 years, 10 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
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 <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 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 updated = notification_list_->SetNotificationButtonIcon( 743 updated = notification_list_->SetNotificationButtonIcon(
744 notification_id, button_index, image); 744 notification_id, button_index, image);
745 } 745 }
746 746
747 if (updated) { 747 if (updated) {
748 FOR_EACH_OBSERVER(MessageCenterObserver, observer_list_, 748 FOR_EACH_OBSERVER(MessageCenterObserver, observer_list_,
749 OnNotificationUpdated(notification_id)); 749 OnNotificationUpdated(notification_id));
750 } 750 }
751 } 751 }
752 752
753 void MessageCenterImpl::SetNotificationSmallImage(
754 const std::string& notification_id,
755 const gfx::Image& image) {
756 bool updated = false;
757 Notification* queue_notification =
758 notification_queue_->GetLatestNotification(notification_id);
759
760 if (queue_notification) {
761 queue_notification->set_small_image(image);
762 updated = true;
763 } else {
764 updated =
765 notification_list_->SetNotificationSmallImage(notification_id, image);
766 }
767
768 if (updated) {
769 FOR_EACH_OBSERVER(MessageCenterObserver,
770 observer_list_,
771 OnNotificationUpdated(notification_id));
772 }
773 }
774
753 void MessageCenterImpl::DisableNotificationsByNotifier( 775 void MessageCenterImpl::DisableNotificationsByNotifier(
754 const NotifierId& notifier_id) { 776 const NotifierId& notifier_id) {
755 if (settings_provider_) { 777 if (settings_provider_) {
756 // TODO(mukai): SetNotifierEnabled can just accept notifier_id? 778 // TODO(mukai): SetNotifierEnabled can just accept notifier_id?
757 Notifier notifier(notifier_id, base::string16(), true); 779 Notifier notifier(notifier_id, base::string16(), true);
758 settings_provider_->SetNotifierEnabled(notifier, false); 780 settings_provider_->SetNotifierEnabled(notifier, false);
759 } 781 }
760 782
761 NotificationList::Notifications notifications = 783 NotificationList::Notifications notifications =
762 notification_list_->GetNotificationsByNotifierId(notifier_id); 784 notification_list_->GetNotificationsByNotifierId(notifier_id);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 void MessageCenterImpl::PausePopupTimers() { 902 void MessageCenterImpl::PausePopupTimers() {
881 if (popup_timers_controller_.get()) 903 if (popup_timers_controller_.get())
882 popup_timers_controller_->PauseAll(); 904 popup_timers_controller_->PauseAll();
883 } 905 }
884 906
885 void MessageCenterImpl::DisableTimersForTest() { 907 void MessageCenterImpl::DisableTimersForTest() {
886 popup_timers_controller_.reset(); 908 popup_timers_controller_.reset();
887 } 909 }
888 910
889 } // namespace message_center 911 } // namespace message_center
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698