blob: 0c780a48dda06fc19b8b83380078b934d6bb30e7 [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 "third_party/WebKit/public/platform/modules/fetch/fetch_api_request.mojom";
import "url/mojo/origin.mojom";
enum BackgroundFetchError {
NONE,
DUPLICATED_TAG,
INVALID_ARGUMENT,
INVALID_TAG
};
// Represents the definition of an icon developers can optionally provide with a
// Background Fetch fetch. Analogous to the following structure in the spec:
// https://wicg.github.io/background-fetch/#background-fetch-manager
struct IconDefinition {
string src;
string sizes;
string type;
};
// Represents the optional options a developer can provide when starting a new
// Background Fetch fetch. Analogous to the following structure in the spec:
// https://wicg.github.io/background-fetch/#background-fetch-manager
struct BackgroundFetchOptions {
array<IconDefinition> icons;
int64 total_download_size;
string title;
};
// Represents the information associated with a Background Fetch registration.
// Analogous to the following structure in the spec:
// https://wicg.github.io/background-fetch/#background-fetch-registration
struct BackgroundFetchRegistration {
string tag;
array<IconDefinition> icons;
int64 total_download_size;
string title;
};
interface BackgroundFetchService {
// Creates a new Background Fetch registration identified by |tag| with the
// given |options| for the sequence of |requests|.
Fetch(int64 service_worker_registration_id,
url.mojom.Origin origin,
string tag,
array<FetchAPIRequest> requests,
BackgroundFetchOptions options)
=> (BackgroundFetchError error,
BackgroundFetchRegistration? registration);
// Updates the user interface for the Background Fetch identified by the
// |service_worker_registration_id| and the |tag|.
UpdateUI(int64 service_worker_registration_id,
url.mojom.Origin origin,
string tag,
string title)
=> (BackgroundFetchError error);
// Aborts the Background Fetch registration identified by the
// |service_worker_registration_id| and the |tag|.
Abort(int64 service_worker_registration_id,
url.mojom.Origin origin,
string tag)
=> (BackgroundFetchError error);
// Gets the Background Fetch registration identified by the
// |service_worker_registration_id| and the |tag|.
GetRegistration(int64 service_worker_registration_id,
url.mojom.Origin origin,
string tag)
=> (BackgroundFetchError error,
BackgroundFetchRegistration? registration);
// Gets the sequence of tags for active Background Fetch registrations given
// the |service_worker_registration_id|.
GetTags(int64 service_worker_registration_id, url.mojom.Origin origin)
=> (BackgroundFetchError error,
array<string> tags);
};