OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_NOTIFICATIONS_PERSISTENT_NOTIFICATION_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_PERSISTENT_NOTIFICATION_DELEGATE_H_ |
6 #define CHROME_BROWSER_NOTIFICATIONS_PERSISTENT_NOTIFICATION_DELEGATE_H_ | 6 #define CHROME_BROWSER_NOTIFICATIONS_PERSISTENT_NOTIFICATION_DELEGATE_H_ |
7 | 7 |
8 #include <stdint.h> | |
Avi (use Gerrit)
2015/03/31 20:36:21
Thank you!
| |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "chrome/browser/notifications/notification_delegate.h" | 11 #include "chrome/browser/notifications/notification_delegate.h" |
11 #include "content/public/common/platform_notification_data.h" | |
12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 class BrowserContext; | 15 class BrowserContext; |
16 } | 16 } |
17 | 17 |
18 // Delegate responsible for listening to the click event on persistent | 18 // Delegate responsible for listening to the click event on persistent |
19 // notifications, to forward them to the PlatformNotificationService so that | 19 // notifications, to forward them to the PlatformNotificationService so that |
20 // JavaScript events can be fired on the associated Service Worker. | 20 // JavaScript events can be fired on the associated Service Worker. |
21 class PersistentNotificationDelegate : public NotificationDelegate { | 21 class PersistentNotificationDelegate : public NotificationDelegate { |
22 public: | 22 public: |
23 PersistentNotificationDelegate( | 23 PersistentNotificationDelegate( |
24 content::BrowserContext* browser_context, | 24 content::BrowserContext* browser_context, |
25 int64 service_worker_registration_id, | 25 int64_t persistent_notification_id, |
26 const GURL& origin, | 26 const GURL& origin); |
27 const content::PlatformNotificationData& notification_data); | |
28 | 27 |
29 int64 service_worker_registration_id() const { | 28 int64 persistent_notification_id() const { |
Avi (use Gerrit)
2015/03/31 20:36:21
int64_t
johnme
2015/04/01 17:39:37
What's the relation between this and id()? Could i
Peter Beverloo
2015/04/01 18:32:17
Done.
Peter Beverloo
2015/04/01 18:32:17
id() is what we tell the NotificationUIManager (on
| |
30 return service_worker_registration_id_; | 29 return persistent_notification_id_; |
31 } | |
32 | |
33 const content::PlatformNotificationData& notification_data() const { | |
34 return notification_data_; | |
35 } | 30 } |
36 | 31 |
37 // NotificationDelegate implementation. | 32 // NotificationDelegate implementation. |
38 void Display() override; | 33 void Display() override; |
39 void Close(bool by_user) override; | 34 void Close(bool by_user) override; |
40 void Click() override; | 35 void Click() override; |
41 std::string id() const override; | 36 std::string id() const override; |
42 | 37 |
43 protected: | 38 protected: |
44 ~PersistentNotificationDelegate() override; | 39 ~PersistentNotificationDelegate() override; |
45 | 40 |
46 private: | 41 private: |
47 content::BrowserContext* browser_context_; | 42 content::BrowserContext* browser_context_; |
48 int64 service_worker_registration_id_; | 43 int64_t persistent_notification_id_; |
49 GURL origin_; | 44 GURL origin_; |
50 content::PlatformNotificationData notification_data_; | |
51 | 45 |
52 std::string id_; | 46 std::string id_; |
53 }; | 47 }; |
54 | 48 |
55 #endif // CHROME_BROWSER_NOTIFICATIONS_PERSISTENT_NOTIFICATION_DELEGATE_H_ | 49 #endif // CHROME_BROWSER_NOTIFICATIONS_PERSISTENT_NOTIFICATION_DELEGATE_H_ |
OLD | NEW |