Commit 5eea7412 authored by peter's avatar peter Committed by Commit bot

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}
parent 20bf4c3c
......@@ -101,7 +101,6 @@ void NotificationMessageFilter::OnShowPlatformNotification(
}
void NotificationMessageFilter::OnShowPersistentNotification(
int request_id,
int64 service_worker_registration_id,
const GURL& origin,
const SkBitmap& icon,
......@@ -120,8 +119,6 @@ void NotificationMessageFilter::OnShowPersistentNotification(
icon,
notification_data,
process_id_);
Send(new PlatformNotificationMsg_DidShowPersistent(request_id));
}
void NotificationMessageFilter::OnClosePlatformNotification(
......
......@@ -48,7 +48,6 @@ class NotificationMessageFilter : public BrowserMessageFilter {
const SkBitmap& icon,
const PlatformNotificationData& notification_data);
void OnShowPersistentNotification(
int request_id,
int64 service_worker_registration_id,
const GURL& origin,
const SkBitmap& icon,
......
......@@ -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(
......
......@@ -69,7 +69,6 @@ class NotificationManager : public blink::WebNotificationManager,
NotificationDispatcher* notification_dispatcher);
// IPC message handlers.
void OnDidShowPersistent(int request_id);
void OnDidShow(int notification_id);
void OnDidClose(int notification_id);
void OnDidClick(int notification_id);
......
......@@ -30,11 +30,6 @@ IPC_STRUCT_TRAITS_END()
// Messages sent from the browser to the renderer.
// Informs the renderer that the browser has displayed the persistent
// notification.
IPC_MESSAGE_CONTROL1(PlatformNotificationMsg_DidShowPersistent,
int /* request_id */)
// Informs the renderer that the browser has displayed the notification.
IPC_MESSAGE_CONTROL1(PlatformNotificationMsg_DidShow,
int /* notification_id */)
......@@ -55,8 +50,7 @@ IPC_MESSAGE_CONTROL4(PlatformNotificationHostMsg_Show,
SkBitmap /* icon */,
content::PlatformNotificationData /* notification_data */)
IPC_MESSAGE_CONTROL5(PlatformNotificationHostMsg_ShowPersistent,
int /* request_id */,
IPC_MESSAGE_CONTROL4(PlatformNotificationHostMsg_ShowPersistent,
int64 /* service_worker_provider_id */,
GURL /* origin */,
SkBitmap /* icon */,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment