diff options
author | peter <peter@chromium.org> | 2014-12-12 09:35:48 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-12 17:36:20 +0000 |
commit | 5eea7412cff596debc210f374211e5c73ba4fdaf (patch) | |
tree | 26ba7977eef0c1e354bb6fc676825a5e8d5b235f /content/child/notifications/notification_manager.cc | |
parent | 20bf4c3c8f6c408cd2214d76e57265d424dae13e (diff) | |
download | chromium_src-5eea7412cff596debc210f374211e5c73ba4fdaf.zip chromium_src-5eea7412cff596debc210f374211e5c73ba4fdaf.tar.gz chromium_src-5eea7412cff596debc210f374211e5c73ba4fdaf.tar.bz2 |
Remove a renderer -> browser roundtrip for resolving the showNotification promise.
We always confirm, so we may as well remove the roundtrip together.
BUG=432527
Review URL: https://codereview.chromium.org/803523002
Cr-Commit-Position: refs/heads/master@{#308111}
Diffstat (limited to 'content/child/notifications/notification_manager.cc')
-rw-r--r-- | content/child/notifications/notification_manager.cc | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/content/child/notifications/notification_manager.cc b/content/child/notifications/notification_manager.cc index 05c3d52..23e40fa 100644 --- a/content/child/notifications/notification_manager.cc +++ b/content/child/notifications/notification_manager.cc @@ -173,8 +173,6 @@ WebNotificationPermission NotificationManager::checkPermission( bool NotificationManager::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(NotificationManager, message) - IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidShowPersistent, - OnDidShowPersistent) IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidShow, OnDidShow); IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidClose, OnDidClose); IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidClick, OnDidClick); @@ -184,18 +182,6 @@ bool NotificationManager::OnMessageReceived(const IPC::Message& message) { return handled; } -void NotificationManager::OnDidShowPersistent(int request_id) { - blink::WebNotificationShowCallbacks* callbacks = - persistent_notification_requests_.Lookup(request_id); - DCHECK(callbacks); - - // There currently isn't a case in which the promise would be rejected per - // our implementation, so always resolve it here. - callbacks->onSuccess(); - - persistent_notification_requests_.Remove(request_id); -} - void NotificationManager::OnDidShow(int notification_id) { const auto& iter = active_notifications_.find(notification_id); if (iter == active_notifications_.end()) @@ -268,6 +254,10 @@ void NotificationManager::DisplayPersistentNotification( int64 service_worker_registration_id, int request_id, scoped_refptr<NotificationImageLoader> image_loader) { + blink::WebNotificationShowCallbacks* callbacks = + persistent_notification_requests_.Lookup(request_id); + DCHECK(callbacks); + SkBitmap icon; if (image_loader) { pending_persistent_notifications_.erase(image_loader); @@ -276,11 +266,16 @@ void NotificationManager::DisplayPersistentNotification( thread_safe_sender_->Send( new PlatformNotificationHostMsg_ShowPersistent( - request_id, service_worker_registration_id, GURL(origin.string()), icon, ToPlatformNotificationData(notification_data))); + + // There currently isn't a case in which the promise would be rejected per + // our implementation, so always resolve it here. + callbacks->onSuccess(); + + persistent_notification_requests_.Remove(request_id); } bool NotificationManager::RemovePendingPageNotification( |