| 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 "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
| 12 #include "platform/weborigin/KURL.h" | 13 #include "platform/weborigin/KURL.h" |
| 14 #include "wtf/PassRefPtr.h" |
| 15 #include "wtf/RefPtr.h" |
| 13 | 16 |
| 14 namespace blink { | 17 namespace blink { |
| 15 | 18 |
| 16 class ServiceWorkerRegistration; | 19 class ServiceWorkerRegistration; |
| 17 class ScriptPromiseResolver; | 20 class ScriptPromiseResolver; |
| 18 class ScriptState; | 21 class ScriptState; |
| 19 struct WebPushSubscription; | 22 struct WebPushSubscription; |
| 20 | 23 |
| 21 class PushSubscription final : public GarbageCollectedFinalized<PushSubscription
>, public ScriptWrappable { | 24 class PushSubscription final : public GarbageCollectedFinalized<PushSubscription
>, public ScriptWrappable { |
| 22 DEFINE_WRAPPERTYPEINFO(); | 25 DEFINE_WRAPPERTYPEINFO(); |
| 23 public: | 26 public: |
| 24 static PushSubscription* take(ScriptPromiseResolver*, WebPushSubscription*,
ServiceWorkerRegistration*); | 27 static PushSubscription* take(ScriptPromiseResolver*, WebPushSubscription*,
ServiceWorkerRegistration*); |
| 25 static void dispose(WebPushSubscription* subscriptionRaw); | 28 static void dispose(WebPushSubscription* subscriptionRaw); |
| 26 | 29 |
| 27 virtual ~PushSubscription(); | 30 virtual ~PushSubscription(); |
| 28 | 31 |
| 29 KURL endpoint() const; | 32 KURL endpoint() const; |
| 33 PassRefPtr<DOMArrayBuffer> curve25519dh() const; |
| 34 |
| 30 ScriptPromise unsubscribe(ScriptState*); | 35 ScriptPromise unsubscribe(ScriptState*); |
| 31 | 36 |
| 32 ScriptValue toJSONForBinding(ScriptState*); | 37 ScriptValue toJSONForBinding(ScriptState*); |
| 33 | 38 |
| 34 DECLARE_TRACE(); | 39 DECLARE_TRACE(); |
| 35 | 40 |
| 36 private: | 41 private: |
| 37 PushSubscription(const KURL& endpoint, ServiceWorkerRegistration*); | 42 PushSubscription(const WebPushSubscription&, ServiceWorkerRegistration*); |
| 38 | 43 |
| 39 KURL m_endpoint; | 44 KURL m_endpoint; |
| 45 RefPtr<DOMArrayBuffer> m_curve25519dh; |
| 46 |
| 40 Member<ServiceWorkerRegistration> m_serviceWorkerRegistration; | 47 Member<ServiceWorkerRegistration> m_serviceWorkerRegistration; |
| 41 }; | 48 }; |
| 42 | 49 |
| 43 } // namespace blink | 50 } // namespace blink |
| 44 | 51 |
| 45 #endif // PushSubscription_h | 52 #endif // PushSubscription_h |
| OLD | NEW |