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 SyncRegistration_h |
| 6 #define SyncRegistration_h |
| 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptWrappable.h" |
| 10 #include "modules/background_sync/SyncRegistrationOptions.h" |
| 11 #include "platform/heap/Handle.h" |
| 12 #include "wtf/text/WTFString.h" |
| 13 |
| 14 namespace blink { |
| 15 |
| 16 class ServiceWorkerRegistration; |
| 17 class ScriptPromiseResolver; |
| 18 class ScriptState; |
| 19 struct WebSyncRegistration; |
| 20 |
| 21 class SyncRegistration final : public GarbageCollectedFinalized<SyncRegistration
>, public ScriptWrappable { |
| 22 DEFINE_WRAPPERTYPEINFO(); |
| 23 public: |
| 24 static SyncRegistration* take(ScriptPromiseResolver*, WebSyncRegistration*,
ServiceWorkerRegistration*); |
| 25 static void dispose(WebSyncRegistration* registrationRaw); |
| 26 |
| 27 virtual ~SyncRegistration(); |
| 28 |
| 29 bool hasAllowOnBattery() const { return !m_allowOnBattery.isNull(); } |
| 30 bool allowOnBattery() const { return m_allowOnBattery.get(); } |
| 31 void setAllowOnBattery(bool value) { m_allowOnBattery = value; } |
| 32 |
| 33 bool hasId() const { return !m_id.isNull(); } |
| 34 String id() const { return m_id; } |
| 35 void setId(String value) { m_id = value; } |
| 36 |
| 37 bool hasIdleRequired() const { return !m_idleRequired.isNull(); } |
| 38 bool idleRequired() const { return m_idleRequired.get(); } |
| 39 void setIdleRequired(bool value) { m_idleRequired = value; } |
| 40 |
| 41 bool hasMaxDelay() const { return !m_maxDelay.isNull(); } |
| 42 unsigned long maxDelay() const { return m_maxDelay.get(); } |
| 43 void setMaxDelay(unsigned long value) { m_maxDelay = value; } |
| 44 |
| 45 bool hasMinDelay() const { return !m_minDelay.isNull(); } |
| 46 unsigned long minDelay() const { return m_minDelay.get(); } |
| 47 void setMinDelay(unsigned long value) { m_minDelay = value; } |
| 48 |
| 49 bool hasMinPeriod() const { return !m_minPeriod.isNull(); } |
| 50 unsigned long minPeriod() const { return m_minPeriod.get(); } |
| 51 void setMinPeriod(unsigned long value) { m_minPeriod = value; } |
| 52 |
| 53 bool hasMinRequiredNetwork() const { return !m_minRequiredNetwork.isNull();
} |
| 54 String minRequiredNetwork() const { return m_minRequiredNetwork; } |
| 55 void setMinRequiredNetwork(String value) { m_minRequiredNetwork = value; } |
| 56 |
| 57 ScriptPromise unregister(ScriptState*); |
| 58 |
| 59 DECLARE_TRACE(); |
| 60 |
| 61 private: |
| 62 SyncRegistration(const SyncRegistrationOptions&, ServiceWorkerRegistration*)
; |
| 63 |
| 64 Nullable<bool> m_allowOnBattery; |
| 65 String m_id; |
| 66 Nullable<bool> m_idleRequired; |
| 67 Nullable<unsigned long> m_maxDelay; |
| 68 Nullable<unsigned long> m_minDelay; |
| 69 Nullable<unsigned long> m_minPeriod; |
| 70 String m_minRequiredNetwork; |
| 71 |
| 72 Member<ServiceWorkerRegistration> m_serviceWorkerRegistration; |
| 73 }; |
| 74 |
| 75 } // namespace blink |
| 76 |
| 77 #endif // SyncRegistration_h |
OLD | NEW |