| 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/WebCommon.h" | |
| 10 #include "public/platform/WebString.h" | 9 #include "public/platform/WebString.h" |
| 11 #include "public/platform/WebVector.h" | 10 #include "public/platform/WebVector.h" |
| 12 #include "public/platform/modules/notifications/WebNotificationData.h" | 11 #include "public/platform/modules/notifications/WebNotificationData.h" |
| 13 #include "public/platform/modules/notifications/WebNotificationPermission.h" | 12 #include "public/platform/modules/notifications/WebNotificationPermission.h" |
| 14 #include <stdint.h> | 13 #include <stdint.h> |
| 15 | 14 |
| 16 namespace blink { | 15 namespace blink { |
| 17 | 16 |
| 18 class WebNotificationDelegate; | 17 class WebNotificationDelegate; |
| 19 class WebSerializedOrigin; | 18 class WebSerializedOrigin; |
| 20 class WebServiceWorkerRegistration; | 19 class WebServiceWorkerRegistration; |
| 21 | 20 |
| 22 // Structure representing the info associated with a persistent notification. | 21 // Structure representing the info associated with a persistent notification. |
| 23 struct WebPersistentNotificationInfo { | 22 struct WebPersistentNotificationInfo { |
| 24 // TODO(peter): Remove the string property when Chromium has switched over. | |
| 25 WebString persistentNotificationId; | |
| 26 | |
| 27 int64_t persistentId = 0; | 23 int64_t persistentId = 0; |
| 28 WebNotificationData data; | 24 WebNotificationData data; |
| 29 }; | 25 }; |
| 30 | 26 |
| 31 using WebNotificationGetCallbacks = WebCallbacks<WebVector<WebPersistentNotifica
tionInfo>, void>; | 27 using WebNotificationGetCallbacks = WebCallbacks<WebVector<WebPersistentNotifica
tionInfo>, void>; |
| 32 using WebNotificationShowCallbacks = WebCallbacks<void, void>; | 28 using WebNotificationShowCallbacks = WebCallbacks<void, void>; |
| 33 | 29 |
| 34 // Provides the services to show platform notifications to the user. | 30 // Provides the services to show platform notifications to the user. |
| 35 class WebNotificationManager { | 31 class WebNotificationManager { |
| 36 public: | 32 public: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 47 | 43 |
| 48 // Asynchronously gets the persistent notifications belonging to the Service
Worker Registration. | 44 // Asynchronously gets the persistent notifications belonging to the Service
Worker Registration. |
| 49 // If |filterTag| is not an empty string, only the notification with the giv
en tag will be | 45 // If |filterTag| is not an empty string, only the notification with the giv
en tag will be |
| 50 // considered. Will take ownership of the WebNotificationGetCallbacks object
. | 46 // considered. Will take ownership of the WebNotificationGetCallbacks object
. |
| 51 virtual void getNotifications(const WebString& filterTag, WebServiceWorkerRe
gistration*, WebNotificationGetCallbacks*) = 0; | 47 virtual void getNotifications(const WebString& filterTag, WebServiceWorkerRe
gistration*, WebNotificationGetCallbacks*) = 0; |
| 52 | 48 |
| 53 // Closes a notification previously shown, and removes it if being shown. | 49 // Closes a notification previously shown, and removes it if being shown. |
| 54 virtual void close(WebNotificationDelegate*) = 0; | 50 virtual void close(WebNotificationDelegate*) = 0; |
| 55 | 51 |
| 56 // Closes a persistent notification identified by its persistent notificatio
n Id. | 52 // Closes a persistent notification identified by its persistent notificatio
n Id. |
| 57 virtual void closePersistent(const WebSerializedOrigin&, int64_t persistentN
otificationId) | 53 virtual void closePersistent(const WebSerializedOrigin&, int64_t persistentN
otificationId) = 0; |
| 58 { | |
| 59 BLINK_ASSERT_NOT_REACHED(); | |
| 60 } | |
| 61 | |
| 62 // TODO(peter): Remove this method when the embedder accepts integral persis
tent ids. | |
| 63 virtual void closePersistent(const WebSerializedOrigin&, const WebString& pe
rsistentNotificationId) | |
| 64 { | |
| 65 BLINK_ASSERT_NOT_REACHED(); | |
| 66 } | |
| 67 | 54 |
| 68 // Indicates that the delegate object is being destroyed, and must no longer | 55 // Indicates that the delegate object is being destroyed, and must no longer |
| 69 // be used by the embedder to dispatch events. | 56 // be used by the embedder to dispatch events. |
| 70 virtual void notifyDelegateDestroyed(WebNotificationDelegate*) = 0; | 57 virtual void notifyDelegateDestroyed(WebNotificationDelegate*) = 0; |
| 71 | 58 |
| 72 // Synchronously checks the permission level for the given origin. | 59 // Synchronously checks the permission level for the given origin. |
| 73 virtual WebNotificationPermission checkPermission(const WebSerializedOrigin&
) = 0; | 60 virtual WebNotificationPermission checkPermission(const WebSerializedOrigin&
) = 0; |
| 74 }; | 61 }; |
| 75 | 62 |
| 76 } // namespace blink | 63 } // namespace blink |
| 77 | 64 |
| 78 #endif // WebNotificationManager_h | 65 #endif // WebNotificationManager_h |
| OLD | NEW |