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( ...@@ -101,7 +101,6 @@ void NotificationMessageFilter::OnShowPlatformNotification(
} }
void NotificationMessageFilter::OnShowPersistentNotification( void NotificationMessageFilter::OnShowPersistentNotification(
int request_id,
int64 service_worker_registration_id, int64 service_worker_registration_id,
const GURL& origin, const GURL& origin,
const SkBitmap& icon, const SkBitmap& icon,
...@@ -120,8 +119,6 @@ void NotificationMessageFilter::OnShowPersistentNotification( ...@@ -120,8 +119,6 @@ void NotificationMessageFilter::OnShowPersistentNotification(
icon, icon,
notification_data, notification_data,
process_id_); process_id_);
Send(new PlatformNotificationMsg_DidShowPersistent(request_id));
} }
void NotificationMessageFilter::OnClosePlatformNotification( void NotificationMessageFilter::OnClosePlatformNotification(
......
...@@ -48,7 +48,6 @@ class NotificationMessageFilter : public BrowserMessageFilter { ...@@ -48,7 +48,6 @@ class NotificationMessageFilter : public BrowserMessageFilter {
const SkBitmap& icon, const SkBitmap& icon,
const PlatformNotificationData& notification_data); const PlatformNotificationData& notification_data);
void OnShowPersistentNotification( void OnShowPersistentNotification(
int request_id,
int64 service_worker_registration_id, int64 service_worker_registration_id,
const GURL& origin, const GURL& origin,
const SkBitmap& icon, const SkBitmap& icon,
......
...@@ -173,8 +173,6 @@ WebNotificationPermission NotificationManager::checkPermission( ...@@ -173,8 +173,6 @@ WebNotificationPermission NotificationManager::checkPermission(
bool NotificationManager::OnMessageReceived(const IPC::Message& message) { bool NotificationManager::OnMessageReceived(const IPC::Message& message) {
bool handled = true; bool handled = true;
IPC_BEGIN_MESSAGE_MAP(NotificationManager, message) IPC_BEGIN_MESSAGE_MAP(NotificationManager, message)
IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidShowPersistent,
OnDidShowPersistent)
IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidShow, OnDidShow); IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidShow, OnDidShow);
IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidClose, OnDidClose); IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidClose, OnDidClose);
IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidClick, OnDidClick); IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidClick, OnDidClick);
...@@ -184,18 +182,6 @@ bool NotificationManager::OnMessageReceived(const IPC::Message& message) { ...@@ -184,18 +182,6 @@ bool NotificationManager::OnMessageReceived(const IPC::Message& message) {
return handled; 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) { void NotificationManager::OnDidShow(int notification_id) {
const auto& iter = active_notifications_.find(notification_id); const auto& iter = active_notifications_.find(notification_id);
if (iter == active_notifications_.end()) if (iter == active_notifications_.end())
...@@ -268,6 +254,10 @@ void NotificationManager::DisplayPersistentNotification( ...@@ -268,6 +254,10 @@ void NotificationManager::DisplayPersistentNotification(
int64 service_worker_registration_id, int64 service_worker_registration_id,
int request_id, int request_id,
scoped_refptr<NotificationImageLoader> image_loader) { scoped_refptr<NotificationImageLoader> image_loader) {
blink::WebNotificationShowCallbacks* callbacks =
persistent_notification_requests_.Lookup(request_id);
DCHECK(callbacks);
SkBitmap icon; SkBitmap icon;
if (image_loader) { if (image_loader) {
pending_persistent_notifications_.erase(image_loader); pending_persistent_notifications_.erase(image_loader);
...@@ -276,11 +266,16 @@ void NotificationManager::DisplayPersistentNotification( ...@@ -276,11 +266,16 @@ void NotificationManager::DisplayPersistentNotification(
thread_safe_sender_->Send( thread_safe_sender_->Send(
new PlatformNotificationHostMsg_ShowPersistent( new PlatformNotificationHostMsg_ShowPersistent(
request_id,
service_worker_registration_id, service_worker_registration_id,
GURL(origin.string()), GURL(origin.string()),
icon, icon,
ToPlatformNotificationData(notification_data))); 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( bool NotificationManager::RemovePendingPageNotification(
......
...@@ -69,7 +69,6 @@ class NotificationManager : public blink::WebNotificationManager, ...@@ -69,7 +69,6 @@ class NotificationManager : public blink::WebNotificationManager,
NotificationDispatcher* notification_dispatcher); NotificationDispatcher* notification_dispatcher);
// IPC message handlers. // IPC message handlers.
void OnDidShowPersistent(int request_id);
void OnDidShow(int notification_id); void OnDidShow(int notification_id);
void OnDidClose(int notification_id); void OnDidClose(int notification_id);
void OnDidClick(int notification_id); void OnDidClick(int notification_id);
......
...@@ -30,11 +30,6 @@ IPC_STRUCT_TRAITS_END() ...@@ -30,11 +30,6 @@ IPC_STRUCT_TRAITS_END()
// Messages sent from the browser to the renderer. // 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. // Informs the renderer that the browser has displayed the notification.
IPC_MESSAGE_CONTROL1(PlatformNotificationMsg_DidShow, IPC_MESSAGE_CONTROL1(PlatformNotificationMsg_DidShow,
int /* notification_id */) int /* notification_id */)
...@@ -55,8 +50,7 @@ IPC_MESSAGE_CONTROL4(PlatformNotificationHostMsg_Show, ...@@ -55,8 +50,7 @@ IPC_MESSAGE_CONTROL4(PlatformNotificationHostMsg_Show,
SkBitmap /* icon */, SkBitmap /* icon */,
content::PlatformNotificationData /* notification_data */) content::PlatformNotificationData /* notification_data */)
IPC_MESSAGE_CONTROL5(PlatformNotificationHostMsg_ShowPersistent, IPC_MESSAGE_CONTROL4(PlatformNotificationHostMsg_ShowPersistent,
int /* request_id */,
int64 /* service_worker_provider_id */, int64 /* service_worker_provider_id */,
GURL /* origin */, GURL /* origin */,
SkBitmap /* icon */, 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