Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / ash / multi_user / multi_user_notification_blocker_chromeos.cc
index 82f205a..55c62fa 100644 (file)
 
 MultiUserNotificationBlockerChromeOS::MultiUserNotificationBlockerChromeOS(
     message_center::MessageCenter* message_center,
-    chrome::MultiUserWindowManager* multi_user_window_manager)
+    chrome::MultiUserWindowManager* multi_user_window_manager,
+    const std::string& initial_user_id)
     : NotificationBlocker(message_center),
-      multi_user_window_manager_(multi_user_window_manager) {
+      multi_user_window_manager_(multi_user_window_manager),
+      active_user_id_(initial_user_id) {
   UpdateWindowOwners();
+  multi_user_window_manager_->AddObserver(this);
 }
 
 MultiUserNotificationBlockerChromeOS::~MultiUserNotificationBlockerChromeOS() {
+  multi_user_window_manager_->RemoveObserver(this);
 }
 
 void MultiUserNotificationBlockerChromeOS::UpdateWindowOwners() {
@@ -52,6 +56,21 @@ bool MultiUserNotificationBlockerChromeOS::ShouldShowNotificationAsPopup(
       ShouldShowNotification(notifier_id);
 }
 
+void MultiUserNotificationBlockerChromeOS::OnOwnerEntryAdded(
+    aura::Window* window) {
+  UpdateWindowOwners();
+}
+
+void MultiUserNotificationBlockerChromeOS::OnOwnerEntryChanged(
+    aura::Window* window) {
+  UpdateWindowOwners();
+}
+
+void MultiUserNotificationBlockerChromeOS::OnOwnerEntryRemoved(
+    aura::Window* window) {
+  UpdateWindowOwners();
+}
+
 void MultiUserNotificationBlockerChromeOS::ActiveUserChanged(
     const std::string& user_id) {
   if (active_user_id_ == user_id)