summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorpeter <peter@chromium.org>2014-12-12 09:35:48 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-12 17:36:20 +0000
commit5eea7412cff596debc210f374211e5c73ba4fdaf (patch)
tree26ba7977eef0c1e354bb6fc676825a5e8d5b235f /content
parent20bf4c3c8f6c408cd2214d76e57265d424dae13e (diff)
downloadchromium_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')
-rw-r--r--content/browser/notifications/notification_message_filter.cc3
-rw-r--r--content/browser/notifications/notification_message_filter.h1
-rw-r--r--content/child/notifications/notification_manager.cc25
-rw-r--r--content/child/notifications/notification_manager.h1
-rw-r--r--content/common/platform_notification_messages.h8
5 files changed, 11 insertions, 27 deletions
diff --git a/content/browser/notifications/notification_message_filter.cc b/content/browser/notifications/notification_message_filter.cc
index afbebc9..537e90a 100644
--- a/content/browser/notifications/notification_message_filter.cc
+++ b/content/browser/notifications/notification_message_filter.cc
@@ -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(
diff --git a/content/browser/notifications/notification_message_filter.h b/content/browser/notifications/notification_message_filter.h
index 44e9c81..e4d48d0 100644
--- a/content/browser/notifications/notification_message_filter.h
+++ b/content/browser/notifications/notification_message_filter.h
@@ -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,
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(
diff --git a/content/child/notifications/notification_manager.h b/content/child/notifications/notification_manager.h
index 7c43563..1fb44ba 100644
--- a/content/child/notifications/notification_manager.h
+++ b/content/child/notifications/notification_manager.h
@@ -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);
diff --git a/content/common/platform_notification_messages.h b/content/common/platform_notification_messages.h
index a0d6390..96358e8 100644
--- a/content/common/platform_notification_messages.h
+++ b/content/common/platform_notification_messages.h
@@ -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 */,