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

Unified Diff: content/browser/background_fetch/background_fetch_event_dispatcher.h

Issue 2767093004: Implement the BackgroundFetch{Fail,ed} Service Worker events (Closed)
Patch Set: forward declare the data view Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/background_fetch/background_fetch_event_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« no previous file with comments | « no previous file | content/browser/background_fetch/background_fetch_event_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698