1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
|
// Copyright 2017 The Chromium Authors
// 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;
}
// TODO(crbug.com/40245169): Move ImageResource to generic place.
// Currently also being used within chrome/browser/web_applications
// 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;
MONOCHROME = 2;
MASKABLE = 3;
}
// blink::mojom::ManifestImageResource_Purpose enum.
repeated Purpose purpose = 4;
}
// 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;
repeated ImageResource icons = 2;
optional uint64 download_total = 3;
}
// Keeps track of the version of the persisted data. If a breaking change
// needs to be made, increment `CURRENT`, and replace it with a descriptive
// name of the change. Don't directly check against `SV_CURRENT` as it can be
// changed.
// For example, if you want to enable a new key format for the SWDB, perform
// the following steps:
// 1. Add a new enum value (SV_ENABLE_NEW_KEY_FORMAT) and increment
// `SV_CURRENT`
// 2. Migrate the old formats on database load (DatabaseMigrationTask).
// 3. Add a TODO with a bug to clean this up after 2 milestones or so.
//
// Next Value: 3
enum BackgroundFetchStorageVersion {
// There was an error when trying to get the storage version.
SV_ERROR = -1;
// No storage version was found.
SV_UNINITIALIZED = 0;
// Migrate registered fetches to use the new Cache URL key format, to make
// them unique, and allow for duplicate requests in a registration.
SV_UNIQUE_CACHE_KEYS = 1;
// Add new versions here.
// Must be last.
SV_CURRENT = 2;
}
// Stores information about the background fetch that will be persisted
// to disk. This information should be everything needed to reconstruct
// the state of an interrupted background fetch.
//
// Next Tag: 8
message BackgroundFetchMetadata {
optional int64 creation_microseconds_since_unix_epoch = 1;
optional string origin = 2 [deprecated = true];
optional BackgroundFetchRegistration registration = 3;
optional BackgroundFetchOptions options = 4;
// Number of fetches initiated by the developer.
optional int32 num_fetches = 5;
// Serialized net::IsolationInfo associated with the Background Fetch.
optional string isolation_info = 6;
// Serialized storage key; this replaces origin
optional string storage_key = 7;
}
// 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 BackgroundFetchRegistration.BackgroundFetchFailureReason
failure_reason = 6;
reserved 5;
}
|