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