OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 BackgroundFetchRegistration_h | 5 #ifndef BackgroundFetchRegistration_h |
6 #define BackgroundFetchRegistration_h | 6 #define BackgroundFetchRegistration_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 "platform/heap/GarbageCollected.h" | 10 #include "platform/heap/GarbageCollected.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 IconDefinition; | 16 class IconDefinition; |
17 class ServiceWorkerRegistration; | 17 class ServiceWorkerRegistration; |
18 | 18 |
19 // Represents an individual Background Fetch registration. Gives developers | 19 // Represents an individual Background Fetch registration. Gives developers |
20 // access to its properties, options, and enables them to abort the fetch. | 20 // access to its properties, options, and enables them to abort the fetch. |
21 class BackgroundFetchRegistration final | 21 class BackgroundFetchRegistration final |
22 : public GarbageCollectedFinalized<BackgroundFetchRegistration>, | 22 : public GarbageCollectedFinalized<BackgroundFetchRegistration>, |
23 public ScriptWrappable { | 23 public ScriptWrappable { |
24 DEFINE_WRAPPERTYPEINFO(); | 24 DEFINE_WRAPPERTYPEINFO(); |
25 | 25 |
26 public: | 26 public: |
27 BackgroundFetchRegistration(ServiceWorkerRegistration*, | 27 BackgroundFetchRegistration(String tag, |
28 String tag, | |
29 HeapVector<IconDefinition> icons, | 28 HeapVector<IconDefinition> icons, |
30 long long totalDownloadSize, | 29 long long totalDownloadSize, |
31 String title); | 30 String title); |
32 ~BackgroundFetchRegistration(); | 31 ~BackgroundFetchRegistration(); |
33 | 32 |
| 33 // Sets the ServiceWorkerRegistration that this BackgroundFetchRegistration |
| 34 // has been associated with. |
| 35 void setServiceWorkerRegistration(ServiceWorkerRegistration*); |
| 36 |
34 String tag() const; | 37 String tag() const; |
35 HeapVector<IconDefinition> icons() const; | 38 HeapVector<IconDefinition> icons() const; |
36 long long totalDownloadSize() const; | 39 long long totalDownloadSize() const; |
37 String title() const; | 40 String title() const; |
38 | 41 |
39 void abort(); | 42 void abort(); |
40 | 43 |
41 DECLARE_TRACE(); | 44 DECLARE_TRACE(); |
42 | 45 |
43 private: | 46 private: |
44 Member<ServiceWorkerRegistration> m_registration; | 47 Member<ServiceWorkerRegistration> m_registration; |
45 | 48 |
46 String m_tag; | 49 String m_tag; |
47 HeapVector<IconDefinition> m_icons; | 50 HeapVector<IconDefinition> m_icons; |
48 long long m_totalDownloadSize; | 51 long long m_totalDownloadSize; |
49 String m_title; | 52 String m_title; |
50 }; | 53 }; |
51 | 54 |
52 } // namespace blink | 55 } // namespace blink |
53 | 56 |
54 #endif // BackgroundFetchRegistration_h | 57 #endif // BackgroundFetchRegistration_h |
OLD | NEW |