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 PushSubscription_h | 5 #ifndef PushSubscription_h |
6 #define PushSubscription_h | 6 #define PushSubscription_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
9 #include "bindings/core/v8/ScriptValue.h" | 9 #include "bindings/core/v8/ScriptValue.h" |
10 #include "bindings/core/v8/ScriptWrappable.h" | 10 #include "bindings/core/v8/ScriptWrappable.h" |
11 #include "core/dom/DOMArrayBuffer.h" | 11 #include "core/dom/DOMArrayBuffer.h" |
12 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
13 #include "platform/weborigin/KURL.h" | 13 #include "platform/weborigin/KURL.h" |
14 #include "wtf/PassRefPtr.h" | 14 #include "wtf/PassRefPtr.h" |
15 #include "wtf/RefPtr.h" | 15 #include "wtf/RefPtr.h" |
16 #include <memory> | 16 #include <memory> |
17 | 17 |
18 namespace blink { | 18 namespace blink { |
19 | 19 |
20 class PushSubscriptionOptions; | |
20 class ServiceWorkerRegistration; | 21 class ServiceWorkerRegistration; |
21 class ScriptPromiseResolver; | 22 class ScriptPromiseResolver; |
22 class ScriptState; | 23 class ScriptState; |
23 struct WebPushSubscription; | 24 struct WebPushSubscription; |
24 | 25 |
25 class PushSubscription final : public GarbageCollectedFinalized<PushSubscription >, public ScriptWrappable { | 26 class PushSubscription final : public GarbageCollectedFinalized<PushSubscription >, public ScriptWrappable { |
26 DEFINE_WRAPPERTYPEINFO(); | 27 DEFINE_WRAPPERTYPEINFO(); |
27 public: | 28 public: |
28 static PushSubscription* take(ScriptPromiseResolver*, std::unique_ptr<WebPus hSubscription>, ServiceWorkerRegistration*); | 29 static PushSubscription* take(ScriptPromiseResolver*, std::unique_ptr<WebPus hSubscription>, ServiceWorkerRegistration*); |
29 static void dispose(WebPushSubscription* subscriptionRaw); | 30 static void dispose(WebPushSubscription* subscriptionRaw); |
30 | 31 |
31 virtual ~PushSubscription(); | 32 virtual ~PushSubscription(); |
32 | 33 |
33 KURL endpoint() const; | 34 KURL endpoint() const { return m_endpoint; } |
35 | |
36 PushSubscriptionOptions* options() const { return m_options; } | |
Peter Beverloo
2016/07/08 18:30:12
nit: looking throughout the code, it's *much* more
johnme
2016/07/13 17:51:57
Done.
| |
34 | 37 |
35 DOMArrayBuffer* getKey(const AtomicString& name) const; | 38 DOMArrayBuffer* getKey(const AtomicString& name) const; |
36 ScriptPromise unsubscribe(ScriptState*); | 39 ScriptPromise unsubscribe(ScriptState*); |
37 | 40 |
38 ScriptValue toJSONForBinding(ScriptState*); | 41 ScriptValue toJSONForBinding(ScriptState*); |
39 | 42 |
40 DECLARE_TRACE(); | 43 DECLARE_TRACE(); |
41 | 44 |
42 private: | 45 private: |
43 PushSubscription(const WebPushSubscription&, ServiceWorkerRegistration*); | 46 PushSubscription(const WebPushSubscription&, ServiceWorkerRegistration*); |
44 | 47 |
45 KURL m_endpoint; | 48 KURL m_endpoint; |
46 | 49 |
50 Member<PushSubscriptionOptions> m_options; | |
51 | |
47 Member<DOMArrayBuffer> m_p256dh; | 52 Member<DOMArrayBuffer> m_p256dh; |
48 Member<DOMArrayBuffer> m_auth; | 53 Member<DOMArrayBuffer> m_auth; |
49 | 54 |
50 Member<ServiceWorkerRegistration> m_serviceWorkerRegistration; | 55 Member<ServiceWorkerRegistration> m_serviceWorkerRegistration; |
51 }; | 56 }; |
52 | 57 |
53 } // namespace blink | 58 } // namespace blink |
54 | 59 |
55 #endif // PushSubscription_h | 60 #endif // PushSubscription_h |
OLD | NEW |