blob: 776c4352ace977497a43dae935f732787a97094a [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 content.mojom;
import "mojo/public/mojom/base/time.mojom";
import "third_party/blink/public/mojom/blob/blob.mojom";
import "third_party/blink/public/mojom/service_worker/service_worker_stream_handle.mojom";
[Native]
struct ServiceWorkerResponse;
// Callback interface which is passed to a controller service worker through
// DispatchFetchEvent (either via ServiceWorkerEventDispatcher 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|. The body is empty.
OnResponse(ServiceWorkerResponse response,
mojo_base.mojom.Time dispatch_event_time);
// Responds to the request with |response|. The body is returned as a blob.
// TODO(kinuko): This should not be necessary once we properly support
// transferring blob within |response|. See crbug.com/75523 for more details.
OnResponseBlob(ServiceWorkerResponse response,
blink.mojom.Blob body_as_blob,
mojo_base.mojom.Time dispatch_event_time);
// Responds to the request with |response|. The body is returned as a stream.
OnResponseStream(ServiceWorkerResponse response,
blink.mojom.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);
};