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 WebNotificationManager_h | 5 #ifndef WebNotificationManager_h |
6 #define WebNotificationManager_h | 6 #define WebNotificationManager_h |
7 | 7 |
8 #include "public/platform/WebCallbacks.h" | 8 #include "public/platform/WebCallbacks.h" |
9 #include "public/platform/WebString.h" | 9 #include "public/platform/WebString.h" |
10 #include "public/platform/WebVector.h" | 10 #include "public/platform/WebVector.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 using WebNotificationGetCallbacks = | 28 using WebNotificationGetCallbacks = |
29 WebCallbacks<const WebVector<WebPersistentNotificationInfo>&, void>; | 29 WebCallbacks<const WebVector<WebPersistentNotificationInfo>&, void>; |
30 using WebNotificationShowCallbacks = WebCallbacks<void, void>; | 30 using WebNotificationShowCallbacks = WebCallbacks<void, void>; |
31 | 31 |
32 // Provides the services to show platform notifications to the user. | 32 // Provides the services to show platform notifications to the user. |
33 class WebNotificationManager { | 33 class WebNotificationManager { |
34 public: | 34 public: |
35 virtual ~WebNotificationManager() {} | 35 virtual ~WebNotificationManager() {} |
36 | 36 |
37 // Shows a page notification on the user's system. These notifications will ha
ve their | 37 // Shows a page notification on the user's system. These notifications will |
38 // events delivered to the delegate specified in this call. | 38 // have their events delivered to the delegate specified in this call. |
39 virtual void show(const WebSecurityOrigin&, | 39 virtual void show(const WebSecurityOrigin&, |
40 const WebNotificationData&, | 40 const WebNotificationData&, |
41 std::unique_ptr<WebNotificationResources>, | 41 std::unique_ptr<WebNotificationResources>, |
42 WebNotificationDelegate*) = 0; | 42 WebNotificationDelegate*) = 0; |
43 | 43 |
44 // Shows a persistent notification on the user's system. These notifications w
ill have | 44 // Shows a persistent notification on the user's system. These notifications |
45 // their events delivered to a Service Worker rather than the object's delegat
e. Will | 45 // will have their events delivered to a Service Worker rather than the |
46 // take ownership of the WebNotificationShowCallbacks object. | 46 // object's delegate. Will take ownership of the WebNotificationShowCallbacks |
| 47 // object. |
47 virtual void showPersistent(const WebSecurityOrigin&, | 48 virtual void showPersistent(const WebSecurityOrigin&, |
48 const WebNotificationData&, | 49 const WebNotificationData&, |
49 std::unique_ptr<WebNotificationResources>, | 50 std::unique_ptr<WebNotificationResources>, |
50 WebServiceWorkerRegistration*, | 51 WebServiceWorkerRegistration*, |
51 WebNotificationShowCallbacks*) = 0; | 52 WebNotificationShowCallbacks*) = 0; |
52 | 53 |
53 // Asynchronously gets the persistent notifications belonging to the Service W
orker Registration. | 54 // Asynchronously gets the persistent notifications belonging to the Service |
54 // If |filterTag| is not an empty string, only the notification with the given
tag will be | 55 // Worker Registration. If |filterTag| is not an empty string, only the |
55 // considered. Will take ownership of the WebNotificationGetCallbacks object. | 56 // notification with the given tag will be considered. Will take ownership of |
| 57 // the WebNotificationGetCallbacks object. |
56 virtual void getNotifications(const WebString& filterTag, | 58 virtual void getNotifications(const WebString& filterTag, |
57 WebServiceWorkerRegistration*, | 59 WebServiceWorkerRegistration*, |
58 WebNotificationGetCallbacks*) = 0; | 60 WebNotificationGetCallbacks*) = 0; |
59 | 61 |
60 // Closes a notification previously shown, and removes it if being shown. | 62 // Closes a notification previously shown, and removes it if being shown. |
61 virtual void close(WebNotificationDelegate*) = 0; | 63 virtual void close(WebNotificationDelegate*) = 0; |
62 | 64 |
63 // Closes a persistent notification identified by its notification Id. | 65 // Closes a persistent notification identified by its notification Id. |
64 virtual void closePersistent(const WebSecurityOrigin&, | 66 virtual void closePersistent(const WebSecurityOrigin&, |
65 const WebString& tag, | 67 const WebString& tag, |
66 const WebString& notificationId) = 0; | 68 const WebString& notificationId) = 0; |
67 | 69 |
68 // Indicates that the delegate object is being destroyed, and must no longer | 70 // Indicates that the delegate object is being destroyed, and must no longer |
69 // be used by the embedder to dispatch events. | 71 // be used by the embedder to dispatch events. |
70 virtual void notifyDelegateDestroyed(WebNotificationDelegate*) = 0; | 72 virtual void notifyDelegateDestroyed(WebNotificationDelegate*) = 0; |
71 }; | 73 }; |
72 | 74 |
73 } // namespace blink | 75 } // namespace blink |
74 | 76 |
75 #endif // WebNotificationManager_h | 77 #endif // WebNotificationManager_h |
OLD | NEW |