Chromium Code Reviews| Index: content/browser/notifications/notification_message_filter.h |
| diff --git a/content/browser/notifications/notification_message_filter.h b/content/browser/notifications/notification_message_filter.h |
| index bc28879cf71664cf40a307a967ef79fc569d0e23..095d423a7155bfb5b94bf9086d8a86380bb877cd 100644 |
| --- a/content/browser/notifications/notification_message_filter.h |
| +++ b/content/browser/notifications/notification_message_filter.h |
| @@ -23,6 +23,7 @@ class GURL; |
| namespace content { |
| class BrowserContext; |
| +class NotificationIdGenerator; |
| struct NotificationResources; |
| class PlatformNotificationContextImpl; |
| struct PlatformNotificationData; |
| @@ -40,9 +41,9 @@ class NotificationMessageFilter : public BrowserMessageFilter { |
| const scoped_refptr<ServiceWorkerContextWrapper>& service_worker_context, |
| BrowserContext* browser_context); |
| - // To be called by the notification's delegate when it has closed, so that |
| - // the close closure associated with that notification can be removed. |
| - void DidCloseNotification(int notification_id); |
| + // To be called by non-persistent notification delegates when they has closed, |
|
johnme
2016/09/02 15:07:44
s/has/have been/ or s/has/are/
Peter Beverloo
2016/09/05 15:11:01
Done.
|
| + // so that the close closure associated with that notification can be removed. |
|
johnme
2016/09/02 15:07:44
Nit: s/closure/callback/ for clarity?
Peter Beverloo
2016/09/05 15:11:01
A closure is a callback that takes no arguments. T
|
| + void DidCloseNotification(const std::string& notification_id); |
| // BrowserMessageFilter implementation. Called on the UI thread. |
| void OnDestruct() const override; |
| @@ -58,7 +59,7 @@ class NotificationMessageFilter : public BrowserMessageFilter { |
| friend class BrowserThread; |
| void OnShowPlatformNotification( |
| - int notification_id, |
| + int non_persistent_notification_id, |
| const GURL& origin, |
| const PlatformNotificationData& notification_data, |
| const NotificationResources& notification_resources); |
| @@ -72,8 +73,11 @@ class NotificationMessageFilter : public BrowserMessageFilter { |
| int64_t service_worker_registration_id, |
| const GURL& origin, |
| const std::string& filter_tag); |
| - void OnClosePlatformNotification(int notification_id); |
| + void OnClosePlatformNotification(const GURL& origin, |
| + const std::string& tag, |
| + int non_persistent_notification_id); |
| void OnClosePersistentNotification(const GURL& origin, |
| + const std::string& tag, |
| int64_t persistent_notification_id); |
| // Callback to be invoked by the notification context when the notification |
| @@ -86,7 +90,7 @@ class NotificationMessageFilter : public BrowserMessageFilter { |
| const PlatformNotificationData& notification_data, |
| const NotificationResources& notification_resources, |
| bool success, |
| - int64_t persistent_notification_id); |
| + const std::string& notification_id); |
| // Callback to be invoked by the service worker context when the service |
| // worker registration was retrieved. Will present the notification to the |
| @@ -96,7 +100,7 @@ class NotificationMessageFilter : public BrowserMessageFilter { |
| const GURL& origin, |
| const PlatformNotificationData& notification_data, |
| const NotificationResources& notification_resources, |
| - int64_t persistent_notification_id, |
| + const std::string& notification_id, |
| content::ServiceWorkerStatusCode service_worker_status, |
| scoped_refptr<ServiceWorkerRegistration> registration); |
| @@ -128,14 +132,18 @@ class NotificationMessageFilter : public BrowserMessageFilter { |
| bool VerifyNotificationPermissionGranted(PlatformNotificationService* service, |
| const GURL& origin); |
| + // Returns the NotificationIdGenerator instance owned by the context. |
| + NotificationIdGenerator* GetNotificationIdGenerator() const; |
| + |
| int process_id_; |
| scoped_refptr<PlatformNotificationContextImpl> notification_context_; |
| ResourceContext* resource_context_; |
| scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; |
| BrowserContext* browser_context_; |
| - // Map mapping notification ids to their associated close closures. |
| - std::map<int, base::Closure> close_closures_; |
| + // Map mapping notification Ids associated with non-persistent notifications |
|
johnme
2016/09/02 15:07:44
Nit: ids or IDs
Peter Beverloo
2016/09/05 15:11:01
Done.
|
| + // to the closures that may be used for programmatically closing them. |
| + std::unordered_map<std::string, base::Closure> close_closures_; |
| base::WeakPtrFactory<NotificationMessageFilter> weak_factory_io_; |