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 PushManager_h | 5 #ifndef PushManager_h |
6 #define PushManager_h | 6 #define PushManager_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
9 #include "modules/ModulesExport.h" | 9 #include "modules/ModulesExport.h" |
10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class ExceptionState; | 14 class ExceptionState; |
15 class PushSubscriptionOptions; | 15 class PushSubscriptionOptionsInit; |
16 class ScriptPromise; | 16 class ScriptPromise; |
17 class ScriptState; | 17 class ScriptState; |
18 class ServiceWorkerRegistration; | 18 class ServiceWorkerRegistration; |
19 struct WebPushSubscriptionOptions; | |
20 | 19 |
21 class MODULES_EXPORT PushManager final : public GarbageCollected<PushManager>, p
ublic ScriptWrappable { | 20 class MODULES_EXPORT PushManager final : public GarbageCollected<PushManager>, p
ublic ScriptWrappable { |
22 DEFINE_WRAPPERTYPEINFO(); | 21 DEFINE_WRAPPERTYPEINFO(); |
23 public: | 22 public: |
24 static PushManager* create(ServiceWorkerRegistration* registration) | 23 static PushManager* create(ServiceWorkerRegistration* registration) |
25 { | 24 { |
26 return new PushManager(registration); | 25 return new PushManager(registration); |
27 } | 26 } |
28 | 27 |
29 ScriptPromise subscribe(ScriptState*, const PushSubscriptionOptions&, | 28 ScriptPromise subscribe(ScriptState*, const PushSubscriptionOptionsInit&, Ex
ceptionState&); |
30 ExceptionState&); | |
31 ScriptPromise getSubscription(ScriptState*); | 29 ScriptPromise getSubscription(ScriptState*); |
32 ScriptPromise permissionState(ScriptState*, const PushSubscriptionOptions&, | 30 ScriptPromise permissionState(ScriptState*, const PushSubscriptionOptionsIni
t&, ExceptionState&); |
33 ExceptionState&); | |
34 | 31 |
35 DECLARE_TRACE(); | 32 DECLARE_TRACE(); |
36 | 33 |
37 static WebPushSubscriptionOptions toWebPushSubscriptionOptions( | |
38 const PushSubscriptionOptions&, ExceptionState&); | |
39 | |
40 private: | 34 private: |
41 explicit PushManager(ServiceWorkerRegistration*); | 35 explicit PushManager(ServiceWorkerRegistration*); |
42 | 36 |
43 Member<ServiceWorkerRegistration> m_registration; | 37 Member<ServiceWorkerRegistration> m_registration; |
44 }; | 38 }; |
45 | 39 |
46 } // namespace blink | 40 } // namespace blink |
47 | 41 |
48 #endif // PushManager_h | 42 #endif // PushManager_h |
OLD | NEW |