Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: Source/modules/background_sync/SyncRegistration.h

Issue 1096503002: [Background Sync] Converting Blink code to the MVP API (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Unregister method requires the sync registration tag Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/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 "modules/background_sync/SyncRegistrationOptions.h"
11 #include "platform/heap/Handle.h" 11 #include "platform/heap/Handle.h"
12 #include "wtf/text/WTFString.h" 12 #include "wtf/text/WTFString.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 class ServiceWorkerRegistration; 16 class ServiceWorkerRegistration;
17 class ScriptPromiseResolver; 17 class ScriptPromiseResolver;
18 class ScriptState; 18 class ScriptState;
19 struct WebSyncRegistration; 19 struct WebSyncRegistration;
20 20
21 class SyncRegistration final : public GarbageCollectedFinalized<SyncRegistration >, public ScriptWrappable { 21 class SyncRegistration final : public GarbageCollectedFinalized<SyncRegistration >, public ScriptWrappable {
22 DEFINE_WRAPPERTYPEINFO(); 22 DEFINE_WRAPPERTYPEINFO();
23 public: 23 public:
24 static SyncRegistration* take(ScriptPromiseResolver*, WebSyncRegistration*, ServiceWorkerRegistration*); 24 static SyncRegistration* take(ScriptPromiseResolver*, WebSyncRegistration*, ServiceWorkerRegistration*);
25 static void dispose(WebSyncRegistration* registrationRaw); 25 static void dispose(WebSyncRegistration* registrationRaw);
26 26
27 virtual ~SyncRegistration(); 27 virtual ~SyncRegistration();
28 28
29 bool hasAllowOnBattery() const { return !m_allowOnBattery.isNull(); } 29 bool hasTag() const { return !m_tag.isNull(); }
30 bool allowOnBattery() const { return m_allowOnBattery.get(); } 30 String tag() const { return m_tag; }
31 void setAllowOnBattery(bool value) { m_allowOnBattery = value; } 31 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 32
57 ScriptPromise unregister(ScriptState*); 33 ScriptPromise unregister(ScriptState*);
58 34
59 DECLARE_TRACE(); 35 DECLARE_TRACE();
60 36
61 private: 37 private:
62 SyncRegistration(const SyncRegistrationOptions&, ServiceWorkerRegistration*) ; 38 SyncRegistration(int64_t id, const SyncRegistrationOptions&, ServiceWorkerRe gistration*);
63 39
64 Nullable<bool> m_allowOnBattery; 40 int64_t m_id;
65 String m_id; 41 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 42
72 Member<ServiceWorkerRegistration> m_serviceWorkerRegistration; 43 Member<ServiceWorkerRegistration> m_serviceWorkerRegistration;
73 }; 44 };
74 45
75 } // namespace blink 46 } // namespace blink
76 47
77 #endif // SyncRegistration_h 48 #endif // SyncRegistration_h
OLDNEW
« no previous file with comments | « Source/modules/background_sync/SyncManager.idl ('k') | Source/modules/background_sync/SyncRegistration.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698