blob: 9c184742379f4d8128a5a47464fc15709efea508 [file] [log] [blame]
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module blink.mojom;
import "mojo/public/mojom/base/time.mojom";
import "third_party/blink/public/mojom/blob/blob.mojom";
import "third_party/blink/public/mojom/fetch/fetch_api_response.mojom";
import "third_party/blink/public/mojom/service_worker/service_worker_stream_handle.mojom";
// Callback interface which is passed to a controller service worker through
// DispatchFetchEvent (either via ServiceWorker or via ControllerServiceWorker
// interface).
// The receiver service worker uses this interface to respond to a fetch event.
interface ServiceWorkerFetchResponseCallback {
// Responds to the request with |response|.
OnResponse(FetchAPIResponse response,
mojo_base.mojom.Time dispatch_event_time);
// Responds to the request with |response|. |response.blob| should be empty
// since the body is provided as a stream.
OnResponseStream(FetchAPIResponse response,
ServiceWorkerStreamHandle body_as_stream,
mojo_base.mojom.Time dispatch_event_time);
// Provides no response to the request. The callee should fall back to the
// network.
OnFallback(mojo_base.mojom.Time dispatch_event_time);
};