OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 #include "public/platform/modules/push_messaging/WebPushProvider.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 WebPushProvider_h | |
6 #define WebPushProvider_h | |
7 | |
8 #include "public/platform/WebCallbacks.h" | |
9 #include "public/platform/WebCommon.h" | |
10 #include "public/platform/WebPushPermissionStatus.h" | |
11 | |
12 namespace blink { | |
13 | |
14 class WebServiceWorkerRegistration; | |
15 struct WebPushError; | |
16 struct WebPushSubscription; | |
17 | |
18 using WebPushSubscriptionCallbacks = WebCallbacks<WebPushSubscription, WebPushEr
ror>; | |
19 // FIXME: Remove when no longer used by the embedder - https://crbug.com/446883. | |
20 using WebPushRegistrationCallbacks = WebPushSubscriptionCallbacks; | |
21 using WebPushPermissionStatusCallbacks = WebCallbacks<WebPushPermissionStatus, v
oid>; | |
22 using WebPushUnsubscribeCallbacks = WebCallbacks<bool, WebPushError>; | |
23 // FIXME: Remove when no longer used by the embedder - https://crbug.com/446883. | |
24 using WebPushUnregisterCallbacks = WebPushUnsubscribeCallbacks; | |
25 | |
26 class WebPushProvider { | |
27 public: | |
28 virtual ~WebPushProvider() { } | |
29 | |
30 // Takes ownership of the WebPushRegistrationCallbacks. | |
31 // Does not take ownership of the WebServiceWorkerRegistration. | |
32 virtual void registerPushMessaging(WebServiceWorkerRegistration*, WebPushReg
istrationCallbacks*) { BLINK_ASSERT_NOT_REACHED(); } | |
33 | |
34 // Takes ownership of the WebPushRegistrationCallbacks. | |
35 // Does not take ownership of the WebServiceWorkerRegistration. | |
36 virtual void getRegistration(WebServiceWorkerRegistration*, WebPushRegistrat
ionCallbacks*) { BLINK_ASSERT_NOT_REACHED(); } | |
37 | |
38 // Takes ownership of the WebPushPermissionStatusCallbacks. | |
39 // Does not take ownership of the WebServiceWorkerRegistration. | |
40 virtual void getPermissionStatus(WebServiceWorkerRegistration*, WebPushPermi
ssionStatusCallbacks*) { BLINK_ASSERT_NOT_REACHED(); } | |
41 | |
42 // Takes ownership if the WebPushUnregisterCallbacks. | |
43 // Does not take ownership of the WebServiceWorkerRegistration. | |
44 virtual void unregister(WebServiceWorkerRegistration*, WebPushUnregisterCall
backs* callback) { BLINK_ASSERT_NOT_REACHED(); } | |
45 }; | |
46 | |
47 } // namespace blink | |
48 | |
49 #endif // WebPushProvider_h | |
OLD | NEW |