Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2161)

Unified Diff: chrome/browser/notifications/multi_user_notification_blocker_chromeos.cc

Issue 127423002: Supports window teleports for notifications. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix wallpaper private api test Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/notifications/multi_user_notification_blocker_chromeos.cc
diff --git a/chrome/browser/notifications/multi_user_notification_blocker_chromeos.cc b/chrome/browser/notifications/multi_user_notification_blocker_chromeos.cc
deleted file mode 100644
index 1d064776bb6d4eef4a8b6461658ab8657e15bd30..0000000000000000000000000000000000000000
--- a/chrome/browser/notifications/multi_user_notification_blocker_chromeos.cc
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/notifications/multi_user_notification_blocker_chromeos.h"
-
-#include "ash/shell.h"
-#include "ash/system/system_notifier.h"
-#include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
-#include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
-#include "ui/message_center/message_center.h"
-#include "ui/message_center/notifier_settings.h"
-
-MultiUserNotificationBlockerChromeOS::MultiUserNotificationBlockerChromeOS(
- message_center::MessageCenter* message_center)
- : NotificationBlocker(message_center),
- observing_(false) {
- // UserManager may not be initialized in unit tests.
- if (!chromeos::UserManager::IsInitialized())
- return;
-
- // This class is created in the ctor of NotificationUIManager which is created
- // when a notification is created, so ash::Shell should be initialized.
- ash::Shell::GetInstance()->AddShellObserver(this);
- chromeos::UserManager::Get()->AddSessionStateObserver(this);
- observing_ = true;
-}
-
-MultiUserNotificationBlockerChromeOS::~MultiUserNotificationBlockerChromeOS() {
- if (observing_) {
- if (ash::Shell::HasInstance())
- ash::Shell::GetInstance()->RemoveShellObserver(this);
- chromeos::UserManager::Get()->RemoveSessionStateObserver(this);
- }
-}
-
-bool MultiUserNotificationBlockerChromeOS::ShouldShowNotification(
- const message_center::NotifierId& notifier_id) const {
- if (!IsActive())
- return true;
-
- if (ash::system_notifier::IsAshSystemNotifier(notifier_id))
- return true;
-
- return notifier_id.profile_id == active_user_id_;
-}
-
-bool MultiUserNotificationBlockerChromeOS::ShouldShowNotificationAsPopup(
- const message_center::NotifierId& notifier_id) const {
- return ShouldShowNotification(notifier_id);
-}
-
-void MultiUserNotificationBlockerChromeOS::OnAppTerminating() {
- ash::Shell::GetInstance()->RemoveShellObserver(this);
- chromeos::UserManager::Get()->RemoveSessionStateObserver(this);
- observing_ = false;
-}
-
-void MultiUserNotificationBlockerChromeOS::ActiveUserChanged(
- const chromeos::User* active_user) {
- const std::string& new_user_id = active_user->email();
- if (active_user_id_ == new_user_id)
- return;
-
- quiet_modes_[active_user_id_] = message_center()->IsQuietMode();
- active_user_id_ = active_user->email();
- std::map<std::string, bool>::const_iterator iter =
- quiet_modes_.find(active_user_id_);
- if (iter != quiet_modes_.end() &&
- iter->second != message_center()->IsQuietMode()) {
- message_center()->SetQuietMode(iter->second);
- }
- NotifyBlockingStateChanged();
-}
-
-bool MultiUserNotificationBlockerChromeOS::IsActive() const {
- return observing_ && chrome::MultiUserWindowManager::GetMultiProfileMode() ==
- chrome::MultiUserWindowManager::MULTI_PROFILE_MODE_SEPARATED;
-}

Powered by Google App Engine
This is Rietveld 408576698