| 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 #include "chrome/browser/notifications/fullscreen_notification_blocker.h" | 5 #include "chrome/browser/notifications/fullscreen_notification_blocker.h" |
| 6 | 6 |
| 7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/fullscreen.h" | 9 #include "chrome/browser/fullscreen.h" |
| 10 #include "content/public/browser/notification_service.h" | 10 #include "content/public/browser/notification_service.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 59 } |
| 60 | 60 |
| 61 void FullscreenNotificationBlocker::CheckState() { | 61 void FullscreenNotificationBlocker::CheckState() { |
| 62 bool was_fullscreen_mode = is_fullscreen_mode_; | 62 bool was_fullscreen_mode = is_fullscreen_mode_; |
| 63 is_fullscreen_mode_ = DoesFullscreenModeBlockNotifications(); | 63 is_fullscreen_mode_ = DoesFullscreenModeBlockNotifications(); |
| 64 if (is_fullscreen_mode_ != was_fullscreen_mode) | 64 if (is_fullscreen_mode_ != was_fullscreen_mode) |
| 65 NotifyBlockingStateChanged(); | 65 NotifyBlockingStateChanged(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 bool FullscreenNotificationBlocker::ShouldShowNotificationAsPopup( | 68 bool FullscreenNotificationBlocker::ShouldShowNotificationAsPopup( |
| 69 const message_center::NotifierId& notifier_id) const { | 69 const message_center::Notification& notification) const { |
| 70 bool enabled = !is_fullscreen_mode_; | 70 bool enabled = !is_fullscreen_mode_; |
| 71 #if defined(USE_ASH) | 71 #if defined(USE_ASH) |
| 72 if (ash::Shell::HasInstance()) | 72 if (ash::Shell::HasInstance()) |
| 73 enabled = enabled || ash::system_notifier::ShouldAlwaysShowPopups( | 73 enabled = enabled || ash::system_notifier::ShouldAlwaysShowPopups( |
| 74 notifier_id); | 74 notification.notifier_id()); |
| 75 #endif | 75 #endif |
| 76 | 76 |
| 77 return enabled; | 77 return enabled; |
| 78 } | 78 } |
| 79 | 79 |
| 80 void FullscreenNotificationBlocker::Observe( | 80 void FullscreenNotificationBlocker::Observe( |
| 81 int type, | 81 int type, |
| 82 const content::NotificationSource& source, | 82 const content::NotificationSource& source, |
| 83 const content::NotificationDetails& details) { | 83 const content::NotificationDetails& details) { |
| 84 DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type); | 84 DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type); |
| 85 CheckState(); | 85 CheckState(); |
| 86 } | 86 } |
| OLD | NEW |