| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/notification_display_service.h" | 5 #include "chrome/browser/notifications/notification_display_service.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/strings/nullable_string16.h" | 8 #include "base/strings/nullable_string16.h" |
| 9 #include "chrome/browser/notifications/non_persistent_notification_handler.h" | 9 #include "chrome/browser/notifications/non_persistent_notification_handler.h" |
| 10 #include "chrome/browser/notifications/notification_common.h" | 10 #include "chrome/browser/notifications/notification_common.h" |
| 11 #include "chrome/browser/notifications/persistent_notification_handler.h" | 11 #include "chrome/browser/notifications/persistent_notification_handler.h" |
| 12 #include "extensions/features/features.h" | 12 #include "extensions/features/features.h" |
| 13 #include "url/gurl.h" | |
| 14 | 13 |
| 15 #if BUILDFLAG(ENABLE_EXTENSIONS) | 14 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 16 #include "chrome/browser/extensions/api/notifications/extension_notification_han
dler.h" | 15 #include "chrome/browser/extensions/api/notifications/extension_notification_han
dler.h" |
| 17 #endif | 16 #endif |
| 18 | 17 |
| 19 NotificationDisplayService::NotificationDisplayService(Profile* profile) | 18 NotificationDisplayService::NotificationDisplayService(Profile* profile) |
| 20 : profile_(profile) { | 19 : profile_(profile) { |
| 21 AddNotificationHandler(NotificationCommon::NON_PERSISTENT, | 20 AddNotificationHandler(NotificationCommon::NON_PERSISTENT, |
| 22 base::MakeUnique<NonPersistentNotificationHandler>()); | 21 base::MakeUnique<NonPersistentNotificationHandler>()); |
| 23 AddNotificationHandler(NotificationCommon::PERSISTENT, | 22 AddNotificationHandler(NotificationCommon::PERSISTENT, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 handler->OnClick(profile_, origin, notification_id, action_index, reply); | 64 handler->OnClick(profile_, origin, notification_id, action_index, reply); |
| 66 break; | 65 break; |
| 67 case NotificationCommon::CLOSE: | 66 case NotificationCommon::CLOSE: |
| 68 handler->OnClose(profile_, origin, notification_id, true /* by_user */); | 67 handler->OnClose(profile_, origin, notification_id, true /* by_user */); |
| 69 break; | 68 break; |
| 70 case NotificationCommon::SETTINGS: | 69 case NotificationCommon::SETTINGS: |
| 71 handler->OpenSettings(profile_); | 70 handler->OpenSettings(profile_); |
| 72 break; | 71 break; |
| 73 } | 72 } |
| 74 } | 73 } |
| 75 | |
| 76 bool NotificationDisplayService::ShouldDisplayOverFullscreen( | |
| 77 const GURL& origin, | |
| 78 NotificationCommon::Type notification_type) { | |
| 79 NotificationHandler* handler = GetNotificationHandler(notification_type); | |
| 80 DCHECK(handler); | |
| 81 return handler->ShouldDisplayOnFullScreen(profile_, origin.spec()); | |
| 82 } | |
| OLD | NEW |