| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 #include "public/platform/modules/notifications/WebNotificationManager.h" |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef WebNotificationManager_h | |
| 6 #define WebNotificationManager_h | |
| 7 | |
| 8 #include "WebCallbacks.h" | |
| 9 #include "WebNotificationPermission.h" | |
| 10 | |
| 11 namespace blink { | |
| 12 | |
| 13 struct WebNotificationData; | |
| 14 class WebNotificationDelegate; | |
| 15 class WebSerializedOrigin; | |
| 16 class WebServiceWorkerRegistration; | |
| 17 class WebString; | |
| 18 | |
| 19 using WebNotificationShowCallbacks = WebCallbacks<void, void>; | |
| 20 | |
| 21 // Provides the services to show platform notifications to the user. | |
| 22 class WebNotificationManager { | |
| 23 public: | |
| 24 virtual ~WebNotificationManager() { } | |
| 25 | |
| 26 // Shows a page notification on the user's system. These notifications will
have their | |
| 27 // events delivered to the delegate specified in this call. | |
| 28 virtual void show(const WebSerializedOrigin&, const WebNotificationData&, We
bNotificationDelegate*) = 0; | |
| 29 | |
| 30 // 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 | |
| 32 // take ownership of the WebNotificationShowCallbacks object. | |
| 33 virtual void showPersistent(const WebSerializedOrigin&, const WebNotificatio
nData&, WebServiceWorkerRegistration*, WebNotificationShowCallbacks*) { } | |
| 34 | |
| 35 // Closes a notification previously shown, and removes it if being shown. | |
| 36 virtual void close(WebNotificationDelegate*) = 0; | |
| 37 | |
| 38 // Closes a persistent notification identified by its persistent notificatio
n Id. | |
| 39 virtual void closePersistent(const WebString& persistentNotificationId) { } | |
| 40 | |
| 41 // Indicates that the delegate object is being destroyed, and must no longer | |
| 42 // be used by the embedder to dispatch events. | |
| 43 virtual void notifyDelegateDestroyed(WebNotificationDelegate*) = 0; | |
| 44 | |
| 45 // Synchronously checks the permission level for the given origin. | |
| 46 virtual WebNotificationPermission checkPermission(const WebSerializedOrigin&
) = 0; | |
| 47 }; | |
| 48 | |
| 49 } // namespace blink | |
| 50 | |
| 51 #endif // WebNotificationManager_h | |
| OLD | NEW |