blob: 80353e8bdd9be238889d5258a61de32e70489519 [file] [log] [blame]
[email protected]b78d79a52013-09-12 01:52:211// 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
9namespace message_center {
10
11NotificationBlocker::NotificationBlocker(MessageCenter* message_center)
12 : message_center_(message_center) {
13 if (message_center_)
14 message_center_->AddNotificationBlocker(this);
15}
16
17NotificationBlocker::~NotificationBlocker() {
18 if (message_center_)
19 message_center_->RemoveNotificationBlocker(this);
20}
21
22void NotificationBlocker::AddObserver(NotificationBlocker::Observer* observer) {
23 observers_.AddObserver(observer);
24}
25
26void NotificationBlocker::RemoveObserver(
27 NotificationBlocker::Observer* observer) {
28 observers_.RemoveObserver(observer);
29}
30
[email protected]33aa554d2013-12-06 00:47:5331bool NotificationBlocker::ShouldShowNotification(
bmalcolmb34f4992016-08-03 19:42:0032 const Notification& notification) const {
[email protected]33aa554d2013-12-06 00:47:5333 return true;
34}
35
36void NotificationBlocker::NotifyBlockingStateChanged() {
ericwilligersdfd9e462016-10-17 19:38:1737 for (auto& observer : observers_)
38 observer.OnBlockingStateChanged(this);
[email protected]33aa554d2013-12-06 00:47:5339}
40
[email protected]b78d79a52013-09-12 01:52:2141} // namespace message_center