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