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