1 // Copyright 2014 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.
5 #ifndef CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_NOTIFICATION_BLOCKER_CHROMEOS_H_
6 #define CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_NOTIFICATION_BLOCKER_CHROMEOS_H_
12 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
13 #include "ui/message_center/notification_blocker.h"
15 // A notification blocker for per-profile stream switching. Owned and controlled
16 // by MultiUserWindowManagerChromeOS.
17 class MultiUserNotificationBlockerChromeOS
18 : public message_center::NotificationBlocker
,
19 public chrome::MultiUserWindowManager::Observer
{
21 MultiUserNotificationBlockerChromeOS(
22 message_center::MessageCenter
* message_center
,
23 chrome::MultiUserWindowManager
* multi_user_window_manager
,
24 const std::string
& initial_user_id
);
25 virtual ~MultiUserNotificationBlockerChromeOS();
27 // Called by MultiUserWindowManager when the active user has changed.
28 void ActiveUserChanged(const std::string
& user_id
);
30 // message_center::NotificationBlocker overrides:
31 virtual bool ShouldShowNotification(
32 const message_center::NotifierId
& notifier_id
) const OVERRIDE
;
33 virtual bool ShouldShowNotificationAsPopup(
34 const message_center::NotifierId
& notifier_id
) const OVERRIDE
;
36 // chrome::MultiUserWindowManager::Observer overrides:
37 virtual void OnOwnerEntryAdded(aura::Window
* window
) OVERRIDE
;
38 virtual void OnOwnerEntryChanged(aura::Window
* window
) OVERRIDE
;
39 virtual void OnOwnerEntryRemoved(aura::Window
* window
) OVERRIDE
;
42 // Returns true if this blocker is actively working.
43 bool IsActive() const;
45 // Checks the current desktop and update the list of users which owns windows
46 // on the current desktop.
47 void UpdateWindowOwners();
49 chrome::MultiUserWindowManager
* multi_user_window_manager_
; // Weak.
50 std::string active_user_id_
;
51 std::map
<std::string
, bool> quiet_modes_
;
52 std::set
<std::string
> current_user_ids_
;
54 DISALLOW_COPY_AND_ASSIGN(MultiUserNotificationBlockerChromeOS
);
57 #endif // CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_NOTIFICATION_BLOCKER_CHROMEOS_H_