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 WebPushProvider_h | 5 #ifndef WebPushProvider_h |
6 #define WebPushProvider_h | 6 #define WebPushProvider_h |
7 | 7 |
8 #include "public/platform/WebCallbacks.h" | 8 #include "public/platform/WebCallbacks.h" |
9 #include "public/platform/modules/push_messaging/WebPushPermissionStatus.h" | 9 #include "public/platform/modules/push_messaging/WebPushPermissionStatus.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class WebServiceWorkerRegistration; | 13 class WebServiceWorkerRegistration; |
14 struct WebPushError; | 14 struct WebPushError; |
15 struct WebPushSubscription; | 15 struct WebPushSubscription; |
16 struct WebPushSubscriptionOptions; | 16 struct WebPushSubscriptionOptions; |
17 | 17 |
18 using WebPushSubscriptionCallbacks = WebCallbacks<WebPushSubscription, WebPushEr ror>; | 18 using WebPushSubscriptionCallbacks = WebCallbacks<WebPushSubscription, WebPushEr ror>; |
19 using WebPushPermissionStatusCallbacks = WebCallbacks<WebPushPermissionStatus, v oid>; | 19 using WebPushPermissionStatusCallbacksOriginal = WebCallbacks<WebPushPermissionS tatus, WebPushError>; |
20 using WebPushUnsubscribeCallbacks = WebCallbacks<bool, WebPushError>; | 20 using WebPushUnsubscribeCallbacks = WebCallbacks<bool, WebPushError>; |
21 | 21 |
22 // FIXME: Remove this and rename WebPushPermissionStatusCallbacksOriginal to Web PushPermissionStatusCallbacks | |
23 // once blinks rolls into chrome and the embedder is fixed to use onError(WebPus hError*) | |
24 class WebPushPermissionStatusCallbacks: public WebPushPermissionStatusCallbacksO riginal { | |
Peter Beverloo
2015/05/11 12:56:15
nit: space before the colon.
Miguel Garcia
2015/05/11 13:22:47
Done.
| |
25 public: | |
26 virtual void onError() = 0; | |
27 | |
28 // WebPushPermissionStatusCallbacksOriginal: | |
29 virtual void onSuccess(WebPushPermissionStatus*) = 0; | |
30 virtual void onError(WebPushError*) = 0; | |
31 }; | |
Peter Beverloo
2015/05/11 12:56:15
Hmm, I haven't seen this mechanism of dealing with
Miguel Garcia
2015/05/11 13:22:47
Acknowledged.
| |
32 | |
22 class WebPushProvider { | 33 class WebPushProvider { |
23 public: | 34 public: |
24 virtual ~WebPushProvider() { } | 35 virtual ~WebPushProvider() { } |
25 | 36 |
26 // Takes ownership of the WebPushSubscriptionCallbacks. | 37 // Takes ownership of the WebPushSubscriptionCallbacks. |
27 // Does not take ownership of the WebServiceWorkerRegistration. | 38 // Does not take ownership of the WebServiceWorkerRegistration. |
28 virtual void subscribe(WebServiceWorkerRegistration*, const WebPushSubscript ionOptions&, WebPushSubscriptionCallbacks*) = 0; | 39 virtual void subscribe(WebServiceWorkerRegistration*, const WebPushSubscript ionOptions&, WebPushSubscriptionCallbacks*) = 0; |
29 | 40 |
30 // Takes ownership of the WebPushSubscriptionCallbacks. | 41 // Takes ownership of the WebPushSubscriptionCallbacks. |
31 // Does not take ownership of the WebServiceWorkerRegistration. | 42 // Does not take ownership of the WebServiceWorkerRegistration. |
32 virtual void getSubscription(WebServiceWorkerRegistration*, WebPushSubscript ionCallbacks*) = 0; | 43 virtual void getSubscription(WebServiceWorkerRegistration*, WebPushSubscript ionCallbacks*) = 0; |
33 | 44 |
34 // Takes ownership of the WebPushPermissionStatusCallbacks. | 45 // Takes ownership of the WebPushPermissionStatusCallbacks. |
35 // Does not take ownership of the WebServiceWorkerRegistration. | 46 // Does not take ownership of the WebServiceWorkerRegistration. |
36 virtual void getPermissionStatus(WebServiceWorkerRegistration*, const WebPus hSubscriptionOptions&, WebPushPermissionStatusCallbacks*) = 0; | 47 virtual void getPermissionStatus(WebServiceWorkerRegistration*, const WebPus hSubscriptionOptions&, WebPushPermissionStatusCallbacks*) = 0; |
37 | 48 |
38 // Takes ownership if the WebPushUnsubscribeCallbacks. | 49 // Takes ownership if the WebPushUnsubscribeCallbacks. |
39 // Does not take ownership of the WebServiceWorkerRegistration. | 50 // Does not take ownership of the WebServiceWorkerRegistration. |
40 virtual void unsubscribe(WebServiceWorkerRegistration*, WebPushUnsubscribeCa llbacks*) = 0; | 51 virtual void unsubscribe(WebServiceWorkerRegistration*, WebPushUnsubscribeCa llbacks*) = 0; |
41 }; | 52 }; |
42 | 53 |
43 } // namespace blink | 54 } // namespace blink |
44 | 55 |
45 #endif // WebPushProvider_h | 56 #endif // WebPushProvider_h |
OLD | NEW |