OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef PeriodicSyncRegistration_h |
| 6 #define PeriodicSyncRegistration_h |
| 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptWrappable.h" |
| 10 #include "modules/background_sync/PeriodicSyncRegistrationOptions.h" |
| 11 #include "wtf/text/WTFString.h" |
| 12 |
| 13 namespace blink { |
| 14 |
| 15 class ServiceWorkerRegistration; |
| 16 class ScriptPromiseResolver; |
| 17 class ScriptState; |
| 18 struct WebSyncRegistration; |
| 19 |
| 20 class PeriodicSyncRegistration final : public GarbageCollectedFinalized<Periodic
SyncRegistration>, public ScriptWrappable { |
| 21 DEFINE_WRAPPERTYPEINFO(); |
| 22 public: |
| 23 static PeriodicSyncRegistration* take(ScriptPromiseResolver*, WebSyncRegistr
ation*, ServiceWorkerRegistration*); |
| 24 static void dispose(WebSyncRegistration* registrationRaw); |
| 25 |
| 26 virtual ~PeriodicSyncRegistration(); |
| 27 |
| 28 bool hasMinPeriod() const { return !m_minPeriod.isNull(); } |
| 29 unsigned long minPeriod() const { return m_minPeriod.get(); } |
| 30 void setMinPeriod(unsigned long value) { m_minPeriod = value; } |
| 31 |
| 32 bool hasNetworkState() const { return !m_networkState.isNull(); } |
| 33 String networkState() const { return m_networkState; } |
| 34 void setNetworkState(String value) { m_networkState = value; } |
| 35 |
| 36 bool hasPowerState() const { return !m_powerState.isNull(); } |
| 37 String powerState() const { return m_powerState; } |
| 38 void setPowerState(String value) { m_powerState = value; } |
| 39 |
| 40 bool hasTag() const { return !m_tag.isNull(); } |
| 41 String tag() const { return m_tag; } |
| 42 void setTag(String value) { m_tag = value; } |
| 43 |
| 44 ScriptPromise unregister(ScriptState*); |
| 45 |
| 46 DECLARE_TRACE(); |
| 47 |
| 48 private: |
| 49 PeriodicSyncRegistration(int64_t id, const PeriodicSyncRegistrationOptions&,
ServiceWorkerRegistration*); |
| 50 |
| 51 int64_t m_id; |
| 52 Nullable<unsigned long> m_minPeriod; |
| 53 String m_networkState; |
| 54 String m_powerState; |
| 55 String m_tag; |
| 56 |
| 57 Member<ServiceWorkerRegistration> m_serviceWorkerRegistration; |
| 58 }; |
| 59 |
| 60 } // namespace blink |
| 61 |
| 62 #endif // PeriodicSyncRegistration_h |
OLD | NEW |