Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: public/platform/modules/push_messaging/WebPushProvider.h

Issue 1130233003: Reject the permissionState promise with NotSupported Exception (1/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « public/platform/modules/push_messaging/WebPushError.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // TODO(miguelg): Remove this and rename WebPushPermissionStatusCallbacksOrigina l to WebPushPermissionStatusCallbacks
23 // once blinks rolls into chrome and the embedder is fixed to use onError(WebPus hError*)
24 class WebPushPermissionStatusCallbacks : public WebPushPermissionStatusCallbacks Original {
25 public:
26 // This method is obsolete and replacedby onError(WebPushError*)
27 virtual void onError() = 0;
28
29 // WebPushPermissionStatusCallbacksOriginal:
30 virtual void onSuccess(WebPushPermissionStatus*) = 0;
31 virtual void onError(WebPushError*) = 0;
32 };
33
22 class WebPushProvider { 34 class WebPushProvider {
23 public: 35 public:
24 virtual ~WebPushProvider() { } 36 virtual ~WebPushProvider() { }
25 37
26 // Takes ownership of the WebPushSubscriptionCallbacks. 38 // Takes ownership of the WebPushSubscriptionCallbacks.
27 // Does not take ownership of the WebServiceWorkerRegistration. 39 // Does not take ownership of the WebServiceWorkerRegistration.
28 virtual void subscribe(WebServiceWorkerRegistration*, const WebPushSubscript ionOptions&, WebPushSubscriptionCallbacks*) = 0; 40 virtual void subscribe(WebServiceWorkerRegistration*, const WebPushSubscript ionOptions&, WebPushSubscriptionCallbacks*) = 0;
29 41
30 // Takes ownership of the WebPushSubscriptionCallbacks. 42 // Takes ownership of the WebPushSubscriptionCallbacks.
31 // Does not take ownership of the WebServiceWorkerRegistration. 43 // Does not take ownership of the WebServiceWorkerRegistration.
32 virtual void getSubscription(WebServiceWorkerRegistration*, WebPushSubscript ionCallbacks*) = 0; 44 virtual void getSubscription(WebServiceWorkerRegistration*, WebPushSubscript ionCallbacks*) = 0;
33 45
34 // Takes ownership of the WebPushPermissionStatusCallbacks. 46 // Takes ownership of the WebPushPermissionStatusCallbacks.
35 // Does not take ownership of the WebServiceWorkerRegistration. 47 // Does not take ownership of the WebServiceWorkerRegistration.
36 virtual void getPermissionStatus(WebServiceWorkerRegistration*, const WebPus hSubscriptionOptions&, WebPushPermissionStatusCallbacks*) = 0; 48 virtual void getPermissionStatus(WebServiceWorkerRegistration*, const WebPus hSubscriptionOptions&, WebPushPermissionStatusCallbacks*) = 0;
37 49
38 // Takes ownership if the WebPushUnsubscribeCallbacks. 50 // Takes ownership if the WebPushUnsubscribeCallbacks.
39 // Does not take ownership of the WebServiceWorkerRegistration. 51 // Does not take ownership of the WebServiceWorkerRegistration.
40 virtual void unsubscribe(WebServiceWorkerRegistration*, WebPushUnsubscribeCa llbacks*) = 0; 52 virtual void unsubscribe(WebServiceWorkerRegistration*, WebPushUnsubscribeCa llbacks*) = 0;
41 }; 53 };
42 54
43 } // namespace blink 55 } // namespace blink
44 56
45 #endif // WebPushProvider_h 57 #endif // WebPushProvider_h
OLDNEW
« no previous file with comments | « public/platform/modules/push_messaging/WebPushError.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698