| 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" |
| 11 #include "public/platform/WebVector.h" |
| 12 #include "public/platform/modules/notifications/WebNotificationData.h" |
| 9 #include "public/platform/modules/notifications/WebNotificationPermission.h" | 13 #include "public/platform/modules/notifications/WebNotificationPermission.h" |
| 10 | 14 |
| 11 namespace blink { | 15 namespace blink { |
| 12 | 16 |
| 13 struct WebNotificationData; | |
| 14 class WebNotificationDelegate; | 17 class WebNotificationDelegate; |
| 15 class WebSerializedOrigin; | 18 class WebSerializedOrigin; |
| 16 class WebServiceWorkerRegistration; | 19 class WebServiceWorkerRegistration; |
| 17 class WebString; | |
| 18 | 20 |
| 21 // Structure representing the info associated with a persistent notification. |
| 22 struct WebPersistentNotificationInfo { |
| 23 WebString persistentNotificationId; |
| 24 WebNotificationData data; |
| 25 }; |
| 26 |
| 27 using WebNotificationGetCallbacks = WebCallbacks<WebVector<WebPersistentNotifica
tionInfo>, void>; |
| 19 using WebNotificationShowCallbacks = WebCallbacks<void, void>; | 28 using WebNotificationShowCallbacks = WebCallbacks<void, void>; |
| 20 | 29 |
| 21 // Provides the services to show platform notifications to the user. | 30 // Provides the services to show platform notifications to the user. |
| 22 class WebNotificationManager { | 31 class WebNotificationManager { |
| 23 public: | 32 public: |
| 24 virtual ~WebNotificationManager() { } | 33 virtual ~WebNotificationManager() { } |
| 25 | 34 |
| 26 // Shows a page notification on the user's system. These notifications will
have their | 35 // Shows a page notification on the user's system. These notifications will
have their |
| 27 // events delivered to the delegate specified in this call. | 36 // events delivered to the delegate specified in this call. |
| 28 virtual void show(const WebSerializedOrigin&, const WebNotificationData&, We
bNotificationDelegate*) = 0; | 37 virtual void show(const WebSerializedOrigin&, const WebNotificationData&, We
bNotificationDelegate*) = 0; |
| 29 | 38 |
| 30 // Shows a persistent notification on the user's system. These notifications
will have | 39 // Shows a persistent notification on the user's system. These notifications
will have |
| 31 // their events delivered to a Service Worker rather than the object's deleg
ate. Will | 40 // their events delivered to a Service Worker rather than the object's deleg
ate. Will |
| 32 // take ownership of the WebNotificationShowCallbacks object. | 41 // take ownership of the WebNotificationShowCallbacks object. |
| 33 virtual void showPersistent(const WebSerializedOrigin&, const WebNotificatio
nData&, WebServiceWorkerRegistration*, WebNotificationShowCallbacks*) = 0; | 42 virtual void showPersistent(const WebSerializedOrigin&, const WebNotificatio
nData&, WebServiceWorkerRegistration*, WebNotificationShowCallbacks*) = 0; |
| 34 | 43 |
| 44 // Asynchronously gets the persistent notifications belonging to the Service
Worker Registration. |
| 45 // If |filterTag| is not an empty string, only the notification with the giv
en tag will be |
| 46 // considered. Will take ownership of the WebNotificationGetCallbacks object
. |
| 47 virtual void getNotifications(const WebString& filterTag, WebServiceWorkerRe
gistration*, WebNotificationGetCallbacks*) |
| 48 { |
| 49 BLINK_ASSERT_NOT_REACHED(); |
| 50 } |
| 51 |
| 35 // Closes a notification previously shown, and removes it if being shown. | 52 // Closes a notification previously shown, and removes it if being shown. |
| 36 virtual void close(WebNotificationDelegate*) = 0; | 53 virtual void close(WebNotificationDelegate*) = 0; |
| 37 | 54 |
| 38 // Closes a persistent notification identified by its persistent notificatio
n Id. | 55 // Closes a persistent notification identified by its persistent notificatio
n Id. |
| 39 virtual void closePersistent(const WebSerializedOrigin&, const WebString& pe
rsistentNotificationId) = 0; | 56 virtual void closePersistent(const WebSerializedOrigin&, const WebString& pe
rsistentNotificationId) = 0; |
| 40 | 57 |
| 41 // Indicates that the delegate object is being destroyed, and must no longer | 58 // Indicates that the delegate object is being destroyed, and must no longer |
| 42 // be used by the embedder to dispatch events. | 59 // be used by the embedder to dispatch events. |
| 43 virtual void notifyDelegateDestroyed(WebNotificationDelegate*) = 0; | 60 virtual void notifyDelegateDestroyed(WebNotificationDelegate*) = 0; |
| 44 | 61 |
| 45 // Synchronously checks the permission level for the given origin. | 62 // Synchronously checks the permission level for the given origin. |
| 46 virtual WebNotificationPermission checkPermission(const WebSerializedOrigin&
) = 0; | 63 virtual WebNotificationPermission checkPermission(const WebSerializedOrigin&
) = 0; |
| 47 }; | 64 }; |
| 48 | 65 |
| 49 } // namespace blink | 66 } // namespace blink |
| 50 | 67 |
| 51 #endif // WebNotificationManager_h | 68 #endif // WebNotificationManager_h |
| OLD | NEW |