OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_NOTIFICATIONS_MULTI_USER_NOTIFICATION_BLOCKER_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_NOTIFICATION_BLOCKER_CHROMEO S_H_ |
6 #define CHROME_BROWSER_NOTIFICATIONS_MULTI_USER_NOTIFICATION_BLOCKER_CHROMEOS_H_ | 6 #define CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_NOTIFICATION_BLOCKER_CHROMEO S_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | |
9 #include <string> | 10 #include <string> |
10 | 11 |
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" | 12 #include "ui/message_center/notification_blocker.h" |
15 | 13 |
16 // A notification blocker for per-profile stream switching. | 14 // A notification blocker for per-profile stream switching. Owned and controlled |
15 // by MultiUserWindowManagerChromeOS. | |
17 class MultiUserNotificationBlockerChromeOS | 16 class MultiUserNotificationBlockerChromeOS |
18 : public message_center::NotificationBlocker, | 17 : public message_center::NotificationBlocker { |
19 public ash::ShellObserver, | |
20 public chromeos::UserManager::UserSessionStateObserver { | |
21 public: | 18 public: |
22 explicit MultiUserNotificationBlockerChromeOS( | 19 explicit MultiUserNotificationBlockerChromeOS( |
23 message_center::MessageCenter* message_center); | 20 message_center::MessageCenter* message_center); |
24 virtual ~MultiUserNotificationBlockerChromeOS(); | 21 virtual ~MultiUserNotificationBlockerChromeOS(); |
25 | 22 |
23 // Checks the current desktop and update the list of users which owns windows | |
24 // on the current desktop. | |
25 void UpdateWindowOwners(); | |
26 | |
27 // Called by MultiUserWindowManager when the the active user has changed. | |
Mr4D (OOO till 08-26)
2014/01/08 17:29:35
nit: .. when the active ..
Jun Mukai
2014/01/08 20:41:24
Done.
| |
28 void ActiveUserChanged(const std::string& user_id); | |
29 | |
26 // message_center::NotificationBlocker overrides: | 30 // message_center::NotificationBlocker overrides: |
27 virtual bool ShouldShowNotification( | 31 virtual bool ShouldShowNotification( |
28 const message_center::NotifierId& notifier_id) const OVERRIDE; | 32 const message_center::NotifierId& notifier_id) const OVERRIDE; |
29 virtual bool ShouldShowNotificationAsPopup( | 33 virtual bool ShouldShowNotificationAsPopup( |
30 const message_center::NotifierId& notifier_id) const OVERRIDE; | 34 const message_center::NotifierId& notifier_id) const OVERRIDE; |
31 | 35 |
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: | 36 private: |
39 // Returns true if this blocker is actively working. | 37 // Returns true if this blocker is actively working. |
40 bool IsActive() const; | 38 bool IsActive() const; |
41 | 39 |
42 std::string active_user_id_; | 40 std::string active_user_id_; |
43 bool observing_; | |
44 std::map<std::string, bool> quiet_modes_; | 41 std::map<std::string, bool> quiet_modes_; |
42 std::set<std::string> current_user_ids_; | |
45 | 43 |
46 DISALLOW_COPY_AND_ASSIGN(MultiUserNotificationBlockerChromeOS); | 44 DISALLOW_COPY_AND_ASSIGN(MultiUserNotificationBlockerChromeOS); |
47 }; | 45 }; |
48 | 46 |
49 #endif // CHROME_BROWSER_NOTIFICATIONS_MULTI_USER_NOTIFICATION_BLOCKER_CHROMEOS _H_ | 47 #endif // CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_NOTIFICATION_BLOCKER_CHRO MEOS_H_ |
OLD | NEW |