| 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 "public/platform/modules/background_fetch/background_fetch.mojom-blink.
h" | 12 #include "public/platform/modules/background_fetch/background_fetch.mojom-blink.
h" |
| 13 #include "wtf/text/WTFString.h" | 13 #include "wtf/text/WTFString.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 class IconDefinition; | 17 class IconDefinition; |
| 18 class ScriptPromiseResolver; | 18 class ScriptPromiseResolver; |
| 19 class ScriptState; | 19 class ScriptState; |
| 20 class ServiceWorkerRegistration; | 20 class ServiceWorkerRegistration; |
| 21 | 21 |
| 22 // Represents an individual Background Fetch registration. Gives developers | 22 // Represents an individual Background Fetch registration. Gives developers |
| 23 // access to its properties, options, and enables them to abort the fetch. | 23 // access to its properties, options, and enables them to abort the fetch. |
| 24 class BackgroundFetchRegistration final | 24 class BackgroundFetchRegistration final |
| 25 : public GarbageCollectedFinalized<BackgroundFetchRegistration>, | 25 : public GarbageCollectedFinalized<BackgroundFetchRegistration>, |
| 26 public ScriptWrappable { | 26 public ScriptWrappable { |
| 27 DEFINE_WRAPPERTYPEINFO(); | 27 DEFINE_WRAPPERTYPEINFO(); |
| 28 | 28 |
| 29 public: | 29 public: |
| 30 BackgroundFetchRegistration(ServiceWorkerRegistration*, | 30 BackgroundFetchRegistration(String tag, |
| 31 String tag, | |
| 32 HeapVector<IconDefinition> icons, | 31 HeapVector<IconDefinition> icons, |
| 33 long long totalDownloadSize, | 32 long long totalDownloadSize, |
| 34 String title); | 33 String title); |
| 35 ~BackgroundFetchRegistration(); | 34 ~BackgroundFetchRegistration(); |
| 36 | 35 |
| 36 // Sets the ServiceWorkerRegistration that this BackgroundFetchRegistration |
| 37 // has been associated with. |
| 38 void setServiceWorkerRegistration(ServiceWorkerRegistration*); |
| 39 |
| 37 String tag() const; | 40 String tag() const; |
| 38 HeapVector<IconDefinition> icons() const; | 41 HeapVector<IconDefinition> icons() const; |
| 39 long long totalDownloadSize() const; | 42 long long totalDownloadSize() const; |
| 40 String title() const; | 43 String title() const; |
| 41 | 44 |
| 42 ScriptPromise abort(ScriptState*); | 45 ScriptPromise abort(ScriptState*); |
| 43 | 46 |
| 44 DECLARE_TRACE(); | 47 DECLARE_TRACE(); |
| 45 | 48 |
| 46 private: | 49 private: |
| 47 void didAbort(ScriptPromiseResolver*, mojom::blink::BackgroundFetchError); | 50 void didAbort(ScriptPromiseResolver*, mojom::blink::BackgroundFetchError); |
| 48 | 51 |
| 49 Member<ServiceWorkerRegistration> m_registration; | 52 Member<ServiceWorkerRegistration> m_registration; |
| 50 | 53 |
| 51 String m_tag; | 54 String m_tag; |
| 52 HeapVector<IconDefinition> m_icons; | 55 HeapVector<IconDefinition> m_icons; |
| 53 long long m_totalDownloadSize; | 56 long long m_totalDownloadSize; |
| 54 String m_title; | 57 String m_title; |
| 55 }; | 58 }; |
| 56 | 59 |
| 57 } // namespace blink | 60 } // namespace blink |
| 58 | 61 |
| 59 #endif // BackgroundFetchRegistration_h | 62 #endif // BackgroundFetchRegistration_h |
| OLD | NEW |