OLD | NEW |
| (Empty) |
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 #ifndef CHROME_BROWSER_NOTIFICATIONS_MULTI_USER_NOTIFICATION_BLOCKER_CHROMEOS_H_ | |
6 #define CHROME_BROWSER_NOTIFICATIONS_MULTI_USER_NOTIFICATION_BLOCKER_CHROMEOS_H_ | |
7 | |
8 #include <map> | |
9 #include <string> | |
10 | |
11 #include "ash/shell_observer.h" | |
12 #include "chrome/browser/chromeos/login/user_manager.h" | |
13 #include "chromeos/login/login_state.h" | |
14 #include "ui/message_center/notification_blocker.h" | |
15 | |
16 // A notification blocker for per-profile stream switching. | |
17 class MultiUserNotificationBlockerChromeOS | |
18 : public message_center::NotificationBlocker, | |
19 public ash::ShellObserver, | |
20 public chromeos::UserManager::UserSessionStateObserver { | |
21 public: | |
22 explicit MultiUserNotificationBlockerChromeOS( | |
23 message_center::MessageCenter* message_center); | |
24 virtual ~MultiUserNotificationBlockerChromeOS(); | |
25 | |
26 // message_center::NotificationBlocker overrides: | |
27 virtual bool ShouldShowNotification( | |
28 const message_center::NotifierId& notifier_id) const OVERRIDE; | |
29 virtual bool ShouldShowNotificationAsPopup( | |
30 const message_center::NotifierId& notifier_id) const OVERRIDE; | |
31 | |
32 // ash::ShellObserver overrides: | |
33 virtual void OnAppTerminating() OVERRIDE; | |
34 | |
35 // chromeos::UserManager::UserSessionStateObserver overrides: | |
36 virtual void ActiveUserChanged(const chromeos::User* active_user) OVERRIDE; | |
37 | |
38 private: | |
39 // Returns true if this blocker is actively working. | |
40 bool IsActive() const; | |
41 | |
42 std::string active_user_id_; | |
43 bool observing_; | |
44 std::map<std::string, bool> quiet_modes_; | |
45 | |
46 DISALLOW_COPY_AND_ASSIGN(MultiUserNotificationBlockerChromeOS); | |
47 }; | |
48 | |
49 #endif // CHROME_BROWSER_NOTIFICATIONS_MULTI_USER_NOTIFICATION_BLOCKER_CHROMEOS
_H_ | |
OLD | NEW |