1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_NOTIFICATIONS_PERSISTENT_NOTIFICATION_DELEGATE_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_PERSISTENT_NOTIFICATION_DELEGATE_H_
10 #include "chrome/browser/notifications/notification_delegate.h"
11 #include "content/public/common/platform_notification_data.h"
18 // Delegate responsible for listening to the click event on persistent
19 // notifications, to forward them to the PlatformNotificationService so that
20 // JavaScript events can be fired on the associated Service Worker.
21 class PersistentNotificationDelegate
: public NotificationDelegate
{
23 PersistentNotificationDelegate(
24 content::BrowserContext
* browser_context
,
25 int64 service_worker_registration_id
,
27 const content::PlatformNotificationData
& notification_data
);
29 int64
service_worker_registration_id() const {
30 return service_worker_registration_id_
;
33 const content::PlatformNotificationData
& notification_data() const {
34 return notification_data_
;
37 // NotificationDelegate implementation.
38 void Display() override
;
39 void Close(bool by_user
) override
;
40 void Click() override
;
41 std::string
id() const override
;
44 ~PersistentNotificationDelegate() override
;
47 content::BrowserContext
* browser_context_
;
48 int64 service_worker_registration_id_
;
50 content::PlatformNotificationData notification_data_
;
55 #endif // CHROME_BROWSER_NOTIFICATIONS_PERSISTENT_NOTIFICATION_DELEGATE_H_