blob: f823bc9e69e6ca64517645567276bc7a9f2c4a14 [file] [log] [blame]
Avi Drissman3e1a26c2022-09-15 20:26:031// Copyright 2013 The Chromium Authors
[email protected]b78d79a52013-09-12 01:52:212// 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
David Sandersde5fee542022-03-23 02:47:447#include "base/observer_list.h"
[email protected]b78d79a52013-09-12 01:52:218#include "ui/message_center/message_center.h"
9
10namespace message_center {
11
12NotificationBlocker::NotificationBlocker(MessageCenter* message_center)
13 : message_center_(message_center) {
14 if (message_center_)
15 message_center_->AddNotificationBlocker(this);
16}
17
18NotificationBlocker::~NotificationBlocker() {
19 if (message_center_)
20 message_center_->RemoveNotificationBlocker(this);
21}
22
23void NotificationBlocker::AddObserver(NotificationBlocker::Observer* observer) {
24 observers_.AddObserver(observer);
25}
26
27void NotificationBlocker::RemoveObserver(
28 NotificationBlocker::Observer* observer) {
29 observers_.RemoveObserver(observer);
30}
31
[email protected]33aa554d2013-12-06 00:47:5332bool NotificationBlocker::ShouldShowNotification(
bmalcolmb34f4992016-08-03 19:42:0033 const Notification& notification) const {
[email protected]33aa554d2013-12-06 00:47:5334 return true;
35}
36
37void NotificationBlocker::NotifyBlockingStateChanged() {
ericwilligersdfd9e462016-10-17 19:38:1738 for (auto& observer : observers_)
39 observer.OnBlockingStateChanged(this);
[email protected]33aa554d2013-12-06 00:47:5340}
41
[email protected]b78d79a52013-09-12 01:52:2142} // namespace message_center