Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / public / platform / modules / push_messaging / WebPushProvider.h
blob5de2f8aaae5c625d40bb2b64b7f3d030c86fa0cc
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
3 // found in the LICENSE file.
5 #ifndef WebPushProvider_h
6 #define WebPushProvider_h
8 #include "public/platform/WebCallbacks.h"
9 #include "public/platform/WebPassOwnPtr.h"
10 #include "public/platform/modules/push_messaging/WebPushPermissionStatus.h"
11 #include "public/platform/modules/push_messaging/WebPushSubscription.h"
13 namespace blink {
15 class WebServiceWorkerRegistration;
16 struct WebPushError;
17 struct WebPushSubscriptionOptions;
19 using WebPushSubscriptionCallbacks = WebCallbacks<WebPassOwnPtr<WebPushSubscription>, const WebPushError&>;
20 using WebPushPermissionStatusCallbacks = WebCallbacks<WebPushPermissionStatus, const WebPushError&>;
21 using WebPushUnsubscribeCallbacks = WebCallbacks<bool, const WebPushError&>;
23 class WebPushProvider {
24 public:
25 virtual ~WebPushProvider() { }
27 // Takes ownership of the WebPushSubscriptionCallbacks.
28 // Does not take ownership of the WebServiceWorkerRegistration.
29 virtual void subscribe(WebServiceWorkerRegistration*, const WebPushSubscriptionOptions&, WebPushSubscriptionCallbacks*) = 0;
31 // Takes ownership of the WebPushSubscriptionCallbacks.
32 // Does not take ownership of the WebServiceWorkerRegistration.
33 virtual void getSubscription(WebServiceWorkerRegistration*, WebPushSubscriptionCallbacks*) = 0;
35 // Takes ownership of the WebPushPermissionStatusCallbacks.
36 // Does not take ownership of the WebServiceWorkerRegistration.
37 virtual void getPermissionStatus(WebServiceWorkerRegistration*, const WebPushSubscriptionOptions&, WebPushPermissionStatusCallbacks*) = 0;
39 // Takes ownership if the WebPushUnsubscribeCallbacks.
40 // Does not take ownership of the WebServiceWorkerRegistration.
41 virtual void unsubscribe(WebServiceWorkerRegistration*, WebPushUnsubscribeCallbacks*) = 0;
44 } // namespace blink
46 #endif // WebPushProvider_h