Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 SyncRegistration_h |
| 6 #define PushSubscription_h | 6 #define SyncRegistration_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptWrappable.h" | 9 #include "bindings/core/v8/ScriptWrappable.h" |
| 10 #include "modules/background_sync/SyncRegistrationOptions.h" | |
| 10 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
| 11 #include "wtf/text/WTFString.h" | 12 #include "wtf/text/WTFString.h" |
| 12 | 13 |
| 13 namespace blink { | 14 namespace blink { |
| 14 | 15 |
| 15 class ServiceWorkerRegistration; | 16 class ServiceWorkerRegistration; |
| 16 class ScriptPromiseResolver; | 17 class ScriptPromiseResolver; |
| 17 class ScriptState; | 18 class ScriptState; |
| 18 struct WebPushSubscription; | 19 struct WebSyncRegistration; |
| 19 | 20 |
| 20 class PushSubscription final : public GarbageCollectedFinalized<PushSubscription >, public ScriptWrappable { | 21 class SyncRegistration final : public GarbageCollectedFinalized<SyncRegistration >, public ScriptWrappable { |
| 21 DEFINE_WRAPPERTYPEINFO(); | 22 DEFINE_WRAPPERTYPEINFO(); |
| 22 public: | 23 public: |
| 23 static PushSubscription* take(ScriptPromiseResolver*, WebPushSubscription*, ServiceWorkerRegistration*); | 24 static SyncRegistration* take(ScriptPromiseResolver*, WebSyncRegistration*, ServiceWorkerRegistration*); |
| 24 static void dispose(WebPushSubscription* subscriptionRaw); | 25 static void dispose(WebSyncRegistration* registrationRaw); |
| 25 | 26 |
| 26 virtual ~PushSubscription(); | 27 virtual ~SyncRegistration(); |
| 27 | 28 |
| 28 const String& endpoint() const { return m_endpoint; } | 29 const String& id() const { return m_registrationId; } |
| 29 const String& subscriptionId() const { return m_subscriptionId; } | 30 void options(SyncRegistrationOptions& options) { options = m_syncRegistratio nOptions; } |
| 30 ScriptPromise unsubscribe(ScriptState*); | 31 ScriptPromise unregister(ScriptState*); |
| 31 | 32 |
| 32 DECLARE_TRACE(); | 33 void trace(Visitor*); |
|
jkarlin
2015/02/27 20:08:13
DECLARE_TRACE();
iclelland
2015/03/02 03:51:12
Done.
| |
| 33 | 34 |
| 34 private: | 35 private: |
| 35 PushSubscription(const String& endpoint, const String& subscriptionId, Servi ceWorkerRegistration*); | 36 SyncRegistration(const String& id, const SyncRegistrationOptions&, ServiceWo rkerRegistration*); |
| 36 | 37 |
| 37 String m_endpoint; | 38 String m_registrationId; |
| 38 String m_subscriptionId; | 39 SyncRegistrationOptions m_syncRegistrationOptions; |
| 39 Member<ServiceWorkerRegistration> m_serviceWorkerRegistration; | 40 Member<ServiceWorkerRegistration> m_serviceWorkerRegistration; |
| 40 }; | 41 }; |
| 41 | 42 |
| 42 } // namespace blink | 43 } // namespace blink |
| 43 | 44 |
| 44 #endif // PushSubscription_h | 45 #endif // SyncRegistration_h |
| OLD | NEW |