Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(774)

Unified Diff: content/child/notifications/notification_manager.cc

Issue 803523002: Remove a renderer -> browser roundtrip for resolving the showNotification promise. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-rename-params
Patch Set: remove blank link Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/child/notifications/notification_manager.h ('k') | content/common/platform_notification_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/notifications/notification_manager.cc
diff --git a/content/child/notifications/notification_manager.cc b/content/child/notifications/notification_manager.cc
index 05c3d5249517c04788c938975bc5dc95144b8641..23e40fa483f326ad6ad2460ee533dc74dac42595 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(
« no previous file with comments | « content/child/notifications/notification_manager.h ('k') | content/common/platform_notification_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698