| 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 | 17 |
| 17 namespace blink { | 18 namespace blink { |
| 18 | 19 |
| 19 class ServiceWorkerRegistration; | 20 class ServiceWorkerRegistration; |
| 20 class ScriptPromiseResolver; | 21 class ScriptPromiseResolver; |
| 21 class ScriptState; | 22 class ScriptState; |
| 22 struct WebPushSubscription; | 23 struct WebPushSubscription; |
| 23 | 24 |
| 24 class PushSubscription final : public GarbageCollectedFinalized<PushSubscription
>, public ScriptWrappable { | 25 class PushSubscription final : public GarbageCollectedFinalized<PushSubscription
>, public ScriptWrappable { |
| 25 DEFINE_WRAPPERTYPEINFO(); | 26 DEFINE_WRAPPERTYPEINFO(); |
| 26 public: | 27 public: |
| 27 static PushSubscription* take(ScriptPromiseResolver*, PassOwnPtr<WebPushSubs
cription>, ServiceWorkerRegistration*); | 28 static PushSubscription* take(ScriptPromiseResolver*, std::unique_ptr<WebPus
hSubscription>, ServiceWorkerRegistration*); |
| 28 static void dispose(WebPushSubscription* subscriptionRaw); | 29 static void dispose(WebPushSubscription* subscriptionRaw); |
| 29 | 30 |
| 30 virtual ~PushSubscription(); | 31 virtual ~PushSubscription(); |
| 31 | 32 |
| 32 KURL endpoint() const; | 33 KURL endpoint() const; |
| 33 | 34 |
| 34 DOMArrayBuffer* getKey(const AtomicString& name) const; | 35 DOMArrayBuffer* getKey(const AtomicString& name) const; |
| 35 ScriptPromise unsubscribe(ScriptState*); | 36 ScriptPromise unsubscribe(ScriptState*); |
| 36 | 37 |
| 37 ScriptValue toJSONForBinding(ScriptState*); | 38 ScriptValue toJSONForBinding(ScriptState*); |
| 38 | 39 |
| 39 DECLARE_TRACE(); | 40 DECLARE_TRACE(); |
| 40 | 41 |
| 41 private: | 42 private: |
| 42 PushSubscription(const WebPushSubscription&, ServiceWorkerRegistration*); | 43 PushSubscription(const WebPushSubscription&, ServiceWorkerRegistration*); |
| 43 | 44 |
| 44 KURL m_endpoint; | 45 KURL m_endpoint; |
| 45 | 46 |
| 46 Member<DOMArrayBuffer> m_p256dh; | 47 Member<DOMArrayBuffer> m_p256dh; |
| 47 Member<DOMArrayBuffer> m_auth; | 48 Member<DOMArrayBuffer> m_auth; |
| 48 | 49 |
| 49 Member<ServiceWorkerRegistration> m_serviceWorkerRegistration; | 50 Member<ServiceWorkerRegistration> m_serviceWorkerRegistration; |
| 50 }; | 51 }; |
| 51 | 52 |
| 52 } // namespace blink | 53 } // namespace blink |
| 53 | 54 |
| 54 #endif // PushSubscription_h | 55 #endif // PushSubscription_h |
| OLD | NEW |