Index: chrome/browser/push_messaging/push_messaging_notification_manager.cc |
diff --git a/chrome/browser/push_messaging/push_messaging_notification_manager.cc b/chrome/browser/push_messaging/push_messaging_notification_manager.cc |
index 0050c182d3af5f8bcd026e17748a867bd2dd648c..77ccbec8350f60e4da893e8a264feb803a2d1398 100644 |
--- a/chrome/browser/push_messaging/push_messaging_notification_manager.cc |
+++ b/chrome/browser/push_messaging/push_messaging_notification_manager.cc |
@@ -171,6 +171,15 @@ void PushMessagingNotificationManager::DidGetNotificationsFromDatabase( |
kPushMessagingForcedNotificationTag) |
continue; |
+ scoped_refptr<PlatformNotificationContext> notification_context = |
+ GetStoragePartition(profile_, origin) |
+ ->GetPlatformNotificationContext(); |
+ |
+ const std::string notification_id = |
+ notification_context->GenerateNotificationId( |
+ origin, kPushMessagingForcedNotificationTag, |
+ notification_database_data.notification_id); |
+ |
PlatformNotificationServiceImpl* platform_notification_service = |
PlatformNotificationServiceImpl::GetInstance(); |
@@ -178,10 +187,10 @@ void PushMessagingNotificationManager::DidGetNotificationsFromDatabase( |
// manually tell the service that the notification has been closed in |
// order to avoid duplicating the thread-jump logic. |
platform_notification_service->ClosePersistentNotification( |
- profile_, notification_database_data.notification_id); |
+ profile_, notification_id); |
platform_notification_service->OnPersistentNotificationClose( |
- profile_, notification_database_data.notification_id, |
- notification_database_data.origin, false /* by_user */); |
+ profile_, notification_id, notification_database_data.origin, |
+ false /* by_user */); |
break; |
} |
@@ -328,13 +337,13 @@ void PushMessagingNotificationManager::DidWriteNotificationDataIOProxy( |
const PlatformNotificationData& notification_data, |
const base::Closure& message_handled_closure, |
bool success, |
- int64_t persistent_notification_id) { |
+ const std::string& notification_id) { |
DCHECK_CURRENTLY_ON(BrowserThread::IO); |
BrowserThread::PostTask( |
BrowserThread::UI, FROM_HERE, |
base::Bind(&PushMessagingNotificationManager::DidWriteNotificationData, |
ui_weak_ptr, origin, notification_data, |
- message_handled_closure, success, persistent_notification_id)); |
+ message_handled_closure, success, notification_id)); |
} |
void PushMessagingNotificationManager::DidWriteNotificationData( |
@@ -342,7 +351,7 @@ void PushMessagingNotificationManager::DidWriteNotificationData( |
const PlatformNotificationData& notification_data, |
const base::Closure& message_handled_closure, |
bool success, |
- int64_t persistent_notification_id) { |
+ const std::string& notification_id) { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
if (!success) { |
DLOG(ERROR) << "Writing forced notification to database should not fail"; |
@@ -355,8 +364,8 @@ void PushMessagingNotificationManager::DidWriteNotificationData( |
// attributed to a WebAPK on Android. This is OK because this code path is hit |
// rarely. |
PlatformNotificationServiceImpl::GetInstance()->DisplayPersistentNotification( |
- profile_, persistent_notification_id, GURL() /* service_worker_scope */, |
- origin, notification_data, NotificationResources()); |
+ profile_, notification_id, GURL() /* service_worker_scope */, origin, |
+ notification_data, NotificationResources()); |
message_handled_closure.Run(); |
} |