Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/native_notification_display_service.h" | 5 #include "chrome/browser/notifications/native_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 "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/extensions/api/notifications/extension_notification_han dler.h" | |
|
Miguel Garcia
2017/02/21 10:56:44
yeah I can see how this include is not great...
A
Peter Beverloo
2017/02/21 17:23:50
Sure. Fixed for now.
| |
| 10 #include "chrome/browser/notifications/non_persistent_notification_handler.h" | 11 #include "chrome/browser/notifications/non_persistent_notification_handler.h" |
| 11 #include "chrome/browser/notifications/notification.h" | 12 #include "chrome/browser/notifications/notification.h" |
| 12 #include "chrome/browser/notifications/notification_delegate.h" | 13 #include "chrome/browser/notifications/notification_delegate.h" |
| 13 #include "chrome/browser/notifications/notification_handler.h" | 14 #include "chrome/browser/notifications/notification_handler.h" |
| 14 #include "chrome/browser/notifications/notification_platform_bridge.h" | 15 #include "chrome/browser/notifications/notification_platform_bridge.h" |
| 15 #include "chrome/browser/notifications/persistent_notification_handler.h" | 16 #include "chrome/browser/notifications/persistent_notification_handler.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 33 Profile* profile, | 34 Profile* profile, |
| 34 NotificationPlatformBridge* notification_bridge) | 35 NotificationPlatformBridge* notification_bridge) |
| 35 : profile_(profile), notification_bridge_(notification_bridge) { | 36 : profile_(profile), notification_bridge_(notification_bridge) { |
| 36 DCHECK(profile_); | 37 DCHECK(profile_); |
| 37 DCHECK(notification_bridge_); | 38 DCHECK(notification_bridge_); |
| 38 | 39 |
| 39 AddNotificationHandler(NotificationCommon::NON_PERSISTENT, | 40 AddNotificationHandler(NotificationCommon::NON_PERSISTENT, |
| 40 base::MakeUnique<NonPersistentNotificationHandler>()); | 41 base::MakeUnique<NonPersistentNotificationHandler>()); |
| 41 AddNotificationHandler(NotificationCommon::PERSISTENT, | 42 AddNotificationHandler(NotificationCommon::PERSISTENT, |
| 42 base::MakeUnique<PersistentNotificationHandler>()); | 43 base::MakeUnique<PersistentNotificationHandler>()); |
| 44 AddNotificationHandler(NotificationCommon::EXTENSION, | |
| 45 base::MakeUnique<ExtensionNotificationHandler>()); | |
| 43 } | 46 } |
| 44 | 47 |
| 45 NativeNotificationDisplayService::~NativeNotificationDisplayService() {} | 48 NativeNotificationDisplayService::~NativeNotificationDisplayService() {} |
| 46 | 49 |
| 47 void NativeNotificationDisplayService::Display( | 50 void NativeNotificationDisplayService::Display( |
| 48 NotificationCommon::Type notification_type, | 51 NotificationCommon::Type notification_type, |
| 49 const std::string& notification_id, | 52 const std::string& notification_id, |
| 50 const Notification& notification) { | 53 const Notification& notification) { |
| 51 notification_bridge_->Display(notification_type, notification_id, | 54 notification_bridge_->Display(notification_type, notification_id, |
| 52 GetProfileId(profile_), | 55 GetProfileId(profile_), |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 notification_handlers_.erase(notification_type); | 113 notification_handlers_.erase(notification_type); |
| 111 } | 114 } |
| 112 | 115 |
| 113 NotificationHandler* NativeNotificationDisplayService::GetNotificationHandler( | 116 NotificationHandler* NativeNotificationDisplayService::GetNotificationHandler( |
| 114 NotificationCommon::Type notification_type) { | 117 NotificationCommon::Type notification_type) { |
| 115 DCHECK(notification_handlers_.find(notification_type) != | 118 DCHECK(notification_handlers_.find(notification_type) != |
| 116 notification_handlers_.end()) | 119 notification_handlers_.end()) |
| 117 << notification_type << " is not registered."; | 120 << notification_type << " is not registered."; |
| 118 return notification_handlers_[notification_type].get(); | 121 return notification_handlers_[notification_type].get(); |
| 119 } | 122 } |
| OLD | NEW |