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

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

Issue 19027005: Hide notifications popups when entering fullscreen mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix remaining testing issues Created 7 years, 4 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/message_center_notification_manager.cc
diff --git a/chrome/browser/notifications/message_center_notification_manager.cc b/chrome/browser/notifications/message_center_notification_manager.cc
index 0ccc840349e62c074467db65c6b3742d740a4368..b249f49c0085da50a4f136be7dc54ce994e28274 100644
--- a/chrome/browser/notifications/message_center_notification_manager.cc
+++ b/chrome/browser/notifications/message_center_notification_manager.cc
@@ -7,6 +7,7 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/prefs/pref_service.h"
+#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/extension_info_map.h"
#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/notifications/desktop_notification_service.h"
@@ -19,6 +20,8 @@
#include "chrome/browser/ui/host_desktop.h"
#include "chrome/common/extensions/extension_set.h"
#include "chrome/common/pref_names.h"
+#include "content/public/browser/notification_service.h"
+#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/url_constants.h"
#include "ui/message_center/message_center_style.h"
@@ -55,6 +58,9 @@ MessageCenterNotificationManager::MessageCenterNotificationManager(
// views.Other platforms have global ownership and Create will return NULL.
tray_.reset(message_center::CreateMessageCenterTray());
#endif
+ registrar_.Add(this,
+ chrome::NOTIFICATION_FULLSCREEN_CHANGED,
+ content::NotificationService::AllSources());
}
MessageCenterNotificationManager::~MessageCenterNotificationManager() {
@@ -328,6 +334,20 @@ void MessageCenterNotificationManager::SetMessageCenterTrayDelegateForTest(
tray_.reset(delegate);
}
+void MessageCenterNotificationManager::Observe(
+ int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) {
+ if (type == chrome::NOTIFICATION_FULLSCREEN_CHANGED) {
+ const bool is_fullscreen = *content::Details<bool>(details).ptr();
+
+ if (is_fullscreen && tray_.get() && tray_->GetMessageCenterTray())
+ tray_->GetMessageCenterTray()->HidePopupBubble();
+ } else {
+ NotificationUIManagerImpl::Observe(type, source, details);
+ }
+}
+
////////////////////////////////////////////////////////////////////////////////
// ImageDownloads

Powered by Google App Engine
This is Rietveld 408576698