1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
ash / system / notification_center / inactive_user_notification_blocker.h [blame]
// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_SYSTEM_NOTIFICATION_CENTER_INACTIVE_USER_NOTIFICATION_BLOCKER_H_
#define ASH_SYSTEM_NOTIFICATION_CENTER_INACTIVE_USER_NOTIFICATION_BLOCKER_H_
#include <map>
#include "ash/ash_export.h"
#include "ash/public/cpp/session/session_observer.h"
#include "components/account_id/account_id.h"
#include "ui/message_center/notification_blocker.h"
namespace ash {
// A notification blocker for per-profile stream switching.
class ASH_EXPORT InactiveUserNotificationBlocker
: public message_center::NotificationBlocker,
public SessionObserver {
public:
explicit InactiveUserNotificationBlocker(
message_center::MessageCenter* message_center);
InactiveUserNotificationBlocker(const InactiveUserNotificationBlocker&) =
delete;
InactiveUserNotificationBlocker& operator=(
const InactiveUserNotificationBlocker&) = delete;
~InactiveUserNotificationBlocker() override;
// message_center::NotificationBlocker:
bool ShouldShowNotification(
const message_center::Notification& notification) const override;
bool ShouldShowNotificationAsPopup(
const message_center::Notification& notification) const override;
// SessionObserver:
void OnActiveUserSessionChanged(const AccountId& account_id) override;
private:
AccountId active_account_id_;
std::map<AccountId, bool> quiet_modes_;
ScopedSessionObserver scoped_observer_;
};
} // namespace ash
#endif // ASH_SYSTEM_NOTIFICATION_CENTER_INACTIVE_USER_NOTIFICATION_BLOCKER_H_