Index: content/browser/background_fetch/background_fetch_event_dispatcher.h |
diff --git a/content/browser/background_fetch/background_fetch_event_dispatcher.h b/content/browser/background_fetch/background_fetch_event_dispatcher.h |
index 13bf614ed5fef1cb53686150547fb2989d90d04b..24a5933d4639d0baf45b94cb5b0b2b25ca36b530 100644 |
--- a/content/browser/background_fetch/background_fetch_event_dispatcher.h |
+++ b/content/browser/background_fetch/background_fetch_event_dispatcher.h |
@@ -17,6 +17,7 @@ |
namespace content { |
+struct BackgroundFetchSettledFetch; |
class ServiceWorkerContextWrapper; |
class ServiceWorkerRegistration; |
class ServiceWorkerVersion; |
@@ -39,9 +40,6 @@ class CONTENT_EXPORT BackgroundFetchEventDispatcher { |
const scoped_refptr<ServiceWorkerContextWrapper>& service_worker_context); |
~BackgroundFetchEventDispatcher(); |
- // TODO(peter): Support the `backgroundfetched` event. |
- // TODO(peter): Support the `backgroundfetchfail` event. |
- |
// Dispatches the `backgroundfetchabort` event, which indicates that an active |
// background fetch was aborted by the user or another external event. |
void DispatchBackgroundFetchAbortEvent(int64_t service_worker_registration_id, |
@@ -57,6 +55,25 @@ class CONTENT_EXPORT BackgroundFetchEventDispatcher { |
mojom::BackgroundFetchState state, |
base::Closure finished_closure); |
+ // Dispatches the `backgroundfetchfail` event, which indicates that a |
+ // background fetch has finished with one or more failed fetches. The request- |
+ // response pairs are included. |
+ void DispatchBackgroundFetchFailEvent( |
+ int64_t service_worker_registration_id, |
+ const GURL& origin, |
+ const std::string& tag, |
+ const std::vector<BackgroundFetchSettledFetch>& fetches, |
+ base::Closure finished_closure); |
+ |
+ // Dispatches the `backgroundfetched` event, which indicates that a background |
+ // fetch has successfully completed. The request-response pairs are included. |
+ void DispatchBackgroundFetchedEvent( |
+ int64_t service_worker_registration_id, |
+ const GURL& origin, |
+ const std::string& tag, |
+ const std::vector<BackgroundFetchSettledFetch>& fetches, |
+ base::Closure finished_closure); |
+ |
private: |
using ServiceWorkerLoadedCallback = |
base::Callback<void(scoped_refptr<ServiceWorkerVersion>, int)>; |
@@ -108,6 +125,16 @@ class CONTENT_EXPORT BackgroundFetchEventDispatcher { |
mojom::BackgroundFetchState state, |
scoped_refptr<ServiceWorkerVersion> service_worker_version, |
int request_id); |
+ static void DoDispatchBackgroundFetchFailEvent( |
+ const std::string& tag, |
+ const std::vector<BackgroundFetchSettledFetch>& fetches, |
+ scoped_refptr<ServiceWorkerVersion> service_worker_version, |
+ int request_id); |
+ static void DoDispatchBackgroundFetchedEvent( |
+ const std::string& tag, |
+ const std::vector<BackgroundFetchSettledFetch>& fetches, |
+ scoped_refptr<ServiceWorkerVersion> service_worker_version, |
+ int request_id); |
scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; |