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 SyncRegistration_h | 5 #ifndef SyncRegistration_h |
6 #define SyncRegistration_h | 6 #define SyncRegistration_h |
7 | 7 |
8 #include "bindings/core/v8/Nullable.h" | |
8 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
9 #include "bindings/core/v8/ScriptWrappable.h" | 10 #include "bindings/core/v8/ScriptWrappable.h" |
10 #include "modules/background_sync/SyncRegistrationOptions.h" | 11 #include "modules/background_sync/SyncRegistrationOptions.h" |
11 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
12 #include "wtf/text/WTFString.h" | 13 #include "wtf/text/WTFString.h" |
13 | 14 |
14 namespace blink { | 15 namespace blink { |
15 | 16 |
16 class ServiceWorkerRegistration; | 17 class ServiceWorkerRegistration; |
17 class ScriptPromiseResolver; | 18 class ScriptPromiseResolver; |
18 class ScriptState; | 19 class ScriptState; |
19 struct WebSyncRegistration; | 20 struct WebSyncRegistration; |
20 | 21 |
21 class SyncRegistration final : public GarbageCollectedFinalized<SyncRegistration >, public ScriptWrappable { | 22 class SyncRegistration final : public GarbageCollectedFinalized<SyncRegistration >, public ScriptWrappable { |
22 DEFINE_WRAPPERTYPEINFO(); | 23 DEFINE_WRAPPERTYPEINFO(); |
23 public: | 24 public: |
24 static SyncRegistration* take(ScriptPromiseResolver*, WebSyncRegistration*, ServiceWorkerRegistration*); | 25 static SyncRegistration* take(ScriptPromiseResolver*, WebSyncRegistration*, ServiceWorkerRegistration*); |
25 static void dispose(WebSyncRegistration* registrationRaw); | 26 static void dispose(WebSyncRegistration* registrationRaw); |
26 | 27 |
27 virtual ~SyncRegistration(); | 28 virtual ~SyncRegistration(); |
28 | 29 |
29 bool hasAllowOnBattery() const { return !m_allowOnBattery.isNull(); } | 30 bool hasTag() const { return !m_tag.isNull(); } |
30 bool allowOnBattery() const { return m_allowOnBattery.get(); } | 31 String tag() const { return m_tag; } |
31 void setAllowOnBattery(bool value) { m_allowOnBattery = value; } | 32 void setTag(String value) { m_tag = 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 | 33 |
57 ScriptPromise unregister(ScriptState*); | 34 ScriptPromise unregister(ScriptState*); |
58 | 35 |
59 DECLARE_TRACE(); | 36 DECLARE_TRACE(); |
60 | 37 |
61 private: | 38 private: |
62 SyncRegistration(const SyncRegistrationOptions&, ServiceWorkerRegistration*) ; | 39 SyncRegistration(int64_t id, const SyncRegistrationOptions&, ServiceWorkerRe gistration*); |
63 | 40 |
64 Nullable<bool> m_allowOnBattery; | 41 Nullable<int64_t> m_id; |
jkarlin
2015/04/17 19:04:49
Doesn't need to be nullable.
iclelland
2015/04/22 14:05:11
Done. Fixed (also fixed in PeriodicSyncRegistratio
| |
65 String m_id; | 42 String m_tag; |
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 | 43 |
72 Member<ServiceWorkerRegistration> m_serviceWorkerRegistration; | 44 Member<ServiceWorkerRegistration> m_serviceWorkerRegistration; |
73 }; | 45 }; |
74 | 46 |
75 } // namespace blink | 47 } // namespace blink |
76 | 48 |
77 #endif // SyncRegistration_h | 49 #endif // SyncRegistration_h |
OLD | NEW |