blob: 94117bd943ed10a21012b6f8a072e60a9a5f523e [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.
syntax = "proto2";
option optimize_for = LITE_RUNTIME;
package content.proto;
// Stores per-registration (as opposed to per-request) data.
// https://wicg.github.io/background-fetch/#background-fetch-registration
//
// Next Tag: 9
message BackgroundFetchRegistration {
enum BackgroundFetchResult {
UNSET = 0; // Default value.
FAILURE = 1;
SUCCESS = 2;
}
// This should be kept in sync with blink.mojom.BackgroundFetchFailureReason.
enum BackgroundFetchFailureReason {
NONE = 0; // Default value.
CANCELLED_FROM_UI = 1;
CANCELLED_BY_DEVELOPER = 2;
BAD_STATUS = 3;
FETCH_ERROR = 4;
SERVICE_WORKER_UNAVAILABLE = 5;
QUOTA_EXCEEDED = 6;
DOWNLOAD_TOTAL_EXCEEDED = 7;
}
// See definition of |unique_id| in BackgroundFetchRegistrationId.
optional string unique_id = 1;
// See definition of |developer_id| in BackgroundFetchRegistrationId.
optional bytes developer_id = 2;
optional uint64 upload_total = 3;
optional uint64 uploaded = 4;
optional uint64 download_total = 5;
optional uint64 downloaded = 6;
optional BackgroundFetchResult result = 7;
optional BackgroundFetchFailureReason failure_reason = 8;
}
// Developer provided options.
// https://wicg.github.io/background-fetch/#background-fetch-manager
//
// Next Tag: 3
message BackgroundFetchOptions {
// The initial title provided by the developer. This can be updated,
// and the most recent value is stored in BackgroundFetchUIOptions.
optional string title = 1;
// https://w3c.github.io/manifest/#dom-imageresource
//
// Next Tag: 5
message ImageResource {
optional string src = 1;
// Next Tag: 3
message Size {
optional int32 width = 1;
optional int32 height = 2;
}
repeated Size sizes = 2;
optional bytes type = 3;
// https://w3c.github.io/manifest/#purpose-member
enum Purpose {
ANY = 1;
BADGE = 2;
MASKABLE = 3;
}
// blink::Manifest::ImageResource::Purpose enum.
repeated Purpose purpose = 4;
}
repeated ImageResource icons = 2;
optional uint64 download_total = 3;
}
// Stores information about the background fetch that will be persisted
// in memory. This information should be everything needed to reconstruct
// the state of an interrupted background fetch.
//
// Next Tag: 6
message BackgroundFetchMetadata {
optional int64 creation_microseconds_since_unix_epoch = 1;
optional string origin = 2;
optional BackgroundFetchRegistration registration = 3;
optional BackgroundFetchOptions options = 4;
// Number of fetches initiated by the developer.
optional int32 num_fetches = 5;
}
// All the updateable options that show up in the UI (e.g. notification).
//
// Next Tag: 3
message BackgroundFetchUIOptions {
optional string title = 1;
// Raw bytes needed to deserialize into a PNG icon. Only used if the icon
// has a max resolution of 256x256. This means this is at most ~256KB.
optional bytes icon = 2;
}
// A background fetch request that is still in a pending state.
//
// Next Tag: 6
message BackgroundFetchPendingRequest {
optional string unique_id = 1;
optional int32 request_index = 2;
optional string serialized_request = 3;
optional uint64 request_body_size = 5;
reserved 4;
}
// A background fetch request in the active state. This means that
// the DownloadManager started downloading the file.
//
// Next Tag: 7
message BackgroundFetchActiveRequest {
optional string unique_id = 1;
optional int32 request_index = 2;
optional string serialized_request = 3;
optional string download_guid = 4;
optional uint64 request_body_size = 6;
reserved 5;
}
// A background fetch request in the completed state. This means that
// the DownloadManager returned the download.
//
// Next Tag: 7
message BackgroundFetchCompletedRequest {
optional string unique_id = 1;
optional int32 request_index = 2;
optional string serialized_request = 3;
optional string download_guid = 4;
optional bool succeeded = 5 [deprecated = true];
optional BackgroundFetchRegistration.BackgroundFetchFailureReason
failure_reason = 6;
}