1 // Copyright 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "ui/message_center/notification_blocker.h" 6 7 #include "ui/message_center/message_center.h" 8 9 namespace message_center { 10 NotificationBlocker(MessageCenter * message_center)11NotificationBlocker::NotificationBlocker(MessageCenter* message_center) 12 : message_center_(message_center) { 13 if (message_center_) 14 message_center_->AddNotificationBlocker(this); 15 } 16 ~NotificationBlocker()17NotificationBlocker::~NotificationBlocker() { 18 if (message_center_) 19 message_center_->RemoveNotificationBlocker(this); 20 } 21 AddObserver(NotificationBlocker::Observer * observer)22void NotificationBlocker::AddObserver(NotificationBlocker::Observer* observer) { 23 observers_.AddObserver(observer); 24 } 25 RemoveObserver(NotificationBlocker::Observer * observer)26void NotificationBlocker::RemoveObserver( 27 NotificationBlocker::Observer* observer) { 28 observers_.RemoveObserver(observer); 29 } 30 ShouldShowNotification(const Notification & notification) const31bool NotificationBlocker::ShouldShowNotification( 32 const Notification& notification) const { 33 return true; 34 } 35 NotifyBlockingStateChanged()36void NotificationBlocker::NotifyBlockingStateChanged() { 37 for (auto& observer : observers_) 38 observer.OnBlockingStateChanged(this); 39 } 40 41 } // namespace message_center 42